WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH][XEND] resume broken
From: Chris <hap10@xxxxxxxxxxxxxx>
Date: Wed, 06 Dec 2006 13:21:32 -0500
Cc: Ewan Mellor <ewan@xxxxxxxxxxxxx>
Delivery-date: Wed, 06 Dec 2006 10:22:06 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.8 (Macintosh/20061025)
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
<Prev in Thread] Current Thread [Next in Thread>