X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=xenserver%2Fetc_init.d_openvswitch;h=dfd8c39a62eda8722fca976a3d27d7f9e2fea214;hb=44f2560c67fca0d5712a3bec309e4e93e9e63a7b;hp=cbd2eee125c7c48fbbefcce447a8843fc183b184;hpb=f8186f2c8111c171a26ffded62affb1ac1837e88;p=sliver-openvswitch.git diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch index cbd2eee12..dfd8c39a6 100755 --- a/xenserver/etc_init.d_openvswitch +++ b/xenserver/etc_init.d_openvswitch @@ -79,7 +79,7 @@ esac : ${FORCE_COREFILES:=y} # Config variables specific to ovsdb-server -: ${OVSDB_SERVER_REMOTES:=punix:/var/run/openvswitch/db.sock db:Open_vSwitch,managers db:Open_vSwitch,manager_options} +: ${OVSDB_SERVER_REMOTES:=punix:/var/run/openvswitch/db.sock db:Open_vSwitch,manager_options} : ${OVSDB_SERVER_DB:=/etc/openvswitch/conf.db} : ${OVSDB_SERVER_PIDFILE:=/var/run/openvswitch/ovsdb-server.pid} : ${OVSDB_SERVER_RUN_DIR:=/var/xen/openvswitch} @@ -109,6 +109,8 @@ esac : ${VSWITCHD_VALGRIND_LOG:=} : ${VSWITCHD_VALGRIND_OPT:=} +: ${OVS_XAPI_SYNC_PIDFILE:=/var/run/openvswitch/ovs-xapi-sync.pid} + # Full paths to executables & modules ovsdb_server="/usr/sbin/ovsdb-server" ovsdb_tool="/usr/bin/ovsdb-tool" @@ -341,7 +343,18 @@ function start { cksum=`$ovsdb_tool db-cksum "$OVSDB_SERVER_DB" | awk '{print $1}'` cp "$OVSDB_SERVER_DB" "$OVSDB_SERVER_DB.backup$version-$cksum" - # Upgrade or downgrade schema and compact database. + # Compact database. This is important if the old schema did not enable + # garbage collection (i.e. if it did not have any tables with "isRoot": + # true) but the new schema does. In that situation the old database + # may contain a transaction that creates a record followed by a + # transaction that creates the first use of the record. Replaying that + # series of transactions against the new database schema (as "convert" + # does) would cause the record to be dropped by the first transaction, + # then the second transaction would cause a referential integrity + # failure (for a strong reference). + $ovsdb_tool -vANY:console:emer compact "$OVSDB_SERVER_DB" + + # Upgrade or downgrade schema. $ovsdb_tool -vANY:console:emer convert "$OVSDB_SERVER_DB" "$VSWITCHD_OVSDB_SCHEMA" fi @@ -371,9 +384,7 @@ function start { function stop { stop_daemon VSWITCHD "$vswitchd" stop_daemon OVSDB_SERVER "$ovsdb_server" - if [ -e /var/run/openvswitch/ovs-xapi-sync.pid ]; then - kill `cat /var/run/openvswitch/ovs-xapi-sync.pid` - fi + stop_daemon OVS_XAPI_SYNC ovs-xapi-sync rm -f /var/lock/subsys/openvswitch }