;;
reload)
if [ -f "$VSWITCHD_PIDFILE" ]; then
- kill -HUP $(cat "$VSWITCHD_PIDFILE")
+ "$VSWITCH_BASE"/bin/vlogconf \
+ --target=vswitchd.$(cat "$VSWITCHD_PIDFILE").ctl \
+ --execute=vswitchd/reload
fi
;;
strace)
static void parse_options(int argc, char *argv[]);
static void usage(void) NO_RETURN;
+static void reload(struct unixctl_conn *, const char *args);
-char *config_file;
+static bool need_reconfigure;
+static struct unixctl_conn **conns;
+static size_t n_conns;
int
main(int argc, char *argv[])
{
struct unixctl_server *unixctl;
struct signal *sighup;
- bool need_reconfigure;
int retval;
set_program_name(argv[0]);
if (retval) {
ofp_fatal(retval, "could not listen for control connections");
}
+ unixctl_command_register("vswitchd/reload", reload);
cfg_read();
mgmt_init();
return 0;
}
+static void
+reload(struct unixctl_conn *conn, const char *args UNUSED)
+{
+ need_reconfigure = true;
+ conns = xrealloc(conns, sizeof *conns * (n_conns + 1));
+ conns[n_conns++] = conn;
+}
+
void
reconfigure(void)
{
+ size_t i;
+
cfg_read();
bridge_reconfigure();
mgmt_reconfigure();
port_reconfigure();
+
+ for (i = 0; i < n_conns; i++) {
+ unixctl_command_reply(conns[i], 202, NULL);
+ }
+ free(conns);
+ conns = NULL;
+ n_conns = 0;
}
static void
{0, 0, 0, 0},
};
char *short_options = long_options_to_short_options(long_options);
+ const char *config_file;
int error;
for (;;) {