X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=xenserver%2Fetc_init.d_openvswitch;h=73009813476d65c3c07fac29c9c40ba69093984a;hb=269340fac3602303e30d46181652a7c90bde0e5e;hp=8df0ed8d38d9e9721e18b4e275cd76c067e9bac7;hpb=34edeccfd8d4273844d12c85fe38ec47002c47cd;p=openvswitch diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch index 8df0ed8d..73009813 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} @@ -125,8 +125,8 @@ else fi function hup_monitor_external_ids { - if [ -e /var/run/openvswitch/ovs-external-ids.pid ]; then - action "Configuring Open vSwitch external IDs" kill -HUP `cat /var/run/openvswitch/ovs-external-ids.pid` + if [ -e /var/run/openvswitch/ovs-xapi-sync.pid ]; then + action "Configuring Open vSwitch external IDs" kill -HUP `cat /var/run/openvswitch/ovs-xapi-sync.pid` fi } @@ -335,16 +335,24 @@ function start { action "Creating empty database $OVSDB_SERVER_DB" true $ovsdb_tool -vANY:console:emer create "$OVSDB_SERVER_DB" "$VSWITCHD_OVSDB_SCHEMA" - else - # If schema version changed, then back up the old version. - oldver=`$ovsdb_tool db-version "$OVSDB_SERVER_DB"` - if test "X$oldver" != "X$schemaver"; then - backup=$OVSDB_SERVER_DB.backup$oldver - action "Backing up $OVSDB_SERVER_DB in $backup before converting from schema version \"$oldver\" to \"$schemaver\"" true - cp "$OVSDB_SERVER_DB" "$backup" - fi - - # Upgrade or downgrade schema and compact database. + elif test "X`$ovsdb_tool needs-conversion "$OVSDB_SERVER_DB" "$VSWITCHD_OVSDB_SCHEMA"`" != Xno; then + # Back up the old version. + version=`$ovsdb_tool db-version "$OVSDB_SERVER_DB"` + cksum=`$ovsdb_tool db-cksum "$OVSDB_SERVER_DB" | awk '{print $1}'` + cp "$OVSDB_SERVER_DB" "$OVSDB_SERVER_DB.backup$version-$cksum" + + # 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 @@ -364,7 +372,7 @@ function start { if [ -f /etc/xensource-inventory ]; then # Start daemon to monitor external ids PYTHONPATH=/usr/share/openvswitch/python \ - /usr/share/openvswitch/scripts/ovs-external-ids \ + /usr/share/openvswitch/scripts/ovs-xapi-sync \ --pidfile --detach $monitor_opt "$VSWITCHD_OVSDB_SERVER" fi @@ -374,8 +382,8 @@ function start { function stop { 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` + if [ -e /var/run/openvswitch/ovs-xapi-sync.pid ]; then + kill `cat /var/run/openvswitch/ovs-xapi-sync.pid` fi rm -f /var/lock/subsys/openvswitch } @@ -444,7 +452,7 @@ case "$1" in ;; reload|force-reload) # Nothing to do to ovs-vswitchd and ovsdb-server as they keep their - # configuration up-to-date all the time. HUP ovs-external-ids so it + # configuration up-to-date all the time. HUP ovs-xapi-sync so it # re-runs. hup_monitor_external_ids ;;