If the QEMU_CAPS_DEVICE is set, then ensure the host device alias has
been properly set before making the calls to detach the device
virDomainObjPtr vm,
virDomainHostdevDefPtr detach)
{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
+ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+ !detach->info->alias) {
+ if (qemuAssignDeviceHostdevAlias(vm->def, detach, -1) < 0)
+ return -1;
+ }
+
switch (detach->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
ret = qemuDomainDetachHostPCIDevice(driver, vm, detach);