summaryrefslogtreecommitdiff
path: root/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
diff options
context:
space:
mode:
authorAndrew Evans <aevans@nicira.com>2011-02-28 18:26:04 -0800
committerAndrew Evans <aevans@nicira.com>2011-02-28 18:26:48 -0800
commitda54975c9d79313ba27d80ee8901eee160653e3a (patch)
tree38f80c24fead98b1adb6a2838d51969c5c8750c0 /xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
parent16472256190e083258bfcf6a4ba4f74cb412fcd4 (diff)
downloadopenvswitch-da54975c9d79313ba27d80ee8901eee160653e3a.tar.gz
xenserver: Add support for disabling in-band management via XAPI.
Allow users or applications to enable or disable in-band management of individual bridges by setting the 'vswitch-disable-in-band' key in the 'other_config' attribute of the corresponding network to 'true' or 'false'. Bug #4749.
Diffstat (limited to 'xenserver/etc_xapi.d_plugins_openvswitch-cfg-update')
-rwxr-xr-xxenserver/etc_xapi.d_plugins_openvswitch-cfg-update31
1 files changed, 31 insertions, 0 deletions
diff --git a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
index 721fe6476..e2dc939f0 100755
--- a/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
+++ b/xenserver/etc_xapi.d_plugins_openvswitch-cfg-update
@@ -97,9 +97,38 @@ def update(session, args):
except KeyError:
pass
+ dib_changed = False
fail_mode_changed = False
for bridge in vswitchCfgQuery(['list-br']).split():
+ network = bton[bridge]
bridge = vswitchCfgQuery(['br-to-parent', bridge])
+
+ xapi_dib = network['other_config'].get('vswitch-disable-in-band')
+ if not xapi_dib:
+ xapi_dib = ''
+
+ ovs_dib = vswitchCfgQuery(['get', 'Bridge', bridge,
+ 'other_config:disable-in-band']).strip('"')
+
+ # Do nothing if setting is invalid, and warn the user.
+ if xapi_dib not in ['true', 'false', '']:
+ ret_str += '"' + xapi_dib + '"' + \
+ ' is an invalid value for vswitch-disable-in-band on ' + \
+ bridge + ' '
+
+ # Change bridge disable-in-band option if XAPI and OVS states differ.
+ elif xapi_dib != ovs_dib:
+ # 'true' or 'false'
+ if xapi_dib:
+ vswitchCfgMod(['--', 'set', 'Bridge', bridge,
+ 'other_config:disable-in-band=' + xapi_dib])
+ # '' or None
+ else:
+ vswitchCfgMod(['--', 'remove', 'Bridge', bridge,
+ 'other_config', 'disable-in-band'])
+ dib_changed = True
+
+ # Change bridge fail_mode if XAPI state differs from OVS state.
bridge_fail_mode = vswitchCfgQuery(["get", "Bridge",
bridge, "fail_mode"]).strip('[]"')
@@ -119,6 +148,8 @@ def update(session, args):
"fail_mode=%s" % fail_mode])
fail_mode_changed = True
+ if dib_changed:
+ ret_str += "Updated in-band management. "
if fail_mode_changed:
ret_str += "Updated fail_mode. "