提交 78be2e8b 编写于 作者: J John Ferlan

iscsi: Add parent wwnn/wwpn or fabric capability for createVport

https://bugzilla.redhat.com/show_bug.cgi?id=1349696

As it turns out using only the 'parent' to achieve the goal of a
consistent vHBA parent has issues with reboots where the scsi_hostX
parent could change to scsi_hostY causing either failure to create
the vHBA or usage of the wrong HBA for our vHBA.

Thus add the ability to search for the "parent" by the parent wwnn/
wwpn values or just a fabric_name if someone only cares to ensure
usage of the same SAN for the vHBA.
上级 8366cb0a
...@@ -695,6 +695,7 @@ createVport(virConnectPtr conn, ...@@ -695,6 +695,7 @@ createVport(virConnectPtr conn,
unsigned int parent_host; unsigned int parent_host;
char *name = NULL; char *name = NULL;
char *parent_hoststr = NULL; char *parent_hoststr = NULL;
bool skip_capable_check = false;
virStoragePoolFCRefreshInfoPtr cbdata = NULL; virStoragePoolFCRefreshInfoPtr cbdata = NULL;
virThread thread; virThread thread;
int ret = -1; int ret = -1;
...@@ -725,6 +726,23 @@ createVport(virConnectPtr conn, ...@@ -725,6 +726,23 @@ createVport(virConnectPtr conn,
if (adapter->data.fchost.parent) { if (adapter->data.fchost.parent) {
if (VIR_STRDUP(parent_hoststr, adapter->data.fchost.parent) < 0) if (VIR_STRDUP(parent_hoststr, adapter->data.fchost.parent) < 0)
goto cleanup; goto cleanup;
} else if (adapter->data.fchost.parent_wwnn &&
adapter->data.fchost.parent_wwpn) {
if (!(parent_hoststr =
virGetFCHostNameByWWN(NULL, adapter->data.fchost.parent_wwnn,
adapter->data.fchost.parent_wwpn))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("cannot find parent using provided wwnn/wwpn"));
goto cleanup;
}
} else if (adapter->data.fchost.parent_fabric_wwn) {
if (!(parent_hoststr =
virGetFCHostNameByFabricWWN(NULL,
adapter->data.fchost.parent_fabric_wwn))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("cannot find parent using provided fabric_wwn"));
goto cleanup;
}
} else { } else {
if (!(parent_hoststr = virFindFCHostCapableVport(NULL))) { if (!(parent_hoststr = virFindFCHostCapableVport(NULL))) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
...@@ -732,6 +750,7 @@ createVport(virConnectPtr conn, ...@@ -732,6 +750,7 @@ createVport(virConnectPtr conn,
"cannot find one on this host")); "cannot find one on this host"));
goto cleanup; goto cleanup;
} }
skip_capable_check = true;
} }
if (virGetSCSIHostNumber(parent_hoststr, &parent_host) < 0) if (virGetSCSIHostNumber(parent_hoststr, &parent_host) < 0)
...@@ -745,7 +764,7 @@ createVport(virConnectPtr conn, ...@@ -745,7 +764,7 @@ createVport(virConnectPtr conn,
* parent. Besides we have a way to determine the parent based on * parent. Besides we have a way to determine the parent based on
* the 'name' field. * the 'name' field.
*/ */
if (adapter->data.fchost.parent && !virIsCapableFCHost(NULL, parent_host)) { if (!skip_capable_check && !virIsCapableFCHost(NULL, parent_host)) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
_("parent '%s' specified for vHBA is not vport capable"), _("parent '%s' specified for vHBA is not vport capable"),
parent_hoststr); parent_hoststr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册