[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEND] Fix check for whether domain is running.



# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID c21f4949a746812ce83414baa729d31bb5705062
# Parent  029e04982e9439ad651f95eb97b306a52e726ff7
[XEND] Fix check for whether domain is running.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py        |    5 ++---
 tools/python/xen/xend/XendDomainInfo.py |    4 +++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff -r 029e04982e94 -r c21f4949a746 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Fri Oct 06 16:30:35 2006 +0100
+++ b/tools/python/xen/xend/XendAPI.py  Fri Oct 06 16:40:39 2006 +0100
@@ -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
@@ -968,7 +968,6 @@ class XendAPI:
                 return xen_api_error(XEND_ERROR_TODO)
         else:
             return xen_api_error(XEND_ERROR_DOMAIN_INVALID)
-
 
     # attributes (rw)
     def vbd_get_vm(self, session, vbd_ref):
@@ -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():
diff -r 029e04982e94 -r c21f4949a746 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri Oct 06 16:30:35 2006 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Oct 06 16:40:39 2006 +0100
@@ -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()

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.