X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=xenserver%2Fetc_init.d_openvswitch;h=2cfaacdb0707a6a4c2d7d5d59d0ba10904bb16f0;hb=refs%2Fheads%2Flts-1.0a;hp=36d0afddd98405a5cdfb8cbc0dec1b3e8b93dadb;hpb=5535f0bdf71050fdec276628f7dfc8a860dc99da;p=sliver-openvswitch.git diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch index 36d0afddd..2cfaacdb0 100755 --- a/xenserver/etc_init.d_openvswitch +++ b/xenserver/etc_init.d_openvswitch @@ -254,6 +254,13 @@ function stop_daemon { if test -f "$pidfile"; then local pid=$(cat "$pidfile") action "Killing `basename $BINARY` ($pid)" kill $pid + for delay in .1 .25 .65 1 1 1 1; do + if kill -0 $pid >/dev/null 2>&1; then + sleep $delay + else + break + fi + done rm -f "$pidfile" fi } @@ -283,12 +290,16 @@ EOF esac } -function set_system_uuid { - if test -n "$INSTALLATION_UUID"; then - action "Configuring Open vSwitch system UUID" true - $vsctl --no-wait set Open_vSwitch . external-ids:system-uuid="$INSTALLATION_UUID" +function set_system_ids { + if [ -f /etc/xensource-inventory ]; then + action "Configuring Open vSwitch system IDs" true + $vsctl --no-wait --timeout=5 set Open_vSwitch . \ + external-ids:system-type="$PRODUCT_BRAND" \ + external-ids:system-version="$PRODUCT_VERSION-$BUILD_NUMBER" \ + external-ids:system-id="$INSTALLATION_UUID" \ + external-ids:xs-system-uuid="$INSTALLATION_UUID" else - action "Configuring Open vSwitch system UUID" false + action "Configuring Open vSwitch system IDs" false fi } @@ -318,20 +329,26 @@ function start { fi start_ovsdb_server - $vsctl --no-wait init + $vsctl --no-wait --timeout=5 init if [ ! -e /var/run/openvswitch.booted ]; then touch /var/run/openvswitch.booted for bridge in $($vsctl list-br); do - $vsctl --no-wait del-br $bridge + $vsctl --no-wait --timeout=5 del-br $bridge done fi - set_system_uuid + set_system_ids start_vswitchd if [ "${ENABLE_BRCOMPAT}" = "y" ] ; then start_brcompatd fi + + # Start daemon to monitor external ids + PYTHONPATH=/usr/share/openvswitch/python \ + /usr/share/openvswitch/scripts/ovs-external-ids \ + --pidfile --detach $monitor_opt "$VSWITCHD_OVSDB_SERVER" + touch /var/lock/subsys/openvswitch } @@ -339,6 +356,9 @@ function stop { stop_daemon BRCOMPATD "$brcompatd" stop_daemon VSWITCHD "$vswitchd" stop_daemon OVSDB_SERVER "$ovsdb_server" + if [ -e /var/run/openvswitch/ovs-external-ids.pid ]; then + kill `cat /var/run/openvswitch/ovs-external-ids.pid` + fi rm -f /var/lock/subsys/openvswitch } @@ -359,6 +379,10 @@ case "$1" in restart) restart ;; + reload|force-reload) + # Nothing to do--ovs-vswitchd and ovsdb-server keep their configuration + # up-to-date all the time. + ;; strace-vswitchd) shift strace -p $(cat "$VSWITCHD_PIDFILE") "$@" @@ -379,7 +403,7 @@ case "$1" in /usr/sbin/ovs-brcompatd -V ;; help) - printf "openvswitch [start|stop|restart|unload|status|version]\n" + printf "openvswitch [start|stop|restart|reload|force-reload|status|version]\n" ;; *) printf "Unknown command: $1\n"