xenserver: modify module spec file
[sliver-openvswitch.git] / xenserver / etc_xapi.d_plugins_openvswitch-cfg-update
index e2dc939..f001d2f 100755 (executable)
@@ -55,15 +55,7 @@ def update(session, args):
     if len(pools) > 1:
         raise XenAPIPlugin.Failure("MORE_THAN_ONE_POOL_FOR_HOST", [])
     pool = session.xenapi.pool.get_record(pools[0])
-    try:
-        try:
-            controller = pool["vswitch_controller"]
-        except KeyError:
-            # On systems older than XenServer 5.6.0, we needed to store
-            # the key in "other_config".
-            controller = pool["other_config"]["vSwitchController"]
-    except KeyError, e:
-        controller = ""
+    controller = pool.get("vswitch_controller", "")
     ret_str = ""
     currentController = vswitchCurrentController()
     if controller == "" and currentController != "":
@@ -107,7 +99,8 @@ def update(session, args):
         if not xapi_dib:
             xapi_dib = ''
 
-        ovs_dib = vswitchCfgQuery(['get', 'Bridge', bridge,
+        ovs_dib = vswitchCfgQuery(['--', '--if-exists', 'get', 'Bridge',
+                                   bridge,
                                    'other_config:disable-in-band']).strip('"')
 
         # Do nothing if setting is invalid, and warn the user.