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-users

[Xen-users] XendConfig to_sxp optional domain

To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-users] XendConfig to_sxp optional domain
From: Alexey Tumanov <atumanov@xxxxxxxxx>
Date: Wed, 13 May 2009 17:29:04 -0400
Delivery-date: Fri, 15 May 2009 06:23:20 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=O+A+OLRzEwuRS4x4gNVCLzdhETO1EBVUysHIe8JBl2Q=; b=VmIzMyo6tnAAKv3TlVUzLs3XJHnjHX5wy3haIV9pfp4N+pRPsEwH3cukyCQBLVil4X PcDMmJEVbbh67LZUqvoJMi3QcSFQpZWSU6fH8jN2LPClImrf+reYr7VCKRZGP48OVsOB oQ7wYDETjGDCHCI8U8ACmSwz2eHQfZ6/6PtrI=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=VcaRUTOsJx3n7RFN7K2p8JJlyK1ryXr5nKzwNb6rXpRFPIPPC0dezBD7mQrT/Gw2K3 1f1TeEt8DxQDvgZN7oMpoG02J+iouEb1RQCCvRTlNk6dFNnvhvb284tgbpTLxuv3K9ex vZWWzbWvV+MdfdUnGYIdgiQ1qeEZUQwc1zr/I=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-users] XendConfig to_sxp optional domain, Alexey Tumanov <=