X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=xenserver%2Fetc_init.d_openvswitch;h=9d7ad2d80ed96c894ced4ef28c5688a1cf4d4e5f;hb=ddffedda18b6f919cb896265e126574d75fcaf00;hp=5f18196cf8342008eced5b8d002fc308704a07bd;hpb=998bb652ecb494af8aa38ed0ae4e653cd8dff709;p=openvswitch diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch index 5f18196c..9d7ad2d8 100755 --- a/xenserver/etc_init.d_openvswitch +++ b/xenserver/etc_init.d_openvswitch @@ -298,10 +298,12 @@ EOF function set_system_ids { if [ -f /etc/xensource-inventory ]; then + OVS_VERSION=`ovs-vswitchd --version | sed 's/.*) //;1q'` 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" \ + ovs-version="$OVS_VERSION" \ + system-type="$PRODUCT_BRAND" \ + system-version="$PRODUCT_VERSION-$BUILD_NUMBER" \ external-ids:system-id="$INSTALLATION_UUID" \ external-ids:xs-system-uuid="$INSTALLATION_UUID" else @@ -323,6 +325,7 @@ function start { # Allow GRE traffic. iptables -I INPUT -p gre -j ACCEPT + schemaver=`$ovsdb_tool schema-version "$VSWITCHD_OVSDB_SCHEMA"` if [ ! -e "$OVSDB_SERVER_DB" ]; then warning "$OVSDB_SERVER_DB does not exist" install -d -m 755 -o root -g root `dirname $OVSDB_SERVER_DB` @@ -330,12 +333,20 @@ 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. $ovsdb_tool -vANY:console:emer convert "$OVSDB_SERVER_DB" "$VSWITCHD_OVSDB_SCHEMA" fi start_ovsdb_server - $vsctl --no-wait --timeout=5 init + $vsctl --no-wait --timeout=5 init -- set Open_vSwitch . db-version="$schemaver" if [ ! -e /var/run/openvswitch.booted ]; then touch /var/run/openvswitch.booted for bridge in $($vsctl list-br); do