[ovs-dev] Ensure "service vswitch status" returns appropriate error code

Ian Campbell Ian.Campbell at citrix.com
Wed Oct 14 10:37:19 UTC 2009


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.

diff -r 987e85685736 xenserver/etc_init.d_vswitch
--- a/xenserver/etc_init.d_vswitch	Wed Oct 14 11:24:08 2009 +0100
+++ b/xenserver/etc_init.d_vswitch	Wed Oct 14 11:29:25 2009 +0100
@@ -319,9 +319,12 @@
         ;;
     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






More information about the dev mailing list