MCPcopy Create free account
hub / github.com/apache/cloudstack / get_vifs_for_bridge

Function get_vifs_for_bridge

scripts/vm/network/security_group.py:1226–1240  ·  view source on GitHub ↗
(vm_name, brname)

Source from the content-addressed store, hash-verified

1224
1225
1226def get_vifs_for_bridge(vm_name, brname):
1227 vifs = []
1228 xmlfile = virshdumpxml(vm_name)
1229 if not xmlfile:
1230 return vifs
1231
1232 dom = xml.dom.minidom.parseString(xmlfile)
1233 for network in dom.getElementsByTagName("interface"):
1234 source = network.getElementsByTagName('source')[0]
1235 bridge = source.getAttribute("bridge").strip()
1236 if bridge == brname:
1237 target = network.getElementsByTagName('target')[0]
1238 nicdev = target.getAttribute("dev").strip()
1239 vifs.append(nicdev)
1240 return list(set(vifs))
1241
1242
1243def get_bridges(vm_name):

Callers 1

Calls 3

virshdumpxmlFunction · 0.85
getAttributeMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected