All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhigang Wang <zhigang.x.wang@oracle.com>
To: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH]restore name/uuid uniqueness check
Date: Wed, 30 Jan 2008 14:34:20 +0800	[thread overview]
Message-ID: <47A01A6C.5020507@oracle.com> (raw)
In-Reply-To: <C3BCA7F3.12B79%Keir.Fraser@cl.cam.ac.uk>

[-- Attachment #1: Type: text/plain, Size: 542 bytes --]

Keir Fraser wrote:
> 
> 
> On 23/1/08 08:07, "Keir Fraser" <Keir.Fraser@cl.cam.ac.uk> 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

[-- Attachment #2: restore-name-uniqueness-check2.patch --]
[-- Type: text/x-patch, Size: 2624 bytes --]

--- 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()

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  reply	other threads:[~2008-01-30  6:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-23  6:59 [PATCH]restore name/uuid uniqueness check Zhigang Wang
2008-01-23  8:07 ` Keir Fraser
2008-01-23  8:14   ` Keir Fraser
2008-01-30  6:34     ` Zhigang Wang [this message]
2008-01-23 13:50 ` what work does analysis_phase( ) do? tgh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47A01A6C.5020507@oracle.com \
    --to=zhigang.x.wang@oracle.com \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.