Skip to contentSkip to conversation

migration regression in xen-4.11 and qemu-2.11 and qcow2

DISCUSSION Olaf Hering 3 participants 16 messages May 7, 2018 – May 17, 2018

lore
Share & tools
lore
#0 lore raw

I assume OSS test does not test realworld live migration, therefore the following regression remained unnoticed:

name="hvm"
builder="hvm"
memory=555
vcpus=4
serial="pty"
boot="c"
disk=[ 'qcow2:/nfs/vdisk.qcow2,hda,w', ]
device_model_version="qemu-xen"

xl create -cf hvm.cfg
sleep N
xl migrate hvm $host

On $host the domU becomes unusable, qemu reports:
xen be: qdisk-768: xen be: qdisk-768: error: Failed to get "write" lock

With qemu-2.10 the sender noticed the error somehow, and migration was aborted:
qemu-system-i386: Failed to get "write" lock

With qemu-2.11 the sender thinks everything is alright and the domU is moved.

What I gathered during debugging so far is that somehow qemu on the receiving side locks a region twice:

2018-05-07T09:49:45.810930Z qemu-system-i386: qemu_lock_fcntl: 39 c9 1 F_UNLCK>F_UNLCK 0 Success
2018-05-07T09:49:45.813717Z qemu-system-i386: qemu_lock_fcntl: 39 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-07T09:49:45.814591Z qemu-system-i386: qemu_lock_fd_test: 39 c9 1 F_WRLCK>F_RDLCK 0 Success

raw_check_lock_bytes: fcntl on 39 returned -11/0

I do not know how raw_apply_lock_bytes() is supposed to be used. In its current form it does not work. Anyone else seeing this?

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw

Am Mon, 7 May 2018 17:19:46 +0200
schrieb Olaf Hering <[email protected]>:

Quoted 1 line

What I gathered during debugging so far is that somehow qemu on the receiving side locks a region twice:

After further debugging with many wild printfs:
On the receiving side blockdev_init sets BDRV_O_INACTIVE because RUN_STATE_INMIGRATE is true. BDRV_O_INACTIVE causes bdrv_is_writable to return false.
As a result bdrv_format_default_perms does not set BLK_PERM_WRITE in perms.

On the sending side offset 0xc9 is unlocked on the other fd, which allows F_WRLCK to succeed:

2018-05-08T11:20:54.491168Z qemu-system-i386: qemu_lock_fcntl: 28 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:20:54.492162Z qemu-system-i386: qemu_lock_fd_test: 28 c9 1 F_WRLCK>F_UNLCK 0 Success
2018-05-08T11:20:54.494752Z qemu-system-i386: qemu_lock_fcntl: 28 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:05.189455Z qemu-system-i386: qemu_lock_fcntl: 28 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:05.190460Z qemu-system-i386: qemu_lock_fd_test: 28 c9 1 F_WRLCK>F_UNLCK 0 Success
2018-05-08T11:21:05.192726Z qemu-system-i386: qemu_lock_fcntl: 28 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:05.194298Z qemu-system-i386: qemu_lock_fcntl: 28 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:05.195079Z qemu-system-i386: qemu_lock_fd_test: 28 c9 1 F_WRLCK>F_UNLCK 0 Success
2018-05-08T11:21:05.197123Z qemu-system-i386: qemu_lock_fcntl: 28 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:05.199378Z qemu-system-i386: qemu_lock_fcntl: 28 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:05.201108Z qemu-system-i386: qemu_lock_fcntl: 28 c9 1 F_UNLCK>F_UNLCK 0 Success
2018-05-08T11:21:05.344335Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_UNLCK>F_UNLCK 0 Success
2018-05-08T11:21:05.345969Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:05.346836Z qemu-system-i386: qemu_lock_fd_test: 27 c9 1 F_WRLCK>F_UNLCK 0 Success
2018-05-08T11:21:05.348937Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:05.359691Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:05.360632Z qemu-system-i386: qemu_lock_fd_test: 27 c9 1 F_WRLCK>F_UNLCK 0 Success
2018-05-08T11:21:05.363221Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:05.364781Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:05.365607Z qemu-system-i386: qemu_lock_fd_test: 27 c9 1 F_WRLCK>F_UNLCK 0 Success
2018-05-08T11:21:05.367794Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success

