mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-08 22:39:56 +00:00
pass driver_name as parameter of virHostdevUpdate*Hostdevs functions
This commit is contained in:
parent
e57f929dc1
commit
d44a20470e
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virHostdevUpdateActivePciHostdevs(virHostdevManagerPtr mgr,
|
virHostdevUpdateActivePciHostdevs(virHostdevManagerPtr mgr,
|
||||||
|
const char *drv_name,
|
||||||
virDomainDefPtr def)
|
virDomainDefPtr def)
|
||||||
{
|
{
|
||||||
virDomainHostdevDefPtr hostdev = NULL;
|
virDomainHostdevDefPtr hostdev = NULL;
|
||||||
@ -79,7 +80,7 @@ virHostdevUpdateActivePciHostdevs(virHostdevManagerPtr mgr,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
}
|
}
|
||||||
virPCIDeviceSetUsedBy(dev, QEMU_DRIVER_NAME, def->name);
|
virPCIDeviceSetUsedBy(dev, drv_name, def->name);
|
||||||
|
|
||||||
/* Setup the original states for the PCI device */
|
/* Setup the original states for the PCI device */
|
||||||
virPCIDeviceSetUnbindFromStub(dev, hostdev->origstates.states.pci.unbind_from_stub);
|
virPCIDeviceSetUnbindFromStub(dev, hostdev->origstates.states.pci.unbind_from_stub);
|
||||||
@ -108,11 +109,12 @@ qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver,
|
|||||||
if (!def->nhostdevs)
|
if (!def->nhostdevs)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return virHostdevUpdateActivePciHostdevs(mgr, def);
|
return virHostdevUpdateActivePciHostdevs(mgr, QEMU_DRIVER_NAME, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virHostdevUpdateActiveUsbHostdevs(virHostdevManagerPtr mgr,
|
virHostdevUpdateActiveUsbHostdevs(virHostdevManagerPtr mgr,
|
||||||
|
const char *drv_name,
|
||||||
virDomainDefPtr def)
|
virDomainDefPtr def)
|
||||||
{
|
{
|
||||||
virDomainHostdevDefPtr hostdev = NULL;
|
virDomainHostdevDefPtr hostdev = NULL;
|
||||||
@ -140,7 +142,7 @@ virHostdevUpdateActiveUsbHostdevs(virHostdevManagerPtr mgr,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
virUSBDeviceSetUsedBy(usb, QEMU_DRIVER_NAME, def->name);
|
virUSBDeviceSetUsedBy(usb, drv_name, def->name);
|
||||||
|
|
||||||
if (virUSBDeviceListAdd(mgr->activeUsbHostdevs, usb) < 0) {
|
if (virUSBDeviceListAdd(mgr->activeUsbHostdevs, usb) < 0) {
|
||||||
virUSBDeviceFree(usb);
|
virUSBDeviceFree(usb);
|
||||||
@ -162,11 +164,12 @@ qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver,
|
|||||||
if (!def->nhostdevs)
|
if (!def->nhostdevs)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return virHostdevUpdateActiveUsbHostdevs(mgr, def);
|
return virHostdevUpdateActiveUsbHostdevs(mgr, QEMU_DRIVER_NAME, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virHostdevUpdateActiveScsiHostdevs(virHostdevManagerPtr mgr,
|
virHostdevUpdateActiveScsiHostdevs(virHostdevManagerPtr mgr,
|
||||||
|
const char *drv_name,
|
||||||
virDomainDefPtr def)
|
virDomainDefPtr def)
|
||||||
{
|
{
|
||||||
virDomainHostdevDefPtr hostdev = NULL;
|
virDomainHostdevDefPtr hostdev = NULL;
|
||||||
@ -193,13 +196,13 @@ virHostdevUpdateActiveScsiHostdevs(virHostdevManagerPtr mgr,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((tmp = virSCSIDeviceListFind(mgr->activeScsiHostdevs, scsi))) {
|
if ((tmp = virSCSIDeviceListFind(mgr->activeScsiHostdevs, scsi))) {
|
||||||
if (virSCSIDeviceSetUsedBy(tmp, QEMU_DRIVER_NAME, def->name) < 0) {
|
if (virSCSIDeviceSetUsedBy(tmp, drv_name, def->name) < 0) {
|
||||||
virSCSIDeviceFree(scsi);
|
virSCSIDeviceFree(scsi);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
virSCSIDeviceFree(scsi);
|
virSCSIDeviceFree(scsi);
|
||||||
} else {
|
} else {
|
||||||
if (virSCSIDeviceSetUsedBy(scsi, QEMU_DRIVER_NAME, def->name) < 0 ||
|
if (virSCSIDeviceSetUsedBy(scsi, drv_name, def->name) < 0 ||
|
||||||
virSCSIDeviceListAdd(mgr->activeScsiHostdevs, scsi) < 0) {
|
virSCSIDeviceListAdd(mgr->activeScsiHostdevs, scsi) < 0) {
|
||||||
virSCSIDeviceFree(scsi);
|
virSCSIDeviceFree(scsi);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -222,7 +225,7 @@ qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver,
|
|||||||
if (!def->nhostdevs)
|
if (!def->nhostdevs)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return virHostdevUpdateActiveScsiHostdevs(mgr, def);
|
return virHostdevUpdateActiveScsiHostdevs(mgr, QEMU_DRIVER_NAME, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user