<bridge>
xenbr0
</bridge>
- <other_config/>
+ <other_config>
+ <vswitch-disable-in-band>
+ true
+ </vswitch-disable-in-band>
+ </other_config>
<uuid>
c9eecb03-560d-61de-b6a8-56dfc766f67e
</uuid>
--may-exist add-port xenbr2 eth2
set Bridge xenbr2 other-config:hwaddr="00:15:17:a0:29:80"
set Bridge xenbr2 fail_mode=standalone
+ remove Bridge xenbr2 other_config disable-in-band
br-set-external-id xenbr2 xs-network-uuids d08c8749-0c8f-9e8d-ce25-fd364661ee99
/sbin/ifup xenbr2
/sbin/update-issue
--may-exist add-port xenbr3 eth3
set Bridge xenbr3 other-config:hwaddr="00:15:17:a0:29:81"
set Bridge xenbr3 fail_mode=standalone
+ remove Bridge xenbr3 other_config disable-in-band
br-set-external-id xenbr3 xs-network-uuids 2902ae1b-8013-897a-b697-0b200ea3aaa5;db7bdc03-074d-42ae-fc73-9b06de1d57f6
--may-exist add-br xapi3 xenbr3 123
br-set-external-id xapi3 xs-network-uuids 2902ae1b-8013-897a-b697-0b200ea3aaa5;db7bdc03-074d-42ae-fc73-9b06de1d57f6
set Port bond0 MAC="00:22:19:22:4b:af" other-config:bond-miimon-interval=100 bond_downdelay=200 bond_updelay=31000 other-config:bond-detect-mode=carrier lacp=off bond_mode=balance-slb
set Bridge xapi1 other-config:hwaddr="00:22:19:22:4b:af"
set Bridge xapi1 fail_mode=standalone
+ remove Bridge xapi1 other_config disable-in-band
br-set-external-id xapi1 xs-network-uuids 45cbbb43-113d-a712-3231-c6463f253cef;99be2da4-6c33-6f8e-49ea-3bc592fe3c85
/sbin/ifup xapi1
action_up: bring up bond0
set Port bond0 MAC="00:22:19:22:4b:af" other-config:bond-miimon-interval=100 bond_downdelay=200 bond_updelay=31000 other-config:bond-detect-mode=carrier lacp=off bond_mode=balance-slb
set Bridge xapi1 other-config:hwaddr="00:22:19:22:4b:af"
set Bridge xapi1 fail_mode=standalone
+ remove Bridge xapi1 other_config disable-in-band
br-set-external-id xapi1 xs-network-uuids 45cbbb43-113d-a712-3231-c6463f253cef;99be2da4-6c33-6f8e-49ea-3bc592fe3c85
--may-exist add-br xapi2 xapi1 4
br-set-external-id xapi2 xs-network-uuids 45cbbb43-113d-a712-3231-c6463f253cef;99be2da4-6c33-6f8e-49ea-3bc592fe3c85
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('[]"')
"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. "
lambda n: _strlist_from_xml(n, 'slaves', 'slave')),
}
-_NETWORK_OTHERCONFIG_ATTRS = [ 'mtu', 'static-routes', 'vswitch-controller-fail-mode' ] + _ETHTOOL_OTHERCONFIG_ATTRS
+_NETWORK_OTHERCONFIG_ATTRS = [ 'mtu',
+ 'static-routes',
+ 'vswitch-controller-fail-mode',
+ 'vswitch-disable-in-band' ] \
+ + _ETHTOOL_OTHERCONFIG_ATTRS
_NETWORK_ATTRS = { 'uuid': (_str_to_xml,_str_from_xml),
'bridge': (_str_to_xml,_str_from_xml),
pool = db().get_pool_record()
network = db().get_network_by_bridge(bridge)
+ network_rec = None
fail_mode = None
valid_fail_modes = ['standalone', 'secure']
vsctl_argv += ['--', 'set', 'Bridge', bridge, 'fail_mode=%s' % fail_mode]
+ if network_rec:
+ dib = network_rec['other_config'].get('vswitch-disable-in-band')
+ if not dib:
+ vsctl_argv += ['--', 'remove', 'Bridge', bridge, 'other_config', 'disable-in-band']
+ elif dib in ['true', 'false']:
+ vsctl_argv += ['--', 'set', 'Bridge', bridge, 'other_config:disable-in-band=' + dib]
+ else:
+ log('"' + dib + '"' "isn't a valid setting for other_config:disable-in-band on " + bridge)
+
vsctl_argv += set_br_external_ids(pif)
vsctl_argv += ['## done configuring datapath %s' % bridge]
call_vsctl(["set", "bridge", name, "fail_mode=" + fail_mode])
+def update_in_band_mgmt(name):
+ rec = get_network_by_bridge(name)
+
+ if not rec:
+ return
+
+ dib = rec['other_config'].get('vswitch-disable-in-band')
+ if not dib:
+ call_vsctl(['remove', 'bridge', name, 'other_config',
+ 'disable-in-band'])
+ elif dib in ['true', 'false']:
+ call_vsctl(['set', 'bridge', name,
+ 'other_config:disable-in-band=' + dib])
+ else:
+ s_log.warning('"' + dib + '"'
+ "isn't a valid setting for other_config:disable-in-band on " +
+ bridge)
+
def update_bridge_id(name, ids):
id = get_bridge_id(name, ids.get("xs-network-uuids"))
for name,ids in new_bridges.items():
if name not in bridges:
update_fail_mode(name)
+ update_in_band_mgmt(name)
if (name not in bridges) or (bridges[name] != ids):
update_bridge_id(name, ids)