It seems on the receiving side some code forgets to unclock offset 0xc9, which causes F_WRLCK to fail:

2018-05-08T11:21:52.108809Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_UNLCK>F_UNLCK 0 Success
2018-05-08T11:21:52.112193Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:52.113028Z qemu-system-i386: qemu_lock_fd_test: 27 c9 1 F_WRLCK>F_UNLCK 0 Success
2018-05-08T11:21:52.115401Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:52.122037Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:52.122886Z qemu-system-i386: qemu_lock_fd_test: 27 c9 1 F_WRLCK>F_UNLCK 0 Success
2018-05-08T11:21:52.125189Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:52.126969Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:52.127801Z qemu-system-i386: qemu_lock_fd_test: 27 c9 1 F_WRLCK>F_UNLCK 0 Success
2018-05-08T11:21:52.130109Z qemu-system-i386: qemu_lock_fcntl: 27 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:52.859199Z qemu-system-i386: qemu_lock_fcntl: 39 c9 1 F_UNLCK>F_UNLCK 0 Success
2018-05-08T11:21:52.862010Z qemu-system-i386: qemu_lock_fcntl: 39 c9 1 F_RDLCK>F_RDLCK 0 Success
2018-05-08T11:21:52.862673Z qemu-system-i386: qemu_lock_fd_test: 39 c9 1 F_WRLCK>F_RDLCK 0 Success
2018-05-08T11:21:53.112935Z qemu-system-i386: qemu_lock_fd_test: 39 c9 1 F_WRLCK>F_RDLCK 0 Success
2018-05-08T11:21:53.363246Z qemu-system-i386: qemu_lock_fd_test: 39 c9 1 F_WRLCK>F_RDLCK 0 Success
2018-05-08T11:21:53.615668Z qemu-system-i386: qemu_lock_fcntl: 39 c9 1 F_UNLCK>F_UNLCK 0 Success
2018-05-08T11:21:53.616426Z qemu-system-i386: qemu_lock_fcntl: 39 c9 1 F_UNLCK>F_UNLCK 0 Success
2018-05-08T11:21:53.616816Z qemu-system-i386: qemu_lock_fcntl: 39 c9 1 F_UNLCK>F_UNLCK 0 Success

It is unclear why that was never noticed in xen-4.10, qemu-2.9 did not have that bug. Also, if a KVM or Xen guest is migrated should make zero difference for the qcow2 driver...

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw

Am Tue, 8 May 2018 13:31:43 +0200
schrieb Olaf Hering <[email protected]>:

Quoted 3 lines

On the sending side offset 0xc9 is unlocked on the other fd, which allows F_WRLCK to succeed:

It seems on the receiving side some code forgets to unclock offset 0xc9, which causes F_WRLCK to fail:

It looks like the IDE unplug is not permanent.
On the receiving side the IDE disk is reattached, and it keeps the qcow2 image busy. Does anyone happen to know how to make the unplug permanent, at least for the blocklayer?

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw

Am Tue, 8 May 2018 18:40:26 +0200
schrieb Olaf Hering <[email protected]>:

Quoted 1 line

It looks like the IDE unplug is not permanent.

Stefano,

Jochen pointed me to commit 512b109ec962 ("xen: unplug the emulated devices at resume time"), which I think is wrong. The kernel will most likely not be able to switch from a PV backed device to an emulated device. Not sure what issue could have been addressed by that commit. What should have been done instead is to transfer the unplug state from one qemu to the other. Please advice how to do that. Right now, with xen-4.10, all xenlinux based HVM domUs can not be migrated anymore. With the upcoming xen-4.11 the migrated domU will need to be killed.

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
Quoted 8 lines · Olaf Hering

