]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuDomainAttachHostDevice: Prepare device early and for all types
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 14 Apr 2023 10:43:47 +0000 (12:43 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 25 Apr 2023 10:36:30 +0000 (12:36 +0200)
When attaching a hostdev of a SCSI subsys,
qemuDomainPrepareHostdev() is called. This makes sense because
the function prepares just SCSI hostdevs ignoring others. But
this will soon change. Thefore, move the function call out of
qemuDomainAttachHostSCSIDevice() and into
qemuDomainAttachHostDevice().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_hotplug.c

index 9273f58559e5dadcfe065681a6d001714ce4c445..d4cded15e79194051dc2d3cf9de2e9d867f34bf5 100644 (file)
@@ -2503,9 +2503,6 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriver *driver,
 
     qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1);
 
-    if (qemuDomainPrepareHostdev(hostdev, priv) < 0)
-        goto cleanup;
-
     if (qemuProcessPrepareHostHostdev(hostdev) < 0)
         goto cleanup;
 
@@ -2787,6 +2784,9 @@ qemuDomainAttachHostDevice(virQEMUDriver *driver,
         return -1;
     }
 
+    if (qemuDomainPrepareHostdev(hostdev, vm->privateData) < 0)
+        return -1;
+
     switch (hostdev->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
         if (qemuDomainAttachHostPCIDevice(driver, vm,