From: Michal Privoznik Date: Fri, 14 Apr 2023 10:43:47 +0000 (+0200) Subject: qemuDomainAttachHostDevice: Prepare device early and for all types X-Git-Tag: v9.3.0-rc1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f7039f9e8fae8f43b69f83b80c58866f0507b89;p=thirdparty%2Flibvirt.git qemuDomainAttachHostDevice: Prepare device early and for all types 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 Reviewed-by: Martin Kletzander --- diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 9273f58559..d4cded15e7 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -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,