From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhigang Wang Subject: Re: [PATCH]restore name/uuid uniqueness check Date: Wed, 30 Jan 2008 14:34:20 +0800 Message-ID: <47A01A6C.5020507@oracle.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020702000600090005060105" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------020702000600090005060105 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Keir Fraser wrote: > > > On 23/1/08 08:07, "Keir Fraser" 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 --------------020702000600090005060105 Content-Type: text/x-patch; name="restore-name-uniqueness-check2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="restore-name-uniqueness-check2.patch" --- 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() --------------020702000600090005060105 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------020702000600090005060105--