Am Tue, 8 May 2018 18:40:26 +0200
schrieb Olaf Hering <[email protected]>:

Quoted 1 line

It looks like the IDE unplug is not permanent.

Stefano,

Jochen pointed me to commit 512b109ec962 ("xen: unplug the emulated devices at resume time"), which I think is wrong. The kernel will most likely not be able to switch from a PV backed device to an emulated device. Not sure what issue could have been addressed by that commit. What should have been done instead is to transfer the unplug state from one qemu to the other. Please advice how to do that. Right now, with xen-4.10, all xenlinux based HVM domUs can not be migrated anymore. With the upcoming xen-4.11 the migrated domU will need to be killed.

Hi Olaf,

Please use my kernel.org email address and CC Anthony Perard for anything related QEMU.

I cannot find 512b109ec962 or "xen: unplug the emulated devices at resume time" anywhere, neither in qemu.org/master nor in the qemu-xen trees. What am I missing?

Cheers,

Stefano

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw

CC'ing Linux x86 maintainers

Quoted 8 lines · Olaf Hering

Am Wed, 9 May 2018 14:08:14 -0700 (PDT) schrieb Stefano Stabellini <[email protected]>:

Quoted 3 lines

I cannot find 512b109ec962 or "xen: unplug the emulated devices at resume time" anywhere, neither in qemu.org/master nor in the qemu-xen trees. What am I missing?

It is a 7 years old kernel patch.

I see, the email subject misled me. I found the commit now.

Quoted 9 lines

Jochen pointed me to commit 512b109ec962 ("xen: unplug the emulated devices at resume time"), which I think is wrong. The kernel will most likely not be able to switch from a PV backed device to an emulated device. Not sure what issue could have been addressed by that commit. What should have been done instead is to transfer the unplug state from one qemu to the other. Please advice how to do that. Right now, with xen-4.10, all xenlinux based HVM domUs can not be migrated anymore. With the upcoming xen-4.11 the migrated domU will need to be killed.

I don't recall why 512b109ec962 was needed exactly. I suspect that the sudden appearance of the emulated devices was actually causing some problems. Did you try to revert it? I would imagine you'll probably see some interesting output from the kernel at resume time.

Yes, transferring the unplug state from one QEMU to the other is a good idea, but Linux should be able to migrate correctly regardless of the QEMU/Xen version. Xen support in Linux doesn't depend on any specifc Xen version, so this is probably why the bug was fixed/worked-around on the Linux side.

512b109ec962 is a very old commit: why is it causing problems to Xen 4.10 and Xen 4.11 HVM migration? What is the error exactly? Sorry, I might be missing some context.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw

Am Wed, 9 May 2018 14:43:17 -0700 (PDT) schrieb Stefano Stabellini <[email protected]>:

Quoted 3 lines

512b109ec962 is a very old commit: why is it causing problems to Xen 4.10 and Xen 4.11 HVM migration? What is the error exactly? Sorry, I might be missing some context.

It is papering over the real issue, thats why one can still migrate a pvops HVM domU with current toolstack. Upstream kernel simply does the work that is supposed to be done by qemu itself. Since the xenlinux based kernel does not do that work (it never had a need to do the unplug twice), migration fails.

qemu has to carry the unplug state from one dom0 to another dom0 during migration, simply because unplug is a one-time operation that can not be undone. I wonder how to do that, if qemu already has code to carry its state.

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw
Quoted 13 lines · Olaf Hering

Am Wed, 9 May 2018 14:43:17 -0700 (PDT) schrieb Stefano Stabellini <[email protected]>:

Quoted 3 lines

512b109ec962 is a very old commit: why is it causing problems to Xen 4.10 and Xen 4.11 HVM migration? What is the error exactly? Sorry, I might be missing some context.

