]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: domain: Drop piix3-ohci controller for migration
authorAndrea Bolognani <abologna@redhat.com>
Fri, 12 Aug 2016 15:10:40 +0000 (17:10 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 12 Aug 2016 15:38:02 +0000 (17:38 +0200)
Now that the default USB controller model is explicit rather
than implicit for i440fx machines, we have to tweak the
conditions for dropping it in order to keep migration towards
libvirt <= 0.9.4 working.

src/qemu/qemu_domain.c

index ec64ae01c71fce71c4c1f69d1f13ff53f84a4f8b..6c0f261bf09424b51bf5dcde7d9335b1029b76b1 100644 (file)
@@ -3315,12 +3315,20 @@ qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
                 usb = def->controllers[i];
             }
         }
-        /*  The original purpose of the check was the migration compatibility
-         *  with libvirt <= 0.9.4. Limitation doesn't apply to other archs
-         *  and can cause problems on PPC64.
+
+        /* In order to maintain compatibility with version of libvirt that
+         * didn't support <controller type='usb'/> (<= 0.9.4), we need to
+         * drop the default USB controller, ie. a USB controller at index
+         * zero with no model or with the default piix3-ohci model.
+         *
+         * However, we only need to do so for x86 i440fx machine types,
+         * because other architectures and machine types were introduced
+         * when libvirt already supported <controller type='usb'/>.
          */
         if (ARCH_IS_X86(def->os.arch) && qemuDomainMachineIsI440FX(def) &&
-            usb && usb->idx == 0 && usb->model == -1) {
+            usb && usb->idx == 0 &&
+            (usb->model == -1 ||
+             usb->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI)) {
             VIR_DEBUG("Removing default USB controller from domain '%s'"
                       " for migration compatibility", def->name);
             toremove++;