提交 b473b583 编写于 作者: C Chunyan Liu 提交者: Daniel P. Berrange

extract general code from qemuDomainReAttachHostScsiDevices

Extract general code from qemuDomainReAttachHostScsiDevices to
virHostdevDomainReAttachHostScsiDevices.
上级 2d961cf3
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册