xenserver: Allow NULL pool in configuration cache.
authorEthan Jackson <ethan@nicira.com>
Wed, 19 Jan 2011 22:46:57 +0000 (14:46 -0800)
committerEthan Jackson <ethan@nicira.com>
Thu, 20 Jan 2011 01:08:59 +0000 (17:08 -0800)
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@nicira.com>
xenserver/opt_xensource_libexec_InterfaceReconfigure.py
xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py

index 6cf19ee5b4dd209cb35e7759d41b7ac6599a7b2b..3030e0f4b99370bbdb5a63ea5b9e4c2a638f5d61 100644 (file)
@@ -659,7 +659,8 @@ class DatabaseCache(object):
             return None
 
     def get_pool_record(self):
-        return self.__pools.values()[0]
+        if len(self.__pools) > 0:
+            return self.__pools.values()[0]
 
 #
 #
index 8429358729479953e2778b07c3e984e76daad823..a3d4bd24d54f48946875347324ad76eb273c3c24 100644 (file)
@@ -332,7 +332,11 @@ def configure_datapath(pif):
                    'other-config:hwaddr=%s' % vsctl_escape(db().get_pif_record(pif)['MAC'])]
 
     pool = db().get_pool_record()
-    fail_mode = pool['other_config']['vswitch-controller-fail-mode']
+
+    if pool:
+        fail_mode = pool['other_config']['vswitch-controller-fail-mode']
+    else:
+        fail_mode = 'standalone'
 
     if fail_mode in ['standalone', 'secure']:
         vsctl_argv += ['--', 'set', 'Bridge', bridge, 'fail_mode=%s' % fail_mode]