From: Osier Yang <jyang(a)redhat.com>
Preparation for future patches by creating a scsi_host union. For now,
just the 'name' will be present.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/storage_conf.c | 15 ++++++++-------
src/conf/storage_conf.h | 4 +++-
src/phyp/phyp_driver.c | 8 ++++----
src/storage/storage_backend_scsi.c | 2 +-
4 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 8b6fd79..2e71c64 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -343,7 +343,7 @@ virStoragePoolSourceAdapterClear(virStoragePoolSourceAdapter adapter)
VIR_FREE(adapter.data.fchost.parent);
} else if (adapter.type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
- VIR_FREE(adapter.data.name);
+ VIR_FREE(adapter.data.scsi_host.name);
}
}
@@ -674,7 +674,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
virXPathString("string(./adapter/@wwpn)", ctxt);
} else if (source->adapter.type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
- source->adapter.data.name =
+ source->adapter.data.scsi_host.name =
virXPathString("string(./adapter/@name)", ctxt);
}
} else {
@@ -699,7 +699,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
/* To keep back-compat, 'type' is not required to specify
* for scsi_host adapter.
*/
- if ((source->adapter.data.name =
+ if ((source->adapter.data.scsi_host.name =
virXPathString("string(./adapter/@name)", ctxt)))
source->adapter.type =
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST;
@@ -942,7 +942,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
goto error;
} else if (ret->source.adapter.type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
- if (!ret->source.adapter.data.name) {
+ if (!ret->source.adapter.data.scsi_host.name) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing storage pool source adapter name"));
goto error;
@@ -1110,7 +1110,8 @@ virStoragePoolSourceFormat(virBufferPtr buf,
src->adapter.data.fchost.wwpn);
} else if (src->adapter.type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
- virBufferAsprintf(buf, " name='%s'/>\n",
src->adapter.data.name);
+ virBufferAsprintf(buf, " name='%s'/>\n",
+ src->adapter.data.scsi_host.name);
}
}
@@ -2128,8 +2129,8 @@ virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
matchpool = pool;
} else if (pool->def->source.adapter.type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST){
- if (STREQ(pool->def->source.adapter.data.name,
- def->source.adapter.data.name))
+ if (STREQ(pool->def->source.adapter.data.scsi_host.name,
+ def->source.adapter.data.scsi_host.name))
matchpool = pool;
}
break;
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 04d99eb..7a92a47 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -211,7 +211,9 @@ struct _virStoragePoolSourceAdapter {
int type; /* virStoragePoolSourceAdapterType */
union {
- char *name;
+ struct {
+ char *name;
+ } scsi_host;
struct {
char *parent;
char *wwnn;
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 508e4c0..d5147d1 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1981,7 +1981,7 @@ phypStorageVolCreateXML(virStoragePoolPtr pool,
spdef->source.ndevice = 1;
/*XXX source adapter not working properly, should show hdiskX */
- if ((spdef->source.adapter.data.name =
+ if ((spdef->source.adapter.data.scsi_host.name =
phypGetStoragePoolDevice(pool->conn, pool->name)) == NULL) {
VIR_ERROR(_("Unable to determine storage pools's source
adapter."));
goto err;
@@ -2203,7 +2203,7 @@ phypStorageVolGetXMLDesc(virStorageVolPtr vol, unsigned int flags)
pool.source.ndevice = 1;
- if ((pool.source.adapter.data.name =
+ if ((pool.source.adapter.data.scsi_host.name =
phypGetStoragePoolDevice(sp->conn, sp->name)) == NULL) {
VIR_ERROR(_("Unable to determine storage sps's source adapter."));
goto cleanup;
@@ -2442,7 +2442,7 @@ phypBuildStoragePool(virConnectPtr conn, virStoragePoolDefPtr def)
managed_system, vios_id);
virBufferAsprintf(&buf, "mksp -f %schild %s", def->name,
- source.adapter.data.name);
+ source.adapter.data.scsi_host.name);
if (system_type == HMC)
virBufferAddChar(&buf, '\'');
@@ -2673,7 +2673,7 @@ phypStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int
flags)
def.source.ndevice = 1;
/*XXX source adapter not working properly, should show hdiskX */
- if ((def.source.adapter.data.name =
+ if ((def.source.adapter.data.scsi_host.name =
phypGetStoragePoolDevice(pool->conn, pool->name)) == NULL) {
VIR_ERROR(_("Unable to determine storage pools's source
adapter."));
goto err;
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 21c13e5..b5dbe51 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -548,7 +548,7 @@ getAdapterName(virStoragePoolSourceAdapter adapter)
char *name = NULL;
if (adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
- ignore_value(VIR_STRDUP(name, adapter.data.name));
+ ignore_value(VIR_STRDUP(name, adapter.data.scsi_host.name));
} else if (adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) {
if (!(name = virGetFCHostNameByWWN(NULL,
adapter.data.fchost.wwnn,
--
1.9.3