Otherwise it's hard to diagnose later if the daemon failed to start because
it thinks that it is already running.
---
 lib/daemon.c         |    2 ++
 python/ovs/daemon.py |    6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/daemon.c b/lib/daemon.c
index 2f6f081..17ec9f5 100644
--- a/lib/daemon.c
+++ b/lib/daemon.c
@@ -171,6 +171,8 @@ die_if_already_running(void)
     pid_t pid = already_running();
     if (pid) {
         if (!overwrite_pidfile) {
+            VLOG_ERR("%s: %s already running as pid %ld, aborting",
+                      get_pidfile(), program_name, (long int) pid);
             ovs_fatal(0, "%s: already running as pid %ld",
                       get_pidfile(), (long int) pid);
         } else {
diff --git a/python/ovs/daemon.py b/python/ovs/daemon.py
index 6dff3a0..6240e0d 100644
--- a/python/ovs/daemon.py
+++ b/python/ovs/daemon.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2010 Nicira Networks
+# Copyright (c) 2010, 2011 Nicira Networks
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -141,7 +141,9 @@ def die_if_already_running():
     ignore_existing_pidfile() has been called, terminate the program."""
     if _already_running():
         if not _overwrite_pidfile:
-            sys.stderr.write("%s: already running\n" % get_pidfile())
+            msg = "%s: already running as pid %d" % (_pidfile, pid)
+            logging.error(msg)
+            sys.stderr.write("%s\n" % msg)
             sys.exit(1)
         else:
             logging.warn("%s: %s already running"
-- 
1.7.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to