qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainDetachNetDevice

This commit is contained in:
Peter Krempa 2016-04-26 15:09:49 +02:00
parent 78bb0df8c9
commit b956512f6c

View File

@ -3896,8 +3896,7 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
} }
} }
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && if (!detach->info.alias) {
!detach->info.alias) {
if (qemuAssignDeviceNetAlias(vm->def, detach, -1) < 0) if (qemuAssignDeviceNetAlias(vm->def, detach, -1) < 0)
goto cleanup; goto cleanup;
} }
@ -3917,22 +3916,12 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
qemuDomainMarkDeviceForRemoval(vm, &detach->info); qemuDomainMarkDeviceForRemoval(vm, &detach->info);
qemuDomainObjEnterMonitor(driver, vm); qemuDomainObjEnterMonitor(driver, vm);
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) { if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
if (qemuDomainObjExitMonitor(driver, vm) < 0) if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup; goto cleanup;
virDomainAuditNet(vm, detach, NULL, "detach", false); virDomainAuditNet(vm, detach, NULL, "detach", false);
goto cleanup; goto cleanup;
} }
} else {
if (qemuMonitorRemovePCIDevice(priv->mon,
&detach->info.addr.pci) < 0) {
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup;
virDomainAuditNet(vm, detach, NULL, "detach", false);
goto cleanup;
}
}
if (qemuDomainObjExitMonitor(driver, vm) < 0) if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup; goto cleanup;