Hi, I think I came across a tiny bug (please confirm) in to_sxp method of XendConfig class (tools/python/xen/xend/XendConfig.py): def to_sxp(self, domain = None, ignore_devices = False, ignore = [], legacy_only = True): the domain is optional, but the code tries to access its methods in several places. I was just wondering whether there''s a strong assumption that domain should be specified, or the extra checks really are necessary. Here''s a patch. Thanks, Alex. --- a/tools/python/xen/xend/XendConfig.py Mon May 11 13:52:04 2009 +0100 +++ b/tools/python/xen/xend/XendConfig.py Wed May 13 17:23:17 2009 -0400 @@ -1035,7 +1035,7 @@ class XendConfig(dict): # TODO: domid/dom is the same thing but called differently # depending if it is from xenstore or sxpr. - if domain.getDomid() is not None: + if domain and domain.getDomid() != None: sxpr.append([''domid'', domain.getDomid()]) if not legacy_only: @@ -1072,12 +1072,13 @@ class XendConfig(dict): sxpr.append([''security_label'', self[''security_label'']]) sxpr.append([''image'', self.image_sxpr()]) - sxpr.append([''status'', domain._stateGet()]) - - if domain.getDomid() is not None: - sxpr.append([''state'', self._get_old_state_string()]) if domain: + sxpr.append([''status'', domain._stateGet()]) + + if domain.getDomid() is not None: + sxpr.append([''state'', self._get_old_state_string()]) + if domain.store_mfn: sxpr.append([''store_mfn'', domain.store_mfn]) if domain.console_mfn: _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Hi, I think I came across a tiny bug (please confirm) in to_sxp method of XendConfig class (tools/python/xen/xend/XendConfig.py): def to_sxp(self, domain = None, ignore_devices = False, ignore = [], legacy_only = True): the domain is optional, but the code tries to access its methods in several places. I was just wondering whether there''s a strong assumption that domain should be specified, or the extra checks really are necessary. Here''s a patch. Thanks, Alex. --- a/tools/python/xen/xend/XendConfig.py Mon May 11 13:52:04 2009 +0100 +++ b/tools/python/xen/xend/XendConfig.py Wed May 13 17:23:17 2009 -0400 @@ -1035,7 +1035,7 @@ class XendConfig(dict): # TODO: domid/dom is the same thing but called differently # depending if it is from xenstore or sxpr. - if domain.getDomid() is not None: + if domain and domain.getDomid() != None: sxpr.append([''domid'', domain.getDomid()]) if not legacy_only: @@ -1072,12 +1072,13 @@ class XendConfig(dict): sxpr.append([''security_label'', self[''security_label'']]) sxpr.append([''image'', self.image_sxpr()]) - sxpr.append([''status'', domain._stateGet()]) - - if domain.getDomid() is not None: - sxpr.append([''state'', self._get_old_state_string()]) if domain: + sxpr.append([''status'', domain._stateGet()]) + + if domain.getDomid() is not None: + sxpr.append([''state'', self._get_old_state_string()]) + if domain.store_mfn: sxpr.append([''store_mfn'', domain.store_mfn]) if domain.console_mfn: _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel