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] [xen-unstable] xend: Perform uuid/name uniqueness check

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: Perform uuid/name uniqueness check on restore.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 30 Jan 2008 01:40:11 -0800
Delivery-date: Wed, 30 Jan 2008 01:40:12 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1201685749 0
# Node ID 4942f9909ec87a1365f306e804b84d4bf19d2d11
# Parent  3daab9b636c121bc9d957568ea135b2f40776ca5
xend: Perform uuid/name uniqueness check on restore.
From: Zhigang Wang <zhigang.x.wang@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/python/xen/xend/XendCheckpoint.py  |   10 +++++++++-
 tools/python/xen/xend/XendDomain.py      |    4 ++--
 tools/python/xen/xend/server/relocate.py |    2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff -r 3daab9b636c1 -r 4942f9909ec8 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py   Wed Jan 30 09:33:26 2008 +0000
+++ b/tools/python/xen/xend/XendCheckpoint.py   Wed Jan 30 09:35:49 2008 +0000
@@ -151,7 +151,7 @@ def save(fd, dominfo, network, live, dst
         raise exn
 
 
-def restore(xd, fd, dominfo = None, paused = False):
+def restore(xd, fd, dominfo = None, paused = False, relocating = False):
     signature = read_exact(fd, len(SIGNATURE),
         "not a valid guest state file: signature read")
     if signature != SIGNATURE:
@@ -170,6 +170,14 @@ def restore(xd, fd, dominfo = None, paus
         raise XendError("not a valid guest state file: config parse")
 
     vmconfig = p.get_val()
+
+    if not relocating:
+        domconfig = XendConfig(sxp_obj = vmconfig)
+        othervm = xd.domain_lookup_nr(domconfig["name_label"])
+        if othervm is None or othervm.domid is None:
+            othervm = xd.domain_lookup_nr(domconfig["uuid"])
+        if othervm is not None and othervm.domid is not None: 
+            raise VmError("Domain '%s' already exists with ID '%d'" % 
(domconfig["name_label"], othervm.domid))
 
     if dominfo:
         dominfo.resume()
diff -r 3daab9b636c1 -r 4942f9909ec8 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Wed Jan 30 09:33:26 2008 +0000
+++ b/tools/python/xen/xend/XendDomain.py       Wed Jan 30 09:35:49 2008 +0000
@@ -1123,7 +1123,7 @@ class XendDomain:
             raise XendError("can't read guest state file %s: %s" %
                             (src, ex[1]))
 
-    def domain_restore_fd(self, fd, paused=False):
+    def domain_restore_fd(self, fd, paused=False, relocating=False):
         """Restore a domain from the given file descriptor.
 
         @param fd: file descriptor of the checkpoint file
@@ -1133,7 +1133,7 @@ class XendDomain:
         """
 
         try:
-            return XendCheckpoint.restore(self, fd, paused=paused)
+            return XendCheckpoint.restore(self, fd, paused=paused, 
relocating=relocating)
         except XendError, e:
             log.exception("Restore failed")
             raise
diff -r 3daab9b636c1 -r 4942f9909ec8 tools/python/xen/xend/server/relocate.py
--- a/tools/python/xen/xend/server/relocate.py  Wed Jan 30 09:33:26 2008 +0000
+++ b/tools/python/xen/xend/server/relocate.py  Wed Jan 30 09:35:49 2008 +0000
@@ -108,7 +108,7 @@ class RelocationProtocol(protocol.Protoc
             self.send_reply(["ready", name])
             try:
                 XendDomain.instance().domain_restore_fd(
-                    self.transport.sock.fileno())
+                    self.transport.sock.fileno(), relocating=True)
             except:
                 self.send_error()
                 self.close()

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xend: Perform uuid/name uniqueness check on restore., Xen patchbot-unstable <=