ia64/xen-unstable

changeset 12113:c21f4949a746

[XEND] Fix check for whether domain is running.

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Fri Oct 06 16:40:39 2006 +0100 (2006-10-06)
parents 029e04982e94
children f5912c42fbc3
files tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Fri Oct 06 16:30:35 2006 +0100
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Fri Oct 06 16:40:39 2006 +0100
     1.3 @@ -953,7 +953,7 @@ class XendAPI:
     1.4              return xen_api_error(XEND_ERROR_VIF_INVALID)
     1.5          cfg = vm.get_dev_xenapi_config('vbd', vbd_ref)
     1.6          if not cfg:
     1.7 -            return xen_api_error(XEND_ERROR_UNKNOWN)
     1.8 +            return xen_api_error(XEND_ERROR_VIF_INVALID)
     1.9          return xen_api_success(cfg)
    1.10      
    1.11      # class methods
    1.12 @@ -969,7 +969,6 @@ class XendAPI:
    1.13          else:
    1.14              return xen_api_error(XEND_ERROR_DOMAIN_INVALID)
    1.15  
    1.16 -
    1.17      # attributes (rw)
    1.18      def vbd_get_vm(self, session, vbd_ref):
    1.19          xendom = XendDomain.instance()
    1.20 @@ -1014,7 +1013,7 @@ class XendAPI:
    1.21              return xen_api_error(XEND_ERROR_VIF_INVALID)
    1.22          cfg = vm.get_dev_xenapi_config('vif', vif_ref)
    1.23          if not cfg:
    1.24 -            return xen_api_error(XEND_ERROR_UNKNOWN)
    1.25 +            return xen_api_error(XEND_ERROR_VIF_INVALID)
    1.26          valid_vif_keys = self.VIF_attr_ro + self.VIF_attr_rw + \
    1.27                           self.Base_attr_ro + self.Base_attr_rw
    1.28          for k in cfg.keys():
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Oct 06 16:30:35 2006 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Oct 06 16:40:39 2006 +0100
     2.3 @@ -1713,7 +1713,7 @@ class XendDomainInfo:
     2.4      def get_dev_config_by_uuid(self, dev_class, dev_uuid):
     2.5          """ Get's a device configuration either from XendConfig or
     2.6          from the DevController."""
     2.7 -        if self.get_power_state() not in ('Halted',):
     2.8 +        if self.get_power_state() in (XEN_API_VM_POWER_STATE_HALTED,):
     2.9              dev = self.info['device'].get(dev_uuid)
    2.10              if dev:
    2.11                  return dev[1].copy()
    2.12 @@ -1722,9 +1722,11 @@ class XendDomainInfo:
    2.13              controller = self.getDeviceController(dev_class)
    2.14              if not controller:
    2.15                  return None
    2.16 +            
    2.17              all_configs = controller.getAllDeviceConfigurations()
    2.18              if not all_configs:
    2.19                  return None
    2.20 +
    2.21              for _devid, _devcfg in all_configs.items():
    2.22                  if _devcfg.get('uuid') == dev_uuid:
    2.23                      devcfg = _devcfg.copy()