Re: [PATCH v2 0/2] Add machine type pc-1.0-qemu-kvm for live migrate compatibility with qemu-kvm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This worked for me when migrating by hand.  I'm trying to make it work
through libvirt, using the following patch.  (So whether to have
pc-1.0 be treated as qemu's or qemu-kvm's pc-1.0 is specifed using a
boolean in /etc/libvirt/qemu.conf)  Qemu starts with decent
looking args, but for some reason the the migration is failing -
still looking through the logfile to figure out why.  Now sadly my
tests are being further slowed down by qcow corruption on my host,
but I don't think that was the cause of my failure.

Index: libvirt-1.2.6/src/qemu/qemu_conf.c
===================================================================
--- libvirt-1.2.6.orig/src/qemu/qemu_conf.c
+++ libvirt-1.2.6/src/qemu/qemu_conf.c
@@ -230,6 +230,8 @@ virQEMUDriverConfigPtr virQEMUDriverConf
     cfg->migrationPortMin = QEMU_MIGRATION_PORT_MIN;
     cfg->migrationPortMax = QEMU_MIGRATION_PORT_MAX;
 
+    cfg->incoming_assume_qemukvm = false;
+
 #if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
     /* For privileged driver, try and find hugepage mount automatically.
      * Non-privileged driver requires admin to create a dir for the
@@ -355,6 +357,7 @@ int virQEMUDriverConfigLoadFile(virQEMUD
             goto cleanup;                  \
     }
 
+    GET_VALUE_BOOL("incoming_assume_qemukvm", cfg->incoming_assume_qemukvm);
     GET_VALUE_BOOL("vnc_auto_unix_socket", cfg->vncAutoUnixSocket);
     GET_VALUE_BOOL("vnc_tls", cfg->vncTLS);
     GET_VALUE_BOOL("vnc_tls_x509_verify", cfg->vncTLSx509verify);
Index: libvirt-1.2.6/src/qemu/qemu_conf.h
===================================================================
--- libvirt-1.2.6.orig/src/qemu/qemu_conf.h
+++ libvirt-1.2.6/src/qemu/qemu_conf.h
@@ -168,6 +168,8 @@ struct _virQEMUDriverConfig {
     char *migrationAddress;
     int migrationPortMin;
     int migrationPortMax;
+    /* Whether incoming pc-1.0 migration should come from qemu-kvm */
+    bool incoming_assume_qemukvm;
 
     bool logTimestamp;
 };
Index: libvirt-1.2.6/src/qemu/qemu_migration.c
===================================================================
--- libvirt-1.2.6.orig/src/qemu/qemu_migration.c
+++ libvirt-1.2.6/src/qemu/qemu_migration.c
@@ -2131,6 +2131,16 @@ static char
         if (!qemuDomainDefCheckABIStability(driver, vm->def, def))
             goto cleanup;
 
+        if (driver->config->incoming_assume_qemukvm) {
+            if (STREQ_NULLABLE(vm->def->os.machine, "pc-1.0")) {
+                VIR_FREE(vm->def->os.machine);
+                VIR_FREE(def->os.machine);
+                if (VIR_STRDUP(vm->def->os.machine, "pc-1.0-qemu-kvm") < 0 ||
+                        VIR_STRDUP(def->os.machine, "pc-1.0-qemu-kvm") < 0)
+                    goto cleanup;
+            }
+        }
+
         rv = qemuDomainDefFormatLive(driver, def, false, true);
     } else {
         rv = qemuDomainDefFormatLive(driver, vm->def, false, true);
@@ -2461,6 +2471,13 @@ qemuMigrationPrepareAny(virQEMUDriverPtr
         goto endjob;
     }
 
+    if (driver->config->incoming_assume_qemukvm) {
+            if (STREQ_NULLABLE(vm->def->os.machine, "pc-1.0")) {
+                VIR_FREE(vm->def->os.machine);
+                if (VIR_STRDUP(vm->def->os.machine, "pc-1.0-qemu-kvm") < 0)
+                    goto endjob;
+            }
+    }
     /* Start the QEMU daemon, with the same command-line arguments plus
      * -incoming $migrateFrom
      */
Index: libvirt-1.2.6/src/qemu/qemu_command.c
===================================================================
--- libvirt-1.2.6.orig/src/qemu/qemu_command.c
+++ libvirt-1.2.6/src/qemu/qemu_command.c
@@ -7093,6 +7093,7 @@ qemuBuildCommandLine(virConnectPtr conn,
     virArch hostarch = virArchFromHost();
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
 
+    
     VIR_DEBUG("conn=%p driver=%p def=%p mon=%p json=%d "
               "qemuCaps=%p migrateFrom=%s migrateFD=%d "
               "snapshot=%p vmop=%d",
@@ -7172,6 +7173,11 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ENABLE_FIPS))
         virCommandAddArg(cmd, "-enable-fips");
 
+    VIR_DEBUG("qemu_command: os.machine is %s\n", def->os.machine);
+    if (STREQ_NULLABLE(def->os.machine, "pc-1.0-qemu-kvm")) {
+        virCommandAddArgList(cmd, "-global",
+                "virtio-net-pci.romfile=pxe-virtio.rom.12.04", NULL);
+    }
     if (qemuBuildMachineArgStr(cmd, def, qemuCaps) < 0)
         goto error;
 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]