[ovs-dev] [PATCH v2 2/2] windows, ovn-nbctl: Add service_start call inside the server loop

Alin Gabriel Serdean aserdean at ovn.org
Tue Oct 2 15:01:26 UTC 2018


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 at ovn.org>
Acked-by: Ben Pfaff <blp at ovn.org>
---
v2: Remove OVS_UNUSED, add acks
---
 ovn/utilities/ovn-nbctl.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index eabd30308..9062cecfb 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[])
@@ -185,7 +185,11 @@ main(int argc, char *argv[])
             ctl_fatal("non-option arguments not supported with --detach "
                       "(use --help for help)");
         }
-        server_loop(idl);
+#ifdef _WIN32
+        argc += optind;
+        argv -= optind;
+#endif
+        server_loop(idl, argc, argv);
     } else {
         struct ctl_command *commands;
         size_t n_commands;
@@ -5349,11 +5353,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) {
-- 
2.16.1.windows.1



More information about the dev mailing list