[ovs-dev] [PATCH] xenserver: Fix interface reconfigure crash when setting fail_mode.

Ethan Jackson ethan at nicira.com
Thu Jan 20 01:59:23 UTC 2011


Interface reconfigure can crash when setting fail_mode if an
expected other_config setting is not set.
---
 ...ensource_libexec_InterfaceReconfigureVswitch.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
index a3d4bd2..a9bdf9b 100644
--- a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
+++ b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
@@ -333,10 +333,13 @@ def configure_datapath(pif):
 
     pool = db().get_pool_record()
 
+    fail_mode = 'standalone'
+
     if pool:
-        fail_mode = pool['other_config']['vswitch-controller-fail-mode']
-    else:
-        fail_mode = 'standalone'
+        try:
+            fail_mode = pool['other_config']['vswitch-controller-fail-mode']
+        except KeyError:
+            pass
 
     if fail_mode in ['standalone', 'secure']:
         vsctl_argv += ['--', 'set', 'Bridge', bridge, 'fail_mode=%s' % fail_mode]
-- 
1.7.2





More information about the dev mailing list