[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH]restore name/uuid uniqueness check



Keir Fraser wrote:


On 23/1/08 08:07, "Keir Fraser" <Keir.Fraser@xxxxxxxxxxxx> wrote:

Perhaps you can disable your uniqueness checks on migration?

This is quite sensible actually, because a migration does not create or
restart a new domain. It just relocates an already-running domain, to which
uniqueness checks should already have been applied.

 -- Keir

this is a revised patch. I disable the uniqueness check by adding a extra
parameter to domain_restore_fd.

have tested on xen-3.1-testing.

regards,

zhigang
--- xen-3.1.2-ovs.orig/tools/python/xen/xend/XendDomain.py      2008-01-15 
19:19:14.000000000 +0800
+++ xen-3.1.2-ovs.new/tools/python/xen/xend/XendDomain.py       2008-01-30 
10:54:12.000000000 +0800
@@ -1081,7 +1081,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
@@ -1091,7 +1091,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
--- xen-3.1.2-ovs.orig/tools/python/xen/xend/XendCheckpoint.py  2008-01-15 
19:19:14.000000000 +0800
+++ xen-3.1.2-ovs.new/tools/python/xen/xend/XendCheckpoint.py   2008-01-30 
10:57:15.000000000 +0800
@@ -150,7 +150,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
 
     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()
     else:
--- xen-3.1.2-ovs.orig/tools/python/xen/xend/server/relocate.py 2008-01-15 
19:19:14.000000000 +0800
+++ xen-3.1.2-ovs.new/tools/python/xen/xend/server/relocate.py  2008-01-30 
10:59:40.000000000 +0800
@@ -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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.