Skip to contentSkip to conversation

resume broken

PATCH In review Chris 2 participants 3 messages Dec 6, 2006 – Dec 7, 2006

lore
Share & tools
lore

Chris

author
#0 lore raw

PATCH 1/1 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

tools/python/xen/xend/XendConfig.py +20 -10
diff -r a467eb0c5596 tools/python/xen/xend/XendConfig.py
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 4 lines · Chris

On my most recent patch submission to XendConfig.py I neglected to add:

Hi Chris,

Thanks for reporting the problem. But it turns out there was a mistake in XendCheckpoint.py that was passing a XendConfig instance rather than something the output from xc.domain_getinfo(). That is why domid and other fields were not present. So we fixed that instead in cs 12783.

Cheers,

Alastair