xenserver: Change all bridge's fail_mode when updating.
authorEthan Jackson <ethan@nicira.com>
Mon, 24 Jan 2011 18:54:17 +0000 (10:54 -0800)
committerEthan Jackson <ethan@nicira.com>
Mon, 24 Jan 2011 19:25:53 +0000 (11:25 -0800)
The ovs plugin's update command was only setting fail_mode for
bridges attached to pifs.  This patch applies the fail_mode
setting to all bridges on the XenServer system.

Reported-by: David Tsai <dtsai@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
xenserver/etc_xapi.d_plugins_openvswitch-cfg-update

index a4d97f58e0161fba4a8a59a83e1afe41f7852359..b5921f1942e3afc26d6e2aff33867056e347fe72 100755 (executable)
@@ -92,15 +92,8 @@ def update(session, args):
         fail_mode = 'standalone'
 
     fail_mode_changed = False
-    for (p, rec) in session.xenapi.PIF.get_all_records().items():
-        try:
-            network = session.xenapi.network.get_record(rec['network'])
-            bridge = network['bridge']
-        except Exception, e:
-            syslog.syslog("%s: failed to get bridge name (%s)" %
-                    (script, str(e)))
-            continue
-
+    for bridge in vswitchCfgQuery(['list-br']).split():
+        bridge = vswitchCfgQuery(['br-to-parent', bridge])
         bridge_fail_mode = vswitchCfgQuery(["get", "Bridge",
             bridge, "fail_mode"]).strip('[]"')