[ovs-dev] [bugs 3/4] ovsdb-server: Log version after daemonize_complete().

Ben Pfaff blp at nicira.com
Tue Jul 17 16:56:21 UTC 2012


On Tue, Jul 17, 2012 at 09:28:08AM -0700, Ethan Jackson wrote:
> This fixes a unit tests, and generally seems more correct.
> 
> Signed-off-by: Ethan Jackson <ethan at nicira.com>

Thanks, yes I agree that logging after daemonize_complete() rather
than before is a better idea.  It means that, if the monitor crashes
and restarts the process, then the version number gets logged again
(which seems like a good thing).

Since I didn't apply patch 2 I had to make a similar change to
ovs-vswitchd, and the result is below.

--8<--------------------------cut here-------------------------->8--

From: Ethan Jackson <ethan at nicira.com>
Date: Tue, 17 Jul 2012 09:28:08 -0700
Subject: [PATCH] ovsdb-server, ovs-vswitchd: Log version after daemonize_complete().

This fixes unit tests, and generally seems more correct.

Signed-off-by: Ethan Jackson <ethan at nicira.com>
[blp at nicira.com added the change to ovs-vswitchd]
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 ovsdb/ovsdb-server.c    |    4 ++--
 vswitchd/bridge.c       |    2 ++
 vswitchd/ovs-vswitchd.c |    2 --
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 8412cbb..b430b0e 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -105,8 +105,6 @@ main(int argc, char *argv[])
 
     daemonize_start();
 
-    VLOG_INFO("%s (Open vSwitch) %s", program_name, VERSION);
-
     error = ovsdb_file_open(file_name, false, &db, &file);
     if (error) {
         ovs_fatal(0, "%s", ovsdb_error_to_string(error));
@@ -139,6 +137,8 @@ main(int argc, char *argv[])
 
     daemonize_complete();
 
+    VLOG_INFO("%s (Open vSwitch) %s", program_name, VERSION);
+
     unixctl_command_register("exit", "", 0, 0, ovsdb_server_exit, &exiting);
     unixctl_command_register("ovsdb-server/compact", "", 0, 0,
                              ovsdb_server_compact, file);
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 3a3e58b..fa835e7 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -556,6 +556,8 @@ bridge_reconfigure_continue(const struct ovsrec_open_vswitch *ovs_cfg)
          * forked us to exit successfully. */
         daemonize_complete();
         reconfiguring = false;
+
+        VLOG_INFO("%s (Open vSwitch) %s", program_name, VERSION);
     }
 
     return done;
diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c
index 3b65178..6062a40 100644
--- a/vswitchd/ovs-vswitchd.c
+++ b/vswitchd/ovs-vswitchd.c
@@ -85,8 +85,6 @@ main(int argc, char *argv[])
 
     daemonize_start();
 
-    VLOG_INFO("%s (Open vSwitch) %s", program_name, VERSION);
-
     if (want_mlockall) {
 #ifdef HAVE_MLOCKALL
         if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
-- 
1.7.2.5




More information about the dev mailing list