1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

conf: Add missing validate for fchost search fields

Commit id 'bb74a7ffe' added some new fields to search for a fchost by
parent wwnn/wwpn or parent_fabric_name, but neglected to validate that
the data within the fields was valid at parse time. This could lead to
eventual failure at run time, so rather than have the failure then, let's
validate now.

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2017-03-10 10:04:20 -05:00
parent d21fc70938
commit 2077ea849b

View File

@ -960,6 +960,18 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
goto error;
}
if (ret->source.adapter.data.fchost.parent_wwnn &&
!virValidateWWN(ret->source.adapter.data.fchost.parent_wwnn))
goto error;
if (ret->source.adapter.data.fchost.parent_wwpn &&
!virValidateWWN(ret->source.adapter.data.fchost.parent_wwpn))
goto error;
if (ret->source.adapter.data.fchost.parent_fabric_wwn &&
!virValidateWWN(ret->source.adapter.data.fchost.parent_fabric_wwn))
goto error;
} else if (ret->source.adapter.type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
if (!ret->source.adapter.data.scsi_host.name &&