It is papering over the real issue, thats why one can still migrate a pvops HVM domU with current toolstack. Upstream kernel simply does the work that is supposed to be done by qemu itself. Since the xenlinux based kernel does not do that work (it never had a need to do the unplug twice), migration fails.

Quoted 4 lines

qemu has to carry the unplug state from one dom0 to another dom0 during migration, simply because unplug is a one-time operation that can not be undone. I wonder how to do that, if qemu already has code to carry its state.

You could add a property to vmstate_xen_platform of xen_platform.c, but you need to pay attention to legacy compatibility. Inevitably, there will be older versions that do not have the new vmstate_xen_platform field or do not set it properly.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw

Am Thu, 10 May 2018 09:03:30 -0700 (PDT) schrieb Stefano Stabellini <[email protected]>:

Quoted 4 lines

You could add a property to vmstate_xen_platform of xen_platform.c, but you need to pay attention to legacy compatibility. Inevitably, there will be older versions that do not have the new vmstate_xen_platform field or do not set it properly.

Doing the unplug on the other side works if it is done from blk_connect. At the point xen_platform_post_load is called, qemu is still in the middle of initializing. Doing it from there causes weird failures.

Any idea what the proper place is to call platform_do_unplug?

Olaf

hw/block/xen_disk.c +4 -0
@@ -31,6 +31,7 @@
 #include "qapi/error.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qstring.h"
+#include "qemu/error-report.h"
 
 /* ------------------------------------------------------------- */
 
