ia64/xen-unstable

changeset 14932:2b994e23f96b

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@gmail.com>
author Tom Wilkie <tom.wilkie@gmail.com>
date Wed Apr 25 13:55:18 2007 +0100 (2007-04-25)
parents 0b4375cd7e16
children ca5bfcd32e13
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Apr 25 13:44:37 2007 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed Apr 25 13:55:18 2007 +0100
     1.3 @@ -2246,9 +2246,18 @@ class XendDomainInfo:
     1.4  
     1.5              if not config.has_key('network'):
     1.6                  try:
     1.7 +                    bridge = config.get('bridge', None)
     1.8 +                    if bridge is None:
     1.9 +                        from xen.util import Brctl
    1.10 +                        if_to_br = dict([(i,b)
    1.11 +                            for (b,ifs) in Brctl.get_state().items()
    1.12 +                                for i in ifs])
    1.13 +                        vifname = "vif%s.%s" % (self.getDomid(),
    1.14 +                                                config.get('id'))
    1.15 +                        bridge = if_to_br.get(vifname, None)
    1.16                      config['network'] = \
    1.17                          XendNode.instance().bridge_to_network(
    1.18 -                        config.get('bridge')).uuid
    1.19 +                        config.get('bridge')).get_uuid()
    1.20                  except Exception:
    1.21                      log.exception('bridge_to_network')
    1.22                      # Ignore this for now -- it may happen if the device