mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
[XEND] Keep track of attached vbds and vifs for XenAPI
Signed-off-by: Alastair Tse <atse@xensource.com>
This commit is contained in:
1 parent
5b9963f11b
commit
41bd30a5b4
2 files changed
+11
-2
No files matched your search
@@ -833,7 +833,9 @@ class XendAPI:
|
||||
def vm_get_by_label(self, session, label):
|
||||
xendom = XendDomain.instance()
|
||||
dom = xendom.domain_lookup_nr(label)
|
||||
return xen_api_success(dom.get_uuid())
|
||||
if dom:
|
||||
return xen_api_success(dom.get_uuid())
|
||||
return xen_api_error(XEND_ERROR_VM_INVALID)
|
||||
def vm_create(self, session, vm_struct):
|
||||
xendom = XendDomain.instance()
|
||||
domuuid = xendom.create_domain(vm_struct)
|
||||
|
||||
@@ -726,7 +726,10 @@ class XendConfig(dict):
|
||||
raise XendConfigError("XendConfig: device_add requires some "
|
||||
"config.")
|
||||
|
||||
log.debug("XendConfig.device_add: %s" % str(cfg_sxp))
|
||||
if cfg_sxp:
|
||||
log.debug("XendConfig.device_add: %s" % str(cfg_sxp))
|
||||
if cfg_xenapi:
|
||||
log.debug("XendConfig.device_add: %s" % str(cfg_xenapi))
|
||||
|
||||
if cfg_sxp:
|
||||
config = sxp.child0(cfg_sxp)
|
||||
@@ -743,6 +746,8 @@ class XendConfig(dict):
|
||||
dev_uuid = dev_info.get('uuid', uuid.createString())
|
||||
dev_info['uuid'] = dev_uuid
|
||||
self['device'][dev_uuid] = (dev_type, dev_info)
|
||||
if dev_type in ('vif', 'vbd'):
|
||||
self['%s_refs' % dev_type].append(dev_uuid)
|
||||
return dev_uuid
|
||||
|
||||
if cfg_xenapi:
|
||||
@@ -761,6 +766,7 @@ class XendConfig(dict):
|
||||
dev_uuid = cfg_xenapi.get('uuid', uuid.createString())
|
||||
dev_info['uuid'] = dev_uuid
|
||||
self['device'][dev_uuid] = (dev_type, dev_info)
|
||||
self['vif_refs'].append(dev_uuid)
|
||||
return dev_uuid
|
||||
|
||||
elif dev_type == 'vbd':
|
||||
@@ -774,6 +780,7 @@ class XendConfig(dict):
|
||||
dev_uuid = cfg_xenapi.get('uuid', uuid.createString())
|
||||
dev_info['uuid'] = dev_uuid
|
||||
self['device'][dev_uuid] = (dev_type, dev_info)
|
||||
self['vbd_refs'].append(dev_uuid)
|
||||
return dev_uuid
|
||||
|
||||
|
||||
|
||||