[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Added Brctl.get_state, to support upcoming PIF implementation.
# HG changeset patch # User Ewan Mellor <ewan@xxxxxxxxxxxxx> # Date 1167233972 0 # Node ID 069d1364af539b78d89cbeaa7c898c0cda3ed0af # Parent 088752354770f76b9dc96575289a8dac4e73ca09 Added Brctl.get_state, to support upcoming PIF implementation. Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx> --- tools/python/xen/util/Brctl.py | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+) diff -r 088752354770 -r 069d1364af53 tools/python/xen/util/Brctl.py --- a/tools/python/xen/util/Brctl.py Wed Dec 27 15:39:04 2006 +0000 +++ b/tools/python/xen/util/Brctl.py Wed Dec 27 15:39:32 2006 +0000 @@ -27,6 +27,31 @@ def cmd(p, s): if opts.verbose: print c 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. _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |