mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
[XEND] Fix check for whether domain is running.
Signed-off-by: Alastair Tse <atse@xensource.com>
This commit is contained in:
1 parent
fde78b356e
commit
4abcfe99ad
2 files changed
+5
-4
No files matched your search
@@ -953,7 +953,7 @@ class XendAPI:
|
||||
return xen_api_error(XEND_ERROR_VIF_INVALID)
|
||||
cfg = vm.get_dev_xenapi_config('vbd', vbd_ref)
|
||||
if not cfg:
|
||||
return xen_api_error(XEND_ERROR_UNKNOWN)
|
||||
return xen_api_error(XEND_ERROR_VIF_INVALID)
|
||||
return xen_api_success(cfg)
|
||||
|
||||
# class methods
|
||||
@@ -969,7 +969,6 @@ class XendAPI:
|
||||
else:
|
||||
return xen_api_error(XEND_ERROR_DOMAIN_INVALID)
|
||||
|
||||
|
||||
# attributes (rw)
|
||||
def vbd_get_vm(self, session, vbd_ref):
|
||||
xendom = XendDomain.instance()
|
||||
@@ -1014,7 +1013,7 @@ class XendAPI:
|
||||
return xen_api_error(XEND_ERROR_VIF_INVALID)
|
||||
cfg = vm.get_dev_xenapi_config('vif', vif_ref)
|
||||
if not cfg:
|
||||
return xen_api_error(XEND_ERROR_UNKNOWN)
|
||||
return xen_api_error(XEND_ERROR_VIF_INVALID)
|
||||
valid_vif_keys = self.VIF_attr_ro + self.VIF_attr_rw + \
|
||||
self.Base_attr_ro + self.Base_attr_rw
|
||||
for k in cfg.keys():
|
||||
|
||||
@@ -1713,7 +1713,7 @@ class XendDomainInfo:
|
||||
def get_dev_config_by_uuid(self, dev_class, dev_uuid):
|
||||
""" Get's a device configuration either from XendConfig or
|
||||
from the DevController."""
|
||||
if self.get_power_state() not in ('Halted',):
|
||||
if self.get_power_state() in (XEN_API_VM_POWER_STATE_HALTED,):
|
||||
dev = self.info['device'].get(dev_uuid)
|
||||
if dev:
|
||||
return dev[1].copy()
|
||||
@@ -1722,9 +1722,11 @@ class XendDomainInfo:
|
||||
controller = self.getDeviceController(dev_class)
|
||||
if not controller:
|
||||
return None
|
||||
|
||||
all_configs = controller.getAllDeviceConfigurations()
|
||||
if not all_configs:
|
||||
return None
|
||||
|
||||
for _devid, _devcfg in all_configs.items():
|
||||
if _devcfg.get('uuid') == dev_uuid:
|
||||
devcfg = _devcfg.copy()
|
||||
|
||||