[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [XEND] Keep track of attached vbds and vifs for XenAPI
# HG changeset patch # User Alastair Tse <atse@xxxxxxxxxxxxx> # Node ID dd044380b44d148681b22350fe1b0fb1f0554d07 # Parent 18506db37dc24e56237740869e5a496c82b2b272 [XEND] Keep track of attached vbds and vifs for XenAPI Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx> --- tools/python/xen/xend/XendAPI.py | 4 +++- tools/python/xen/xend/XendConfig.py | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff -r 18506db37dc2 -r dd044380b44d tools/python/xen/xend/XendAPI.py --- a/tools/python/xen/xend/XendAPI.py Fri Oct 06 12:02:29 2006 +0100 +++ b/tools/python/xen/xend/XendAPI.py Fri Oct 06 12:30:46 2006 +0100 @@ -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) diff -r 18506db37dc2 -r dd044380b44d tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Fri Oct 06 12:02:29 2006 +0100 +++ b/tools/python/xen/xend/XendConfig.py Fri Oct 06 12:30:46 2006 +0100 @@ -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 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |