mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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>
This commit is contained in:
1 parent
1f79e130d5
commit
9ad27d5eda
1 file changed
+10
-1
@@ -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
|
||||
|
||||