[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] If bridge name hasn't been recorded in XendConfig then try and work it out using Brctl.



# HG changeset patch
# User Tom Wilkie <tom.wilkie@xxxxxxxxx>
# Date 1177505718 -3600
# Node ID 2b994e23f96b58831e28f29857bf6a4fd1459a9e
# Parent  0b4375cd7e16c3a73d92300e1f9783e5cede0046
If bridge name hasn't been recorded in XendConfig then try and work it out 
using Brctl.

This is needed when a VIF is created without specifying a bridge.

signed-off-by: Tom Wilkie <tom.wilkie@xxxxxxxxx>
---
 tools/python/xen/xend/XendDomainInfo.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletion(-)

diff -r 0b4375cd7e16 -r 2b994e23f96b tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Apr 25 13:44:37 2007 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Wed Apr 25 13:55:18 2007 +0100
@@ -2246,9 +2246,18 @@ class XendDomainInfo:
 
             if not config.has_key('network'):
                 try:
+                    bridge = config.get('bridge', None)
+                    if bridge is None:
+                        from xen.util import Brctl
+                        if_to_br = dict([(i,b)
+                            for (b,ifs) in Brctl.get_state().items()
+                                for i in ifs])
+                        vifname = "vif%s.%s" % (self.getDomid(),
+                                                config.get('id'))
+                        bridge = if_to_br.get(vifname, None)
                     config['network'] = \
                         XendNode.instance().bridge_to_network(
-                        config.get('bridge')).uuid
+                        config.get('bridge')).get_uuid()
                 except Exception:
                     log.exception('bridge_to_network')
                     # Ignore this for now -- it may happen if the device

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.