# "nicira-iface-id" key in the "other_config" field of the VIF
# record of XAPI.
def get_iface_id(if_name, xs_vif_uuid):
- if not if_name.startswith("vif"):
+ if not if_name.startswith("vif") and not if_name.startswith("tap"):
# Treat whatever was passed into 'xs_vif_uuid' as a default
# value for non-VIFs.
return xs_vif_uuid
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 " +
+ name)
+
def update_bridge_id(name, ids):
id = get_bridge_id(name, ids.get("xs-network-uuids"))
if ids.get("bridge-id") != primary_id:
set_external_id("Bridge", name, "bridge-id", primary_id)
+ ids["bridge-id"] = primary_id
def update_iface_id(name, ids):
id = get_iface_id(name, ids.get("xs-vif-uuid"))
if ids.get("iface-id") != id and id:
set_external_id("Interface", name, "iface-id", id)
+ ids["iface-id"] = id
def keep_table_columns(schema, table_name, column_types):
table = schema.tables.get(table_name)
"(use --help for help)\n" % ovs.util.PROGRAM_NAME)
sys.exit(1)
- ovs.daemon.die_if_already_running()
-
remote = args[0]
idl = ovs.db.idl.Idl(remote, "Open_vSwitch", monitor_uuid_schema_cb)
for rec in idl.data["Bridge"].itervalues():
name = rec.name.as_scalar()
xs_network_uuids = rec.external_ids.get("xs-network-uuids")
- new_bridges[name] = {"xs-network-uuids": xs_network_uuids}
+ bridge_id = rec.external_ids.get("bridge-id")
+ new_bridges[name] = {"xs-network-uuids": xs_network_uuids,
+ "bridge-id": bridge_id}
new_interfaces = {}
for rec in idl.data["Interface"].itervalues():
name = rec.name.as_scalar()
xs_vif_uuid = rec.external_ids.get("xs-vif-uuid")
- new_interfaces[name] = {"xs-vif-uuid": xs_vif_uuid}
+ iface_id = rec.external_ids.get("iface-id")
+ new_interfaces[name] = {"xs-vif-uuid": xs_vif_uuid,
+ "iface-id": iface_id}
+
+ #Tap devices take their xs-vif-uuid from their corresponding vif
+ for name in new_interfaces:
+ if not name.startswith("tap"):
+ continue
+
+ vif = name.replace("tap", "vif", 1)
+
+ if vif in new_interfaces:
+ xs_vif_uuid = new_interfaces[vif]["xs-vif-uuid"]
+ new_interfaces[name]["xs-vif-uuid"] = xs_vif_uuid
if bridges != new_bridges:
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)