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>
Wed, 14 Oct 2009 19:49:27 +0000 (12:49 -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.

xenserver/etc_init.d_vswitch

index e56c022..74162dc 100755 (executable)
@@ -319,9 +319,12 @@ case "$1" in
         ;;
     status)
         status -p ovs-vswitchd.pid ovs-vswitchd
-        if [ "$ENABLE_BRCOMPAT" = "y" ] ; then
+        rc=$?
+        if [ $rc -eq 0 ] && [ "$ENABLE_BRCOMPAT" = "y" ] ; then
             status -p ovs-brcompatd.pid ovs-brcompatd
+            rc=$?
         fi
+        exit $rc
         ;;
     version)
         /usr/sbin/ovs-vswitchd -V