提交 5805621c 编写于 作者: J John Ferlan

hostdev: Introduce virDomainHostdevSubsysSCSI

Create a separate typedef for the hostdev union data describing SCSI
Then adjust the code to use the new pointer
上级 1c8da0d4
......@@ -390,6 +390,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
const char *virt;
virDomainHostdevSubsysUSBPtr usbsrc = &hostdev->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &hostdev->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
virUUIDFormat(vm->def->uuid, uuidstr);
if (!(vmname = virAuditEncode("vm", vm->def->name))) {
......@@ -424,10 +425,8 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
if (virAsprintfQuiet(&address, "%s:%d:%d:%d",
hostdev->source.subsys.u.scsi.adapter,
hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit) < 0) {
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit) < 0) {
VIR_WARN("OOM while encoding audit message");
goto cleanup;
}
......
......@@ -4018,6 +4018,7 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr node,
bool got_address = false, got_adapter = false;
xmlNodePtr cur;
char *bus = NULL, *target = NULL, *unit = NULL;
virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
cur = node->children;
while (cur != NULL) {
......@@ -4039,19 +4040,19 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr node,
goto cleanup;
}
if (virStrToLong_ui(bus, NULL, 0, &def->source.subsys.u.scsi.bus) < 0) {
if (virStrToLong_ui(bus, NULL, 0, &scsisrc->bus) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse bus '%s'"), bus);
goto cleanup;
}
if (virStrToLong_ui(target, NULL, 0, &def->source.subsys.u.scsi.target) < 0) {
if (virStrToLong_ui(target, NULL, 0, &scsisrc->target) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse target '%s'"), target);
goto cleanup;
}
if (virStrToLong_ui(unit, NULL, 0, &def->source.subsys.u.scsi.unit) < 0) {
if (virStrToLong_ui(unit, NULL, 0, &scsisrc->unit) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse unit '%s'"), unit);
goto cleanup;
......@@ -4065,8 +4066,7 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr node,
"for scsi hostdev source"));
goto cleanup;
}
if (!(def->source.subsys.u.scsi.adapter =
virXMLPropString(cur, "name"))) {
if (!(scsisrc->adapter = virXMLPropString(cur, "name"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("'adapter' must be specified for scsi hostdev source"));
goto cleanup;
......@@ -4247,6 +4247,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
int backend;
int ret = -1;
virDomainHostdevSubsysPCIPtr pcisrc = &def->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
/* @managed can be read from the xml document - it is always an
* attribute of the toplevel element, no matter what type of
......@@ -4304,8 +4305,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
goto error;
}
if ((def->source.subsys.u.scsi.sgio =
virDomainDeviceSGIOTypeFromString(sgio)) <= 0) {
if ((scsisrc->sgio = virDomainDeviceSGIOTypeFromString(sgio)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown sgio mode '%s'"), sgio);
goto error;
......@@ -10231,13 +10231,17 @@ virDomainHostdevMatchSubsysPCI(virDomainHostdevDefPtr first,
}
static int
virDomainHostdevMatchSubsysSCSI(virDomainHostdevDefPtr a,
virDomainHostdevDefPtr b)
virDomainHostdevMatchSubsysSCSI(virDomainHostdevDefPtr first,
virDomainHostdevDefPtr second)
{
if (STREQ(a->source.subsys.u.scsi.adapter, b->source.subsys.u.scsi.adapter) &&
a->source.subsys.u.scsi.bus == b->source.subsys.u.scsi.bus &&
a->source.subsys.u.scsi.target == b->source.subsys.u.scsi.target &&
a->source.subsys.u.scsi.unit == b->source.subsys.u.scsi.unit)
virDomainHostdevSubsysSCSIPtr first_scsisrc = &first->source.subsys.u.scsi;
virDomainHostdevSubsysSCSIPtr second_scsisrc =
&second->source.subsys.u.scsi;
if (STREQ(first_scsisrc->adapter, second_scsisrc->adapter) &&
first_scsisrc->bus == second_scsisrc->bus &&
first_scsisrc->target == second_scsisrc->target &&
first_scsisrc->unit == second_scsisrc->unit)
return 1;
return 0;
}
......@@ -15521,6 +15525,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
{
virDomainHostdevSubsysUSBPtr usbsrc = &def->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &def->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
pcisrc->backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
......@@ -15589,12 +15594,10 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
virBufferAsprintf(buf, "<adapter name='%s'/>\n",
def->source.subsys.u.scsi.adapter);
scsisrc->adapter);
virBufferAsprintf(buf, "<address %sbus='%d' target='%d' unit='%d'/>\n",
includeTypeInAddr ? "type='scsi' " : "",
def->source.subsys.u.scsi.bus,
def->source.subsys.u.scsi.target,
def->source.subsys.u.scsi.unit);
scsisrc->bus, scsisrc->target, scsisrc->unit);
break;
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
......@@ -17012,6 +17015,7 @@ virDomainHostdevDefFormat(virBufferPtr buf,
unsigned int flags)
{
const char *mode = virDomainHostdevModeTypeToString(def->mode);
virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
const char *type;
if (!mode) {
......@@ -17051,11 +17055,10 @@ virDomainHostdevDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " managed='%s'",
def->managed ? "yes" : "no");
if (def->source.subsys.type ==
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
def->source.subsys.u.scsi.sgio)
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
scsisrc->sgio)
virBufferAsprintf(buf, " sgio='%s'",
virDomainDeviceSGIOTypeToString(def->source.subsys.u.scsi.sgio));
virDomainDeviceSGIOTypeToString(scsisrc->sgio));
}
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
......
......@@ -407,6 +407,16 @@ struct _virDomainHostdevSubsysPCI {
int backend; /* enum virDomainHostdevSubsysPCIBackendType */
};
typedef struct _virDomainHostdevSubsysSCSI virDomainHostdevSubsysSCSI;
typedef virDomainHostdevSubsysSCSI *virDomainHostdevSubsysSCSIPtr;
struct _virDomainHostdevSubsysSCSI {
char *adapter;
unsigned bus;
unsigned target;
unsigned unit;
int sgio; /* enum virDomainDeviceSGIO */
};
typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys;
typedef virDomainHostdevSubsys *virDomainHostdevSubsysPtr;
struct _virDomainHostdevSubsys {
......@@ -414,13 +424,7 @@ struct _virDomainHostdevSubsys {
union {
virDomainHostdevSubsysUSB usb;
virDomainHostdevSubsysPCI pci;
struct {
char *adapter;
unsigned bus;
unsigned target;
unsigned unit;
int sgio; /* enum virDomainDeviceSGIO */
} scsi;
virDomainHostdevSubsysSCSI scsi;
} u;
};
......
......@@ -244,6 +244,7 @@ qemuSetupHostdevCGroup(virDomainObjPtr vm,
qemuDomainObjPrivatePtr priv = vm->privateData;
virDomainHostdevSubsysUSBPtr usbsrc = &dev->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &dev->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
virPCIDevicePtr pci = NULL;
virUSBDevicePtr usb = NULL;
virSCSIDevicePtr scsi = NULL;
......@@ -307,10 +308,8 @@ qemuSetupHostdevCGroup(virDomainObjPtr vm,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
if ((scsi = virSCSIDeviceNew(NULL,
dev->source.subsys.u.scsi.adapter,
dev->source.subsys.u.scsi.bus,
dev->source.subsys.u.scsi.target,
dev->source.subsys.u.scsi.unit,
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit,
dev->readonly,
dev->shareable)) == NULL)
goto cleanup;
......
......@@ -5130,13 +5130,12 @@ qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
qemuBuildCommandLineCallbacksPtr callbacks)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
char *sg = NULL;
sg = (callbacks->qemuGetSCSIDeviceSgName)(NULL,
dev->source.subsys.u.scsi.adapter,
dev->source.subsys.u.scsi.bus,
dev->source.subsys.u.scsi.target,
dev->source.subsys.u.scsi.unit);
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit);
if (!sg)
goto error;
......
......@@ -927,11 +927,12 @@ qemuAddSharedDevice(virQEMUDriverPtr driver,
if (!(key = qemuGetSharedDeviceKey(virDomainDiskGetSource(disk))))
goto cleanup;
} else {
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
if (!(dev_name = virSCSIDeviceGetDevName(NULL,
hostdev->source.subsys.u.scsi.adapter,
hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit)))
scsisrc->adapter,
scsisrc->bus,
scsisrc->target,
scsisrc->unit)))
goto cleanup;
if (virAsprintf(&dev_path, "/dev/%s", dev_name) < 0)
......@@ -1032,11 +1033,12 @@ qemuRemoveSharedDevice(virQEMUDriverPtr driver,
if (!(key = qemuGetSharedDeviceKey(virDomainDiskGetSource(disk))))
goto cleanup;
} else {
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
if (!(dev_name = virSCSIDeviceGetDevName(NULL,
hostdev->source.subsys.u.scsi.adapter,
hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit)))
scsisrc->adapter,
scsisrc->bus,
scsisrc->target,
scsisrc->unit)))
goto cleanup;
if (virAsprintf(&dev_path, "/dev/%s", dev_name) < 0)
......
......@@ -1573,12 +1573,11 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver,
if (qemuPrepareHostdevSCSIDevices(driver, vm->def->name,
&hostdev, 1)) {
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to prepare scsi hostdev: %s:%d:%d:%d"),
hostdev->source.subsys.u.scsi.adapter,
hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit);
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit);
return -1;
}
......@@ -3362,6 +3361,7 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
virDomainHostdevSubsysPtr subsys = &hostdev->source.subsys;
virDomainHostdevSubsysUSBPtr usbsrc = &subsys->u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &subsys->u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &subsys->u.scsi;
virDomainHostdevDefPtr detach = NULL;
int idx;
......@@ -3396,8 +3396,8 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
virReportError(VIR_ERR_OPERATION_FAILED,
_("host scsi device %s:%d:%d.%d not found"),
subsys->u.scsi.adapter, subsys->u.scsi.bus,
subsys->u.scsi.target, subsys->u.scsi.unit);
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit);
break;
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
......
......@@ -814,6 +814,7 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
virDomainHostdevSubsysUSBPtr usbsrc = &dev->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &dev->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
if (!secdef)
return -1;
......@@ -871,12 +872,9 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
virSCSIDevicePtr scsi =
virSCSIDeviceNew(NULL,
dev->source.subsys.u.scsi.adapter,
dev->source.subsys.u.scsi.bus,
dev->source.subsys.u.scsi.target,
dev->source.subsys.u.scsi.unit,
dev->readonly,
dev->shareable);
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit,
dev->readonly, dev->shareable);
if (!scsi)
goto done;
......
......@@ -511,6 +511,7 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
virSecurityDACCallbackData cbdata;
virDomainHostdevSubsysUSBPtr usbsrc = &dev->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &dev->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
int ret = -1;
if (!priv->dynamicOwnership)
......@@ -572,12 +573,9 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
virSCSIDevicePtr scsi =
virSCSIDeviceNew(NULL,
dev->source.subsys.u.scsi.adapter,
dev->source.subsys.u.scsi.bus,
dev->source.subsys.u.scsi.target,
dev->source.subsys.u.scsi.unit,
dev->readonly,
dev->shareable);
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit,
dev->readonly, dev->shareable);
if (!scsi)
goto done;
......@@ -638,6 +636,7 @@ virSecurityDACRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr,
virSecurityLabelDefPtr secdef;
virDomainHostdevSubsysUSBPtr usbsrc = &dev->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &dev->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
int ret = -1;
secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAME);
......@@ -691,12 +690,9 @@ virSecurityDACRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
virSCSIDevicePtr scsi =
virSCSIDeviceNew(NULL,
dev->source.subsys.u.scsi.adapter,
dev->source.subsys.u.scsi.bus,
dev->source.subsys.u.scsi.target,
dev->source.subsys.u.scsi.unit,
dev->readonly,
dev->shareable);
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit,
dev->readonly, dev->shareable);
if (!scsi)
goto done;
......
......@@ -1321,6 +1321,7 @@ virSecuritySELinuxSetSecurityHostdevSubsysLabel(virDomainDefPtr def,
{
virDomainHostdevSubsysUSBPtr usbsrc = &dev->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &dev->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
int ret = -1;
switch (dev->source.subsys.type) {
......@@ -1368,12 +1369,9 @@ virSecuritySELinuxSetSecurityHostdevSubsysLabel(virDomainDefPtr def,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
virSCSIDevicePtr scsi =
virSCSIDeviceNew(NULL,
dev->source.subsys.u.scsi.adapter,
dev->source.subsys.u.scsi.bus,
dev->source.subsys.u.scsi.target,
dev->source.subsys.u.scsi.unit,
dev->readonly,
dev->shareable);
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit,
dev->readonly, dev->shareable);
if (!scsi)
goto done;
......@@ -1509,6 +1507,7 @@ virSecuritySELinuxRestoreSecurityHostdevSubsysLabel(virSecurityManagerPtr mgr,
{
virDomainHostdevSubsysUSBPtr usbsrc = &dev->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &dev->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
int ret = -1;
switch (dev->source.subsys.type) {
......@@ -1557,12 +1556,9 @@ virSecuritySELinuxRestoreSecurityHostdevSubsysLabel(virSecurityManagerPtr mgr,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
virSCSIDevicePtr scsi =
virSCSIDeviceNew(NULL,
dev->source.subsys.u.scsi.adapter,
dev->source.subsys.u.scsi.bus,
dev->source.subsys.u.scsi.target,
dev->source.subsys.u.scsi.unit,
dev->readonly,
dev->shareable);
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit,
dev->readonly, dev->shareable);
if (!scsi)
goto done;
......
......@@ -938,19 +938,18 @@ virHostdevUpdateActiveSCSIDevices(virHostdevManagerPtr mgr,
virObjectLock(mgr->activeSCSIHostdevs);
for (i = 0; i < nhostdevs; i++) {
virDomainHostdevSubsysSCSIPtr scsisrc;
hostdev = hostdevs[i];
scsisrc = &hostdev->source.subsys.u.scsi;
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)
continue;
if (!(scsi = virSCSIDeviceNew(NULL,
hostdev->source.subsys.u.scsi.adapter,
hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit,
hostdev->readonly,
hostdev->shareable)))
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit,
hostdev->readonly, hostdev->shareable)))
goto cleanup;
if ((tmp = virSCSIDeviceListFind(mgr->activeSCSIHostdevs, scsi))) {
......@@ -1220,6 +1219,8 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
/* Loop 1: build temporary list */
for (i = 0; i < nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = hostdevs[i];
virDomainHostdevSubsysSCSIPtr scsisrc =
&hostdev->source.subsys.u.scsi;
virSCSIDevicePtr scsi;
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
......@@ -1233,12 +1234,9 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
}
if (!(scsi = virSCSIDeviceNew(NULL,
hostdev->source.subsys.u.scsi.adapter,
hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit,
hostdev->readonly,
hostdev->shareable)))
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit,
hostdev->readonly, hostdev->shareable)))
goto cleanup;
if (scsi && virSCSIDeviceListAdd(list, scsi) < 0) {
......@@ -1383,6 +1381,8 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr hostdev_mgr,
virObjectLock(hostdev_mgr->activeSCSIHostdevs);
for (i = 0; i < nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = hostdevs[i];
virDomainHostdevSubsysSCSIPtr scsisrc =
&hostdev->source.subsys.u.scsi;
virSCSIDevicePtr scsi;
virSCSIDevicePtr tmp;
......@@ -1391,18 +1391,12 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr hostdev_mgr,
continue;
if (!(scsi = virSCSIDeviceNew(NULL,
hostdev->source.subsys.u.scsi.adapter,
hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit,
hostdev->readonly,
hostdev->shareable))) {
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit,
hostdev->readonly, hostdev->shareable))) {
VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%d on domain %s",
hostdev->source.subsys.u.scsi.adapter,
hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit,
dom_name);
scsisrc->adapter, scsisrc->bus, scsisrc->target,
scsisrc->unit, dom_name);
continue;
}
......@@ -1412,20 +1406,15 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr hostdev_mgr,
if (!(tmp = virSCSIDeviceListFind(hostdev_mgr->activeSCSIHostdevs, scsi))) {
VIR_WARN("Unable to find device %s:%d:%d:%d "
"in list of active SCSI devices",
hostdev->source.subsys.u.scsi.adapter,
hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit);
scsisrc->adapter, scsisrc->bus,
scsisrc->target, scsisrc->unit);
virSCSIDeviceFree(scsi);
continue;
}
VIR_DEBUG("Removing %s:%d:%d:%d dom=%s from activeSCSIHostdevs",
hostdev->source.subsys.u.scsi.adapter,
hostdev->source.subsys.u.scsi.bus,
hostdev->source.subsys.u.scsi.target,
hostdev->source.subsys.u.scsi.unit,
dom_name);
scsisrc->adapter, scsisrc->bus, scsisrc->target,
scsisrc->unit, dom_name);
virSCSIDeviceListDel(hostdev_mgr->activeSCSIHostdevs, tmp,
drv_name, dom_name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册