mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +00:00
qemu: Separate controller removal into a standalone function
This commit is contained in:
parent
a22ae222ee
commit
92758a71d8
@ -2267,6 +2267,28 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
qemuDomainRemoveControllerDevice(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||||
|
virDomainObjPtr vm,
|
||||||
|
virDomainControllerDefPtr controller)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
VIR_DEBUG("Removing controller %s from domain %p %s",
|
||||||
|
controller->info.alias, vm, vm->def->name);
|
||||||
|
|
||||||
|
for (i = 0; i < vm->def->ncontrollers; i++) {
|
||||||
|
if (vm->def->controllers[i] == controller) {
|
||||||
|
virDomainControllerRemove(vm->def, i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qemuDomainReleaseDeviceAddress(vm, &controller->info, NULL);
|
||||||
|
virDomainControllerDefFree(controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
|
int qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
virDomainDiskDefPtr detach)
|
virDomainDiskDefPtr detach)
|
||||||
@ -2492,9 +2514,7 @@ int qemuDomainDetachPciControllerDevice(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
qemuDomainObjExitMonitor(driver, vm);
|
qemuDomainObjExitMonitor(driver, vm);
|
||||||
|
|
||||||
virDomainControllerRemove(vm->def, idx);
|
qemuDomainRemoveControllerDevice(driver, vm, detach);
|
||||||
qemuDomainReleaseDeviceAddress(vm, &detach->info, NULL);
|
|
||||||
virDomainControllerDefFree(detach);
|
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user