[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xend: Perform uuid/name uniqueness check on restore.
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |