Add new fields to the fchost structure to allow creation of a vHBA via
the storage pool when a parent_wwnn/parent_wwpn or parent_fabric_wwn is
supplied in the storage pool XML.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
docs/schemas/basictypes.rng | 15 +++++++++++++++
src/conf/storage_conf.c | 21 +++++++++++++++++++--
src/conf/storage_conf.h | 3 +++
3 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index 1b4f980..cc560e6 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -427,6 +427,21 @@
<ref name="virYesNo"/>
</attribute>
</optional>
+ <optional>
+ <attribute name='parent_wwnn'>
+ <ref name='wwn'/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name='parent_wwpn'>
+ <ref name='wwn'/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name='parent_fabric_wwn'>
+ <ref name='wwn'/>
+ </attribute>
+ </optional>
<attribute name='wwnn'>
<ref name='wwn'/>
</attribute>
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7e7bb72..25fb983 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -335,6 +335,9 @@ virStoragePoolSourceAdapterClear(virStoragePoolSourceAdapterPtr
adapter)
VIR_FREE(adapter->data.fchost.wwnn);
VIR_FREE(adapter->data.fchost.wwpn);
VIR_FREE(adapter->data.fchost.parent);
+ VIR_FREE(adapter->data.fchost.parent_wwnn);
+ VIR_FREE(adapter->data.fchost.parent_wwpn);
+ VIR_FREE(adapter->data.fchost.parent_fabric_wwn);
} else if (adapter->type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
VIR_FREE(adapter->data.scsi_host.name);
@@ -591,10 +594,17 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
}
}
- source->adapter.data.fchost.wwnn =
- virXPathString("string(./adapter/@wwnn)", ctxt);
+ source->adapter.data.fchost.parent_wwnn =
+ virXPathString("string(./adapter/@parent_wwnn)", ctxt);
+ source->adapter.data.fchost.parent_wwpn =
+ virXPathString("string(./adapter/@parent_wwpn)", ctxt);
+ source->adapter.data.fchost.parent_fabric_wwn =
+ virXPathString("string(./adapter/@parent_fabric_wwn)", ctxt);
+
source->adapter.data.fchost.wwpn =
virXPathString("string(./adapter/@wwpn)", ctxt);
+ source->adapter.data.fchost.wwnn =
+ virXPathString("string(./adapter/@wwnn)", ctxt);
} else if (source->adapter.type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
@@ -1100,6 +1110,13 @@ virStoragePoolSourceFormat(virBufferPtr buf,
if (src->adapter.data.fchost.managed)
virBufferAsprintf(buf, " managed='%s'",
virTristateBoolTypeToString(src->adapter.data.fchost.managed));
+ virBufferEscapeString(buf, " parent_wwnn='%s'",
+ src->adapter.data.fchost.parent_wwnn);
+ virBufferEscapeString(buf, " parent_wwpn='%s'",
+ src->adapter.data.fchost.parent_wwpn);
+ virBufferEscapeString(buf, " parent_fabric_wwn='%s'",
+ src->adapter.data.fchost.parent_fabric_wwn);
+
virBufferAsprintf(buf, " wwnn='%s'
wwpn='%s'/>\n",
src->adapter.data.fchost.wwnn,
src->adapter.data.fchost.wwpn);
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 185ae5e..b35471d 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -193,6 +193,9 @@ struct _virStoragePoolSourceAdapter {
} scsi_host;
struct {
char *parent;
+ char *parent_wwnn;
+ char *parent_wwpn;
+ char *parent_fabric_wwn;
char *wwnn;
char *wwpn;
int managed; /* enum virTristateSwitch */
--
2.7.4