conf: Add more fchost search fields for storage pool vHBA creation

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.
This commit is contained in:
John Ferlan 2016-11-17 17:48:35 -05:00
parent 2b13361bc7
commit bb74a7ffeb
3 changed files with 37 additions and 2 deletions

View File

@ -427,6 +427,21 @@
<ref name="virYesNo"/> <ref name="virYesNo"/>
</attribute> </attribute>
</optional> </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'> <attribute name='wwnn'>
<ref name='wwn'/> <ref name='wwn'/>
</attribute> </attribute>

View File

@ -335,6 +335,9 @@ virStoragePoolSourceAdapterClear(virStoragePoolSourceAdapterPtr adapter)
VIR_FREE(adapter->data.fchost.wwnn); VIR_FREE(adapter->data.fchost.wwnn);
VIR_FREE(adapter->data.fchost.wwpn); VIR_FREE(adapter->data.fchost.wwpn);
VIR_FREE(adapter->data.fchost.parent); 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 == } else if (adapter->type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) { VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
VIR_FREE(adapter->data.scsi_host.name); VIR_FREE(adapter->data.scsi_host.name);
@ -591,10 +594,17 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
} }
} }
source->adapter.data.fchost.wwnn = source->adapter.data.fchost.parent_wwnn =
virXPathString("string(./adapter/@wwnn)", ctxt); 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 = source->adapter.data.fchost.wwpn =
virXPathString("string(./adapter/@wwpn)", ctxt); virXPathString("string(./adapter/@wwpn)", ctxt);
source->adapter.data.fchost.wwnn =
virXPathString("string(./adapter/@wwnn)", ctxt);
} else if (source->adapter.type == } else if (source->adapter.type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) { VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
@ -1100,6 +1110,13 @@ virStoragePoolSourceFormat(virBufferPtr buf,
if (src->adapter.data.fchost.managed) if (src->adapter.data.fchost.managed)
virBufferAsprintf(buf, " managed='%s'", virBufferAsprintf(buf, " managed='%s'",
virTristateBoolTypeToString(src->adapter.data.fchost.managed)); 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", virBufferAsprintf(buf, " wwnn='%s' wwpn='%s'/>\n",
src->adapter.data.fchost.wwnn, src->adapter.data.fchost.wwnn,
src->adapter.data.fchost.wwpn); src->adapter.data.fchost.wwpn);

View File

@ -193,6 +193,9 @@ struct _virStoragePoolSourceAdapter {
} scsi_host; } scsi_host;
struct { struct {
char *parent; char *parent;
char *parent_wwnn;
char *parent_wwpn;
char *parent_fabric_wwn;
char *wwnn; char *wwnn;
char *wwpn; char *wwpn;
int managed; /* enum virTristateSwitch */ int managed; /* enum virTristateSwitch */