Am Mon, 13 Jan 2020 11:36:27 +0100
schrieb Olaf Hering <o...@aepfle.de>:

> This HVM domU fails to live migrate from staging-4.12 to staging-4.13:

It turned out libxl does not configure qemu correctly at runtime:
libxl__build_device_model_args_new() uses 'qemu -machine xenfv', perhaps with 
the assumption that 'xenfv' does the right thing. Unfortunately, 'xenfv' 
entirely ignores compatibility of "pc-i440fx" between qemu versions, 'xenfv' 
just maps to 'pc' aka 'the lastest'. Instead of 'qemu -machine xenfv', libxl 
should run 'qemu -machine pc-i440fx-3.0 -device xen-platform -accel xen' to 
make sure the domU can be migrated safely to future versions of qemu.

Maybe there should also be a way to select a specific variant of "pc-i440fx". 
Currently the only way to do that is to use device_model_args_hvm= in xl.cfg. 
Unfortunately libvirt does not support "b_info->extra*".

Should the string "pc-i440fx-3.0" become a configure option?



I think this (untested) patch has to be applied to staging-4.13:


--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1715,23 +1715,20 @@ static int libxl__build_device_model_args_new(libxl__gc 
*gc,
     for (i = 0; b_info->extra && b_info->extra[i] != NULL; i++)
         flexarray_append(dm_args, b_info->extra[i]);
 
-    flexarray_append(dm_args, "-machine");
     switch (b_info->type) {
     case LIBXL_DOMAIN_TYPE_PVH:
     case LIBXL_DOMAIN_TYPE_PV:
+        flexarray_append(dm_args, "-machine");
         flexarray_append(dm_args, "xenpv");
         for (i = 0; b_info->extra_pv && b_info->extra_pv[i] != NULL; i++)
             flexarray_append(dm_args, b_info->extra_pv[i]);
         break;
     case LIBXL_DOMAIN_TYPE_HVM:
-        if (!libxl_defbool_val(b_info->u.hvm.xen_platform_pci)) {
-            /* Switching here to the machine "pc" which does not add
-             * the xen-platform device instead of the default "xenfv" machine.
-             */
-            machinearg = libxl__strdup(gc, "pc,accel=xen");
-        } else {
-            machinearg = libxl__strdup(gc, "xenfv");
+        if (libxl_defbool_val(b_info->u.hvm.xen_platform_pci)) {
+            flexarray_append(dm_args, "-device");
+            flexarray_append(dm_args, "xen-platform");
         }
+        machinearg = libxl__strdup(gc, "pc-i440fx-3.0,accel=xen");
         if (b_info->u.hvm.mmio_hole_memkb) {
             uint64_t max_ram_below_4g = (1ULL << 32) -
                 (b_info->u.hvm.mmio_hole_memkb << 10);
@@ -1762,6 +1759,7 @@ static int libxl__build_device_model_args_new(libxl__gc 
*gc,
             }
         }
 
+        flexarray_append(dm_args, "-machine");
         flexarray_append(dm_args, machinearg);
         for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
             flexarray_append(dm_args, b_info->extra_hvm[i]);



Olaf

Attachment: pgpTcwIkgTfNr.pgp
Description: Digitale Signatur von OpenPGP

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to