All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]restore name/uuid uniqueness check
@ 2008-01-23  6:59 Zhigang Wang
  2008-01-23  8:07 ` Keir Fraser
  2008-01-23 13:50 ` what work does analysis_phase( ) do? tgh
  0 siblings, 2 replies; 5+ messages in thread
From: Zhigang Wang @ 2008-01-23  6:59 UTC (permalink / raw)
  To: xen-devel

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

hi all,

currently, if I restore a vm when the vm is running, it will cause two running
vms with the same name/uuid (the second vm is not functional due to disk image
in use).

# xm create OVM_EL5U1_X86_64_PVM_4GB
# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   543     2     r-----    400.1
OVM_EL5U1_X86_64_PVM_4GB                     3   128     1     -b----     14.2
# xm save 3 /tmp/s1
# xm create OVM_EL5U1_X86_64_PVM_4GB
# xm restore /tmp/s1
# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   543     2     r-----    411.6
OVM_EL5U1_X86_64_PVM_4GB                     4   128     1     -b----     15.3
OVM_EL5U1_X86_64_PVM_4GB                     5   128     1     -b----      0.7
# xm log
--snip--
[2008-01-23 05:13:57 2502] DEBUG (DevController:603) hotplugStatusCallback 5.
[2008-01-23 05:13:57 2502] ERROR (XendCheckpoint:286) Device 768 (vbd) could not be connected.
File /share/vm/OVM_EL5U1_X86_64_PVM_4GB/system.img is loopback-mounted through /dev/loop0,
which is mounted in a guest domain,
and so cannot be mounted now.
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/xen/xend/XendCheckpoint.py", line 284, in restore
    dominfo.waitForDevices() # Wait for backends to set up
  File "/usr/lib/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 565, in waitForDevices
    self.getDeviceController(devclass).waitForDevices()
  File "/usr/lib/python2.4/site-packages/xen/xend/server/DevController.py", line 151, in waitForDevices
    return map(self.waitForDevice, self.deviceIDs())
  File "/usr/lib/python2.4/site-packages/xen/xend/server/DevController.py", line 186, in waitForDevice
    raise VmError("Device %s (%s) could not be connected.\n%s" %
VmError: Device 768 (vbd) could not be connected.
File /share/vm/OVM_EL5U1_X86_64_PVM_4GB/system.img is loopback-mounted through /dev/loop0,
which is mounted in a guest domain,
and so cannot be mounted now.
--snip--

if set the disk emulation mode to 'w!', both vms will be functional, but the
filesystem will crash soon.

local live migration has this issue two.

this patch makes name/uuid uniqueness check when restore. but it will disable
local migration.

please give some advice on resolving this problem while don't break local
migration. if cannot find one, I prefer disable local migration.

thanks,

zhigang


[-- Attachment #2: restore-name-uuid-uniqueness-check.patch --]
[-- Type: text/x-patch, Size: 720 bytes --]

--- xen-3.1.2.orig/tools/python/xen/xend/XendCheckpoint.py	2008-01-15 19:19:14.000000000 +0800
+++ xen-3.1.2/tools/python/xen/xend/XendCheckpoint.py	2008-01-22 13:27:21.000000000 +0800
@@ -170,6 +170,13 @@ def restore(xd, fd, dominfo = None, paus
 
     vmconfig = p.get_val()
 
+    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:

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]restore name/uuid uniqueness check
  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-23 13:50 ` what work does analysis_phase( ) do? tgh
  1 sibling, 1 reply; 5+ messages in thread
From: Keir Fraser @ 2008-01-23  8:07 UTC (permalink / raw)
  To: Zhigang Wang, xen-devel

On 23/1/08 06:59, "Zhigang Wang" <zhigang.x.wang@oracle.com> wrote:

> local live migration has this issue two.
> 
> this patch makes name/uuid uniqueness check when restore. but it will disable
> local migration.
> 
> please give some advice on resolving this problem while don't break local
> migration. if cannot find one, I prefer disable local migration.

Since local migration is the sum total of our automated per-changeset
testing of migration, disabling it is not going to happen.

Perhaps you can disable your uniqueness checks on migration?

 -- Keir

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]restore name/uuid uniqueness check
  2008-01-23  8:07 ` Keir Fraser
@ 2008-01-23  8:14   ` Keir Fraser
  2008-01-30  6:34     ` Zhigang Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Keir Fraser @ 2008-01-23  8:14 UTC (permalink / raw)
  To: Keir Fraser, Zhigang Wang, xen-devel




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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* what work does analysis_phase( ) do?
  2008-01-23  6:59 [PATCH]restore name/uuid uniqueness check Zhigang Wang
  2008-01-23  8:07 ` Keir Fraser
@ 2008-01-23 13:50 ` tgh
  1 sibling, 0 replies; 5+ messages in thread
From: tgh @ 2008-01-23 13:50 UTC (permalink / raw)
  To: xen-devel

hi
  I read the code of xc_domain_save(), and i am confused about the 
function of     analysis_phase(xc_handle, dom, p2m_size, to_skip, 0) ,  
what work does it do ?
  could someone give me a help?

Thanks in advance

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]restore name/uuid uniqueness check
  2008-01-23  8:14   ` Keir Fraser
@ 2008-01-30  6:34     ` Zhigang Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Zhigang Wang @ 2008-01-30  6:34 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

[-- 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-01-30  6:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2008-01-23 13:50 ` what work does analysis_phase( ) do? tgh

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.