WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Added Brctl.get_state, to support upcomin

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Added Brctl.get_state, to support upcoming PIF implementation.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 29 Dec 2006 14:20:08 -0800
Delivery-date: Fri, 29 Dec 2006 14:20:42 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Added Brctl.get_state, to support upcoming PIF implementation., Xen patchbot-unstable <=