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] Recover from name uniqueness violation by renaming. Fixe

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Recover from name uniqueness violation by renaming. Fixes bug #277.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 05 Oct 2005 13:46:10 +0000
Delivery-date: Wed, 05 Oct 2005 13:43:45 +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 b4800e204757f1e5a6b85ca5aba6fe1c4b6597c6
# Parent  c60036fe7418d52b7cbbec4862933233b87b9660
Recover from name uniqueness violation by renaming.  Fixes bug #277.

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

diff -r c60036fe7418 -r b4800e204757 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Wed Oct  5 10:43:23 2005
+++ b/tools/python/xen/xend/XendDomain.py       Wed Oct  5 13:38:19 2005
@@ -309,10 +309,12 @@
             if n == 1:
                 return matching[0]
             elif n > 1:
-                raise XendError(
-                    'Name uniqueness has been violated for name %s' % name)
-            else:
-                return None
+                log.error('Name uniqueness has been violated for name %s!  '
+                          'Recovering by renaming:', name)
+                for d in matching:
+                    d.renameUniquely()
+
+            return None
         finally:
             self.domains_lock.release()
 
diff -r c60036fe7418 -r b4800e204757 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Oct  5 10:43:23 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Wed Oct  5 13:38:19 2005
@@ -1288,7 +1288,7 @@
         preserving the restart semantics (name and UUID preserved).
         """
         
-        new_name = self.generateShutdownName()
+        new_name = self.generateUniqueName()
         new_uuid = getUuid()
         log.info("Renaming dead domain %s (%d, %s) to %s (%s).",
                  self.info['name'], self.domid, self.uuid, new_name, new_uuid)
@@ -1307,7 +1307,23 @@
         self.state_set(STATE_VM_TERMINATED)
 
 
-    def generateShutdownName(self):
+    ## public:
+
+    def renameUniquely(self):
+        """Rename this domain so that it has a unique name.  This is used by
+        XendDomain to recover from non-uniqueness errors; we should never have
+        allowed the system to reach this state in the first place."""
+        new_name = self.generateUniqueName()
+        
+        log.error('Renaming %s (%d, %s) to %s', self.info['name'], self.domid,
+                  self.uuid, new_name)
+
+        self.setName(new_name)
+
+
+    # private:
+
+    def generateUniqueName(self):
         n = 1
         while True:
             name = "%s-%d" % (self.info['name'], n)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Recover from name uniqueness violation by renaming. Fixes bug #277., Xen patchbot -unstable <=