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

[Xen-devel] [PATCH][XEND] resume broken



Attempting 'xm resume <domname>' fails with a key error on 'domid' in
XendConfig _dominfo_to_xapi().

This exception occurs because the creation of a XendConfig instance
using the sxp from lifecycle data of the resume'd domain doesn't
populate the necessary information as early as it is expected.

I've attached a fix, although you may wish to address the sickness
instead of just the symptoms, as this patch does.

-Chris

diff -r a467eb0c5596 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Wed Dec 06 10:05:41 2006 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Wed Dec 06 13:03:03 2006 -0500
@@ -359,24 +359,34 @@ class XendConfig(dict):
         self._builder_sanity_check()
 
     def _dominfo_to_xapi(self, dominfo):
-        self['domid'] = dominfo['domid']
+        if 'domid' in dominfo:
+            self['domid'] = dominfo['domid']
         self['online_vcpus'] = dominfo['online_vcpus']
         self['max_vcpu_id'] = dominfo['max_vcpu_id']
-        self['memory_dynamic_min'] = (dominfo['mem_kb'] + 1023)/1024
-        self['memory_dynamic_max'] = (dominfo['maxmem_kb'] + 1023)/1024
+        if 'mem_kb' in dominfo:
+            self['memory_dynamic_min'] = (dominfo['mem_kb'] + 1023)/1024
+        if 'maxmem_kb' in dominfo:
+            self['memory_dynamic_max'] = (dominfo['maxmem_kb'] + 1023)/1024
         self['cpu_time'] = dominfo['cpu_time']/1e9
         # TODO: i don't know what the security stuff expects here
         if dominfo.get('ssidref'):
             self['security'] = [['ssidref', dominfo['ssidref']]]
-        self['shutdown_reason'] = dominfo['shutdown_reason']
+        if 'shutdown_reason' in dominfo:
+            self['shutdown_reason'] = dominfo['shutdown_reason']
 
         # parse state into Xen API states
-        self['running'] = dominfo['running']
-        self['crashed'] = dominfo['crashed']
-        self['dying'] = dominfo['dying']
-        self['shutdown'] = dominfo['shutdown']
-        self['paused'] = dominfo['paused']
-        self['blocked'] = dominfo['blocked']
+        if 'running' in dominfo:
+            self['running'] = dominfo['running']
+        if 'crashed' in dominfo:
+            self['crashed'] = dominfo['crashed']
+        if 'dying' in dominfo:
+            self['dying'] = dominfo['dying']
+        if 'shutdown' in dominfo:
+            self['shutdown'] = dominfo['shutdown']
+        if 'paused' in dominfo:
+            self['paused'] = dominfo['paused']
+        if 'blocked' in dominfo:
+            self['blocked'] = dominfo['blocked']
 
         if 'name' in dominfo:
             self['name_label'] = dominfo['name']

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

 


Rackspace

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