[ovs-dev] [PATCH] xenserver: Allow NULL pool in configuration cache.
Ben Pfaff
blp at nicira.com
Wed Jan 19 23:28:41 UTC 2011
On Wed, Jan 19, 2011 at 03:10:09PM -0800, Ethan Jackson wrote:
> InterfaceReconfigure assumes the pool is in the configuration
> cache. This is always true except when upgrading from an older
> version of openvswitch which does record the pool. This can cause
> upgrades to lock up.
>
> Signed-off-by: Ethan Jackson <ethan at nicira.com>
Hmm, I can't see any actual problems with this, but I'd be tempted to do
it another way, by instead of making interface-reconfigure more
accepting of different formats, make the package upgrade rewrite the
database cache if it isn't valid.
I'm appending a stab at this. I haven't tested it at all.
What do you think?
diff --git a/xenserver/openvswitch-xen.spec b/xenserver/openvswitch-xen.spec
index deb1fd3..f0b85fc 100644
--- a/xenserver/openvswitch-xen.spec
+++ b/xenserver/openvswitch-xen.spec
@@ -1,6 +1,6 @@
# Spec file for Open vSwitch.
-# Copyright (C) 2009, 2010 Nicira Networks, Inc.
+# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc.
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
@@ -181,16 +181,7 @@ if test "$PRODUCT_VERSION" = "5.5.0"; then
fi
fi
-
-if test ! -e /var/xapi/network.dbcache; then
- if test "$1" = 1; then
- printf "Creating xapi database cache... "
- else
- printf "warning: Open vSwitch is being re-installed or upgraded,\n"
- printf " but the xapi database cache is missing.\n"
- printf "Re-creating xapi database cache... "
- fi
-
+refresh_dbcache () {
if /usr/share/openvswitch/scripts/interface-reconfigure rewrite; then
printf "done.\n"
else
@@ -200,6 +191,23 @@ if test ! -e /var/xapi/network.dbcache; then
printf "fix connectivity to the pool master, then try again.\n"
exit 1
fi
+}
+
+DBCACHE=/var/xapi/network.dbcache
+if test ! -e "$DBCACHE"; then
+ if test "$1" = 1; then
+ printf "Creating xapi database cache... "
+ else
+ printf "warning: Open vSwitch is being re-installed or upgraded,\n"
+ printf " but the xapi database cache is missing.\n"
+ printf "Re-creating xapi database cache... "
+ fi
+ refresh_dbcache
+elif /usr/share/openvswitch/scripts/interface-reconfigure validate-cache; then
+ :
+else
+ printf "Updating xapi database cache... "
+ refresh_dbcache
fi
# Ensure that modprobe will find our modules.
diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure b/xenserver/opt_xensource_libexec_interface-reconfigure
index f1c1336..df48172 100755
--- a/xenserver/opt_xensource_libexec_interface-reconfigure
+++ b/xenserver/opt_xensource_libexec_interface-reconfigure
@@ -17,6 +17,7 @@
%(command-name)s <PIF> up
%(command-name)s <PIF> down
%(command-name)s rewrite
+ %(command-name)s validate-cache
%(command-name)s --force <BRIDGE> up
%(command-name)s --force <BRIDGE> down
%(command-name)s --force <BRIDGE> rewrite --device=<INTERFACE> --mac=<MAC-ADDRESS> <CONFIG>
@@ -630,12 +631,16 @@ def main(argv=None):
action = args[0]
- if not action in ["up", "down", "rewrite", "rewrite-configuration"]:
- raise Usage("Unknown action \"%s\"" % action)
-
# backwards compatibility
if action == "rewrite-configuration": action = "rewrite"
+ if not action in ["up", "down", "validate-cache", "rewrite"]:
+ raise Usage("Unknown action \"%s\"" % action)
+
+ if action == "validate-cache":
+ db_init_from_cache(dbcache_file)
+ return 0
+
if ( session or pif ) and pif_uuid:
raise Usage("--session/--pif and --pif-uuid are mutually exclusive.")
if ( session and not pif ) or ( not session and pif ):
More information about the dev
mailing list