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

[Xen-tools] [PATCH] Make xend reject duplicates and rename zombies

To: Xen Developers <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-tools] [PATCH] Make xend reject duplicates and rename zombies
From: Dan Smith <danms@xxxxxxxxxx>
Date: Thu, 15 Sep 2005 08:49:40 -0700
Cc: Xen Tools Developers <xen-tools@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 15 Sep 2005 15:47:55 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-tools-request@lists.xensource.com?subject=help>
List-id: Xen control tools developers <xen-tools.lists.xensource.com>
List-post: <mailto:xen-tools@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-tools>, <mailto:xen-tools-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-tools>, <mailto:xen-tools-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-tools-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)
This patch is an update of my previous anti-duplicate-domain patch.
Now, we check an existing same-name domain to see if it's in the
"terminated" state, renaming it to "zombie-domid-name" if so.

This basically makes the problem go away for me, as it gives the dying
domain time to clean itself up.

Test 10_create_fastdestroy from the next release of xm-test validates
that this fixes the problem.

Signed-off-by: Dan Smith <danms@xxxxxxxxxx>

diff -r c27431cf81f9 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Thu Sep 15 13:17:24 2005
+++ b/tools/python/xen/xend/XendDomain.py       Thu Sep 15 08:44:22 2005
@@ -297,6 +297,20 @@
         @param config: configuration
         @return: domain
         """
+
+        existing = self.domains.get_by_name(sxp.child_value(config, "name"))
+        if existing:
+            if existing.is_terminated():
+                newname = "zombie-%i-%s" % (existing.domid, existing.name)
+                log.debug("Renaming zombie domain %s -> %s" %
+                          (existing.name, newname))
+                existing.setName(newname)
+            else:
+                log.debug("Attempt to create duplicate domain %s" %
+                          existing.name)
+                raise XendError("Domain %s already exists as %i!" %
+                                (existing.name, existing.id))
+        
         dominfo = XendDomainInfo.create(self.dbmap, config)
         return dominfo
 
-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@xxxxxxxxxx
_______________________________________________
Xen-tools mailing list
Xen-tools@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-tools