diff options
author | Alin Gabriel Serdean <aserdean@ovn.org> | 2018-10-05 17:54:27 +0300 |
---|---|---|
committer | Alin Gabriel Serdean <aserdean@ovn.org> | 2018-10-24 14:39:01 +0300 |
commit | 3fe1232de9b2df55eb083e3100ae5e509b8aa090 (patch) | |
tree | a2a754967d386e2cf74f3c7483ee94949a709103 /ovn/utilities/ovn-nbctl.c | |
parent | aa1a0f1aaf6a772327b712d0507735af5b8c791d (diff) | |
download | openvswitch-3fe1232de9b2df55eb083e3100ae5e509b8aa090.tar.gz |
windows, ovn-nbctl: Add service_start call inside the server loop
Currently all ovn-nbctl (daemon) tests are failing due to the missing
call to `service_start` which is required on Windows.
Windows lacks fork so we need to pass all arguments, so we can spawn a new
process and interpret it properly when calling `service_start`.
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Co-authored-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
Diffstat (limited to 'ovn/utilities/ovn-nbctl.c')
-rw-r--r-- | ovn/utilities/ovn-nbctl.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 798c97276..75dcb0752 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -117,7 +117,7 @@ static char * OVS_WARN_UNUSED_RESULT main_loop(const char *args, size_t n_commands, struct ovsdb_idl *idl, const struct timer *); -static void server_loop(struct ovsdb_idl *idl); +static void server_loop(struct ovsdb_idl *idl, int argc, char *argv[]); int main(int argc, char *argv[]) @@ -173,26 +173,24 @@ main(int argc, char *argv[]) shash_init(&local_options); apply_options_direct(parsed_options, n_parsed_options, &local_options); free(parsed_options); - argc -= optind; - argv += optind; /* Initialize IDL. */ idl = the_idl = ovsdb_idl_create(db, &nbrec_idl_class, true, false); ovsdb_idl_set_leader_only(idl, leader_only); if (get_detach()) { - if (argc != 0) { + if (argc != optind) { ctl_fatal("non-option arguments not supported with --detach " "(use --help for help)"); } - server_loop(idl); + server_loop(idl, argc, argv); } else { struct ctl_command *commands; size_t n_commands; char *error; - error = ctl_parse_commands(argc, argv, &local_options, &commands, - &n_commands); + error = ctl_parse_commands(argc - optind, argv + optind, + &local_options, &commands, &n_commands); if (error) { ctl_fatal("%s", error); } @@ -5426,11 +5424,12 @@ server_cmd_init(struct ovsdb_idl *idl, bool *exiting) } static void -server_loop(struct ovsdb_idl *idl) +server_loop(struct ovsdb_idl *idl, int argc, char *argv[]) { struct unixctl_server *server = NULL; bool exiting = false; + service_start(&argc, &argv); daemonize_start(false); int error = unixctl_server_create(unixctl_path, &server); if (error) { |