Added Brctl.get_state, to support upcoming PIF implementation.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
Ewan Mellor committed 2006-12-27 15:39:32 +00:00
1 parent 85a87721a7
commit b16ecf8d4e
1 file changed
+25
+25
View File
@@ -28,6 +28,31 @@ def cmd(p, s):
if not opts.dryrun:
os.system(c)
bridgeRE = re.compile(r'([^\t]*)\t*[^\t]*\t*[^\t]*\t*([^\t]*)')
def get_state():
fin = os.popen(CMD_BRCTL + ' show', 'r')
try:
bridges = {}
brlist = None
brname = None
first = True
for line in fin:
if first:
first = False
elif line[0] == '\t':
brlist.append(line.strip())
else:
if brname:
bridges[brname] = brlist
m = bridgeRE.match(line)
brname = m.group(1)
brlist = [m.group(2).strip()]
if brname:
bridges[brname] = brlist
return bridges
finally:
fin.close()
def vif_bridge_add(params):
"""Add the network interface for vif on dom to a bridge.
"""
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.