[PATCH v2 1/9] qemuDomainAttachHostDevice: Prepare device early and for all types

Michal Privoznik posted 9 patches 2 years, 9 months ago
[PATCH v2 1/9] qemuDomainAttachHostDevice: Prepare device early and for all types
Posted by Michal Privoznik 2 years, 9 months ago
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>
---
 src/qemu/qemu_hotplug.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 53a0874556..64c62ea114 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2485,9 +2485,6 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriver *driver,
 
     qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1);
 
-    if (qemuDomainPrepareHostdev(hostdev, priv) < 0)
-        goto cleanup;
-
     if (qemuProcessPrepareHostHostdev(hostdev) < 0)
         goto cleanup;
 
@@ -2769,6 +2766,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,
-- 
2.39.2
Re: [PATCH v2 1/9] qemuDomainAttachHostDevice: Prepare device early and for all types
Posted by Martin Kletzander 2 years, 9 months ago
On Mon, Apr 24, 2023 at 12:41:40PM +0200, Michal Privoznik wrote:
>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>