Ensure "service vswitch status" returns appropriate error code
authorIan Campbell <Ian.Campbell@citrix.com>
Wed, 14 Oct 2009 10:37:19 +0000 (11:37 +0100)
committerBen Pfaff <blp@nicira.com>
Fri, 26 Mar 2010 21:42:33 +0000 (14:42 -0700)
This command was returning success when vswitchd was not running.
Our automated test relies on this command to decide if the host uses
vswitch or not.

If vswitchd is not OK then brcompatd is not checked at all. Since the
return codes apparently have specific meanings I couldn't see a sensible
way to combine multiple failure results.

(Cherry-picked from xs5.7 branch by Ben Pfaff but merge conflicts meant
that the whole thing had to be redone.)

xenserver/etc_init.d_openvswitch

index 0101562..fe8360f 100755 (executable)
@@ -423,11 +423,10 @@ case "$1" in
         strace -p $(cat "$BRCOMPATD_PIDFILE") "$@"
         ;;
     status)
-        status -p "$OVSDB_SERVER_PIDFILE" ovsdb-server
-        status -p "$VSWITCHD_PIDFILE" ovs-vswitchd
-        if [ "$ENABLE_BRCOMPAT" = "y" ] ; then
-            status -p ovs-brcompatd.pid ovs-brcompatd
-        fi
+        status -p "$OVSDB_SERVER_PIDFILE" ovsdb-server &&
+        status -p "$VSWITCHD_PIDFILE" ovs-vswitchd &&
+        (test "$ENABLE_BRCOMPAT" != "y" || 
+            status -p "$BRCOMPATD_PIDFILE" ovs-brcompatd)
         ;;
     version)
         /usr/sbin/ovsdb-server -V