]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Ensure both parent_wwnn/parent_wwpn provided
authorJohn Ferlan <jferlan@redhat.com>
Fri, 10 Mar 2017 15:29:32 +0000 (10:29 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 16 Mar 2017 01:17:47 +0000 (21:17 -0400)
https://bugzilla.redhat.com/show_bug.cgi?id=1428209

Commit id 'bb74a7ffe' neglected to check that both the parent_wwnn
parent_wwpn are in the XML if one or the other is similar to how
the node device code checked (commit id '2b13361bc').

If only one is provided, the "default" is to use a vHBA capable
adapter (see commit id '78be2e8b'), so the vHBA could start, but
perhaps not on the expected adapter.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/conf/storage_conf.c

index 3cfaf2b9bc7679a826ede857a2d0946240b6717d..68def65bf9e7a36f68a8f38fd442606f5d66635f 100644 (file)
@@ -941,6 +941,25 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
             if (!virValidateWWN(ret->source.adapter.data.fchost.wwnn) ||
                 !virValidateWWN(ret->source.adapter.data.fchost.wwpn))
                 goto error;
+
+            if ((ret->source.adapter.data.fchost.parent_wwnn &&
+                 !ret->source.adapter.data.fchost.parent_wwpn)) {
+                virReportError(VIR_ERR_XML_ERROR,
+                               _("when providing parent_wwnn='%s', the "
+                                 "parent_wwpn must also be provided"),
+                               ret->source.adapter.data.fchost.parent_wwnn);
+                goto error;
+            }
+
+            if (!ret->source.adapter.data.fchost.parent_wwnn &&
+                 ret->source.adapter.data.fchost.parent_wwpn) {
+                virReportError(VIR_ERR_XML_ERROR,
+                               _("when providing parent_wwpn='%s', the "
+                                 "parent_wwnn must also be provided"),
+                               ret->source.adapter.data.fchost.parent_wwpn);
+                goto error;
+            }
+
         } else if (ret->source.adapter.type ==
                    VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
             if (!ret->source.adapter.data.scsi_host.name &&