@@ -1074,6 +1075,9 @@ static int blk_connect(struct XenDevice
     unsigned int i;
     uint32_t *domids;
 
+    error_report("%s", __func__);
+    xen_unplug_after_migration();
+
     /* read-only ? */
     if (blkdev->directiosafe) {
         qflags = BDRV_O_NOCACHE | BDRV_O_NATIVE_AIO;
hw/i386/xen/xen_platform.c +59 -19

166 lines not on this page · raw message

include/migration/vmstate.h +1 -0
@@ -29,6 +29,7 @@
 
 #include "migration/qjson.h"
 
+extern void xen_unplug_after_migration(void);
 typedef struct VMStateInfo VMStateInfo;
 typedef struct VMStateDescription VMStateDescription;
 typedef struct VMStateField VMStateField;
migration/savevm.c +3 -0
@@ -2265,6 +2265,7 @@ void qmp_xen_save_devices_state(const ch
     int saved_vm_running;
     int ret;
 
+    error_report("%s %s %x %x", __func__, filename, has_live, live);
     if (!has_live) {
         /* live default to true so old version of Xen tool stack can have a
          * successfull live migration */
@@ -2284,6 +2285,7 @@ void qmp_xen_save_devices_state(const ch
     object_unref(OBJECT(ioc));
     ret = qemu_save_device_state(f);
     qemu_fclose(f);
+    error_report("%s %x", __func__, ret);
     if (ret < 0) {
         error_setg(errp, QERR_IO_ERROR);
     } else {
@@ -2293,6 +2295,7 @@ void qmp_xen_save_devices_state(const ch
          * So call bdrv_inactivate_all (release locks) here to let the other
          * side of the migration take controle of the images.
          */
+        error_report("%s %x saved_vm_running %x", __func__, live, saved_vm_running);
         if (live && !saved_vm_running) {
             ret = bdrv_inactivate_all();
             if (ret) {
hw/i386/xen/xen-hvm.c +1 -0
@@ -1240,6 +1240,7 @@ void xen_hvm_init(PCMachineState *pcms,
     evtchn_port_t bufioreq_evtchn;
     XenIOState *state;
 
+    error_report("%s", __func__);
     state = g_malloc0(sizeof (XenIOState));
 
     state->xce_handle = xenevtchn_open(NULL, 0);
hw/xen/xen_backend.c +1 -0
@@ -588,6 +588,7 @@ int xen_be_register(const char *type, st
 
 void xen_be_register_common(void)
 {
+    error_report("%s", __func__);
     xen_set_dynamic_sysbus();
 
     xen_be_register("console", &xen_console_ops);
hw/xenpv/xen_machine_pv.c +1 -0
@@ -34,6 +34,7 @@ static void xen_init_pv(MachineState *ma
     DriveInfo *dinfo;
     int i;
 
+    error_report("%s", __func__);
     /* Initialize backend core & drivers */
     if (xen_be_init() != 0) {
         fprintf(stderr, "%s: xen backend core setup failed\n", __FUNCTION__);
util/osdep.c +2 -0
@@ -338,6 +338,7 @@ int qemu_open(const char *name, int flag
         qemu_set_cloexec(ret);
     }
 #endif
+    error_report("%s %d = %s", __func__, ret, name);
 
 #ifdef O_DIRECT
     if (ret == -1 && errno == EINVAL && (flags & O_DIRECT)) {
@@ -353,6 +354,7 @@ int qemu_close(int fd)
 {
     int64_t fdset_id;
 
+    error_report("%s %d", __func__, fd);
     /* Close fd that was dup'd from an fdset */
     fdset_id = monitor_fdset_dup_fd_find(fd);
     if (fdset_id != -1) {
hw/i386/pc_piix.c +2 -0
@@ -87,6 +87,7 @@ static void pc_init1(MachineState *machi
     MemoryRegion *rom_memory;
     ram_addr_t lowmem;
 
+    error_report("%s e", __func__);
     /*
      * Calculate ram split, for memory below and above 4G.  It's a bit
      * complicated for backward compatibility reasons ...
@@ -302,6 +303,7 @@ static void pc_init1(MachineState *machi
         nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io,
                                pcms->fw_cfg, OBJECT(pcms));
     }
+    error_report("%s l", __func__);
 }
 
 /* Looking for a pc_compat_2_4() function? It doesn't exist.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw
In reply to Olaf Hering
Quoted 2 lines · Olaf Hering

It is unclear why that was never noticed in xen-4.10, qemu-2.9 did not have that bug. Also, if a KVM or Xen guest is migrated should make zero difference for the qcow2 driver...

Hi Olaf,

I did try to fix a migration related issue that has to do with a new lock placed by qemu. But if the issue your having is actually fixed.

The lock as been introduced in QEMU 2.10, but the was not working well with Xen, so for Xen 4.10, I've apply to qemu-xen-4.10:
migration, xen: Fix block image lock issue on live migration a4166a0a50dda967f30c9d85fa8aa2ea2539798e

I did fix the bug in QEMU 2.11 (5d6c599fe1d69a1bf8c5c4d3c58be2b31cd625ad) so Xen 4.11 does include it it the qemu-xen tree.

There is one last commit for libxl:
libxl_qmp: Tell QEMU about live migration or snapshot db0c7dde021c29c2ae0d847d70fb7b59e02ea522

I'm not sure if that information is going to help, but that what I have for now about the lock of block images.

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#11 lore raw

Am Thu, 10 May 2018 11:40:18 +0100
schrieb Anthony PERARD <[email protected]>:

Quoted 2 lines

I'm not sure if that information is going to help, but that what I have for now about the lock of block images.

I think the issue is not with two dom0s locking the same file, but with one qemu process trying to lock the same region within a file twice. That would not happen if an 'unplug' happens before the PV driver within qemu takes control. I'm sure migration with qcow2 will fail with a pvops domU if 512b109ec962 gets reverted.

I will look into vmstate_xen_platform, as suggested by Stefano, to preserve the unplug state during the lifetime of a domU. I think that is the correct approach, and 512b109ec962 should have never ever go upstream.

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#12 lore raw
In reply to Anthony PERARD

Am Thu, 10 May 2018 11:40:18 +0100
schrieb Anthony PERARD <[email protected]>:

Quoted 2 lines

I did fix the bug in QEMU 2.11 (5d6c599fe1d69a1bf8c5c4d3c58be2b31cd625ad) so Xen 4.11 does include it it the qemu-xen tree.

Is this supposed to be called also for PV? In my testing qmp_xen_save_devices_state shows up only on HVM.

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw

Am Wed, 16 May 2018 16:53:28 +0200
schrieb Olaf Hering <[email protected]>:

Quoted 5 lines

Am Thu, 10 May 2018 11:40:18 +0100
schrieb Anthony PERARD <[email protected]>:

Quoted 2 lines

I did fix the bug in QEMU 2.11 (5d6c599fe1d69a1bf8c5c4d3c58be2b31cd625ad) so Xen 4.11 does include it it the qemu-xen tree.

Is this supposed to be called also for PV? In my testing qmp_xen_save_devices_state shows up only on HVM.

I think the issue fixed by 5d6c599fe1d69a1bf8c5c4d3c58be2b31cd625ad is not specific to HVM. It seems domain_suspend_common_guest_suspended would call that changed function only for HVM. It seems the logic is wrong. It is not about the device model, but about that fact that 'disk==qcow2' requires qemu-upstream. We see failures also with PV and qcow2, but for some reason not with every domU. localhost migration on the other hand does fail with every PV domU.

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#14 lore raw

Am Thu, 17 May 2018 08:30:58 +0200
schrieb Olaf Hering <[email protected]>:

Quoted 1 line

I think the issue fixed by 5d6c599fe1d69a1bf8c5c4d3c58be2b31cd625ad is not specific to HVM. It seems domain_suspend_common_guest_suspended would call that changed function only for HVM. It seems the logic is wrong. It is not about the device model, but about that fact that 'disk==qcow2' requires qemu-upstream.

This fixes it for me. Now the question is how to do that properly for all sorts of diskimage types.

Olaf

tools/libxl/libxl_dom_suspend.c +21 -0
@@ -385,6 +385,21 @@ static void domain_suspend_common_guest_
             domain_suspend_common_done(egc, dsps, rc);
             return;
         }
+    } else if (dsps->type == LIBXL_DOMAIN_TYPE_PV) {
+        uint32_t const domid = dsps->domid;
+        const char *const filename = dsps->dm_savefile;
+        rc = libxl__qmp_stop(gc, domid);
+        if (rc) {
+            LOGD(ERROR, domid, "failure from libxl__qmp_stop domid:%d", rc);
+            return;
+        }
+        /* Save DM state into filename */
+        rc = libxl__qmp_save(gc, domid, filename, dsps->live);
+        if (rc) {
+            unlink(filename);
+            LOGD(ERROR, domid, "failure from libxl__qmp_save domid:%d", rc);
+            return;
+        }
     }
     domain_suspend_common_done(egc, dsps, 0);
 }
@@ -466,6 +481,12 @@ int libxl__domain_resume(libxl__gc *gc,
             LOGD(ERROR, domid, "failed to resume device model:%d", rc);
             goto out;
         }
+    } else if (type == LIBXL_DOMAIN_TYPE_PV) {
+        if (libxl__qmp_resume(gc, domid)) {
+            rc = ERROR_FAIL;
+            LOGD(ERROR, domid, "failed to resume device model:%d", rc);
+            goto out;
+        }
     }
 
     if (xc_domain_resume(CTX->xch, domid, suspend_cancel)) {

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#15 lore raw
In reply to Olaf Hering

Am Mon, 7 May 2018 17:19:46 +0200
schrieb Olaf Hering <[email protected]>:

Quoted 1 line

With qemu-2.11 the sender thinks everything is alright and the domU is moved.

Another case of breakage in qemu-2.11:
if the targethost does not even have access to the diskimage the sender still thinks everything is alright. qemu does not propagate the error to libxl to allow it to abort the migration.

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel