mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
extract general code from qemuDomainReAttachHostScsiDevices
Extract general code from qemuDomainReAttachHostScsiDevices to virHostdevDomainReAttachHostScsiDevices.
This commit is contained in:
parent
2d961cf3ba
commit
b473b58344
@ -328,27 +328,19 @@ qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver,
|
||||
name, hostdevs, nhostdevs);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
virDomainHostdevDefPtr *hostdevs,
|
||||
int nhostdevs)
|
||||
static void
|
||||
virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
|
||||
const char *name,
|
||||
virDomainHostdevDefPtr *hostdevs,
|
||||
int nhostdevs)
|
||||
{
|
||||
size_t i;
|
||||
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
|
||||
|
||||
virObjectLock(hostdev_mgr->activeScsiHostdevs);
|
||||
for (i = 0; i < nhostdevs; i++) {
|
||||
virDomainHostdevDefPtr hostdev = hostdevs[i];
|
||||
virSCSIDevicePtr scsi;
|
||||
virSCSIDevicePtr tmp;
|
||||
virDomainDeviceDef dev;
|
||||
|
||||
dev.type = VIR_DOMAIN_DEVICE_HOSTDEV;
|
||||
dev.data.hostdev = hostdev;
|
||||
|
||||
ignore_value(qemuRemoveSharedDevice(driver, &dev, name));
|
||||
|
||||
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
|
||||
hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)
|
||||
@ -397,6 +389,28 @@ qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver,
|
||||
virObjectUnlock(hostdev_mgr->activeScsiHostdevs);
|
||||
}
|
||||
|
||||
void
|
||||
qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
virDomainHostdevDefPtr *hostdevs,
|
||||
int nhostdevs)
|
||||
{
|
||||
size_t i;
|
||||
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
|
||||
|
||||
for (i = 0; i < nhostdevs; i++) {
|
||||
virDomainHostdevDefPtr hostdev = hostdevs[i];
|
||||
virDomainDeviceDef dev;
|
||||
|
||||
dev.type = VIR_DOMAIN_DEVICE_HOSTDEV;
|
||||
dev.data.hostdev = hostdev;
|
||||
|
||||
ignore_value(qemuRemoveSharedDevice(driver, &dev, name));
|
||||
}
|
||||
|
||||
virHostdevReAttachScsiHostdevs(hostdev_mgr, name, hostdevs, nhostdevs);
|
||||
}
|
||||
|
||||
void
|
||||
qemuDomainReAttachHostDevices(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def)
|
||||
|
Loading…
Reference in New Issue
Block a user