]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virStoragePoolSourceAdapter: Refine the SCSI_HOST adapter name
authorOsier Yang <jyang@redhat.com>
Mon, 3 Mar 2014 20:04:17 +0000 (15:04 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 21 Jul 2014 16:55:10 +0000 (12:55 -0400)
Preparation for future patches by creating a scsi_host union. For now,
just the 'name' will be present.

src/conf/storage_conf.c
src/conf/storage_conf.h
src/phyp/phyp_driver.c
src/storage/storage_backend_scsi.c

index 69333f574aaed0c72ec3d2d31b238350e979de6d..e135512789361ea26251d03bed0006c2422b5449 100644 (file)
@@ -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);
     }
 }
 
@@ -576,7 +576,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 {
@@ -601,7 +601,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;
@@ -854,7 +854,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;
@@ -1021,7 +1021,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);
         }
     }
 
@@ -2028,8 +2029,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;
index 54c978dc421c00b0bea99a5d40b5735468dfe9d7..33784b2f31723968717be3d5e0069d2d7630670f 100644 (file)
@@ -179,7 +179,9 @@ struct _virStoragePoolSourceAdapter {
     int type; /* virStoragePoolSourceAdapterType */
 
     union {
-        char *name;
+        struct {
+            char *name;
+        } scsi_host;
         struct {
             char *parent;
             char *wwnn;
index fa9afd03ac204d1369d85d92da6eb1171116338d..aa1e1053efbca9276384c49106b884f14716c16c 100644 (file)
@@ -1975,7 +1975,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;
@@ -2197,7 +2197,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;
@@ -2436,7 +2436,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, '\'');
@@ -2667,7 +2667,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;
index 1ef75d9448b7c00d6b30f3d24caab7ab6f13f6fe..f787c56861c46664973321647c20f8a76918df41 100644 (file)
@@ -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,