1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

storage: Check if provided parent is vHBA capable

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

If the parent provided for the storage pool adapter is not vHBA
capable, then issue a configuration error even though the provided
wwnn/wwpn were found.

It is a configuration error to provide a mismatched parent to
the wwnn/wwpn. The @parent is optional and is used as a means to
perform duplicate pool source checks.
This commit is contained in:
John Ferlan 2017-07-20 11:14:46 -04:00
parent 214a353c02
commit f7237d63e8

View File

@ -220,6 +220,7 @@ checkParent(virConnectPtr conn,
const char *name,
const char *parent_name)
{
unsigned int host_num;
char *scsi_host_name = NULL;
char *vhba_parent = NULL;
bool retval = false;
@ -230,6 +231,20 @@ checkParent(virConnectPtr conn,
if (!conn)
return true;
if (virSCSIHostGetNumber(parent_name, &host_num) < 0) {
virReportError(VIR_ERR_XML_ERROR,
_("parent '%s' is not properly formatted"),
parent_name);
goto cleanup;
}
if (!virVHBAPathExists(NULL, host_num)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("parent '%s' is not an fc_host for the wwnn/wwpn"),
parent_name);
goto cleanup;
}
if (virAsprintf(&scsi_host_name, "scsi_%s", name) < 0)
goto cleanup;