From: Chris Subject: [PATCH][XEND] resume broken Date: Wed, 06 Dec 2006 13:21:32 -0500 Message-ID: <45770A2C.1030600@tycho.ncsc.mil> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010207060003000603060005" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Ewan Mellor List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------010207060003000603060005 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Attempting 'xm resume ' 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 --------------010207060003000603060005 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="resume.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="resume.patch" 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'] --------------010207060003000603060005 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------010207060003000603060005--