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

[Xen-changelog] Rename all dying domains to be prefixed with Zombie. Thi

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Rename all dying domains to be prefixed with Zombie. This allows a new domain
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 06 Oct 2005 10:16:12 +0000
Delivery-date: Thu, 06 Oct 2005 10:13:58 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@ewan
# Node ID 0bc466c255605d0efeb4803626b72415839b9e6c
# Parent  1cfe0875658d5f83d38a5d96abe7a66e0d5db508
Rename all dying domains to be prefixed with Zombie.  This allows a new domain
to be created with the same name, fixing the race condition inside XendDomain
that caused bug #278.

Move the state_set(TERMINATED) call onto the end of cleanupDomain rather than
destroyDomain, so that this flag is set when XendDomain cleans up a domain
that was killed without going through Xend.

Remove is_terminated, as this check is no longer necessary, since we are using
Zombie prefixes instead.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 1cfe0875658d -r 0bc466c25560 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Oct  6 10:04:49 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Oct  6 10:09:14 2005
@@ -97,6 +97,7 @@
 DOMROOT = '/local/domain/'
 VMROOT  = '/vm/'
 
+ZOMBIE_PREFIX = 'Zombie-'
 
 xc = xen.lowlevel.xc.new()
 xroot = XendRoot.instance()
@@ -997,8 +998,6 @@
         dominfo = domain_by_name(name)
         if not dominfo:
             return
-        if dominfo.is_terminated():
-            return
         if self.domid is None:
             raise VmError("VM name '%s' already in use by domain %d" %
                           (name, dominfo.domid))
@@ -1100,6 +1099,14 @@
         except:
             log.exception("Removing domain path failed.")
 
+        try:
+            if not self.info['name'].startswith(ZOMBIE_PREFIX):
+                self.info['name'] = self.generateZombieName()
+        except:
+            log.exception("Renaming Zombie failed.")
+
+        self.state_set(STATE_VM_TERMINATED)
+
 
     def cleanupVm(self):
         """Cleanup VM resources.  Idempotent.  Nothrow guarantee."""
@@ -1123,23 +1130,15 @@
         log.debug("XendDomainInfo.destroyDomain(%s)", str(self.domid))
 
         self.cleanupDomain()
-        
+
         try:
             if self.domid is not None:
                 xc.domain_destroy(dom=self.domid)
         except:
             log.exception("XendDomainInfo.destroy: xc.domain_destroy failed.")
 
-        self.state_set(STATE_VM_TERMINATED)
-
 
     ## private:
-
-    def is_terminated(self):
-        """Check if a domain has been terminated.
-        """
-        return self.state == STATE_VM_TERMINATED
-
 
     def release_devices(self):
         """Release all domain's devices.  Nothrow guarantee."""
@@ -1353,6 +1352,18 @@
                 n += 1
 
 
+    def generateZombieName(self):
+        n = 0
+        name = ZOMBIE_PREFIX + self.info['name']
+        while True:
+            try:
+                self.check_name(name)
+                return name
+            except VmError:
+                n += 1
+                name = "%s%d-%s" % (ZOMBIE_PREFIX, n, self.info['name'])
+
+
     def configure_bootloader(self):
         if not self.info['bootloader']:
             return

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Rename all dying domains to be prefixed with Zombie. This allows a new domain, Xen patchbot -unstable <=