[REPOST 1/8] getAdapterName: check for SCSI_HOST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rather than assume that NOT FC_HOST is SCSI_HOST, let's call them out
specifically. Makes it easier to find SCSI_HOST code/structs and ensures
something isn't missed in the future

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/storage/storage_backend_scsi.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index f6f3ca2..21c13e5 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -547,18 +547,17 @@ getAdapterName(virStoragePoolSourceAdapter adapter)
 {
     char *name = NULL;
 
-    if (adapter.type != VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) {
+    if (adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
         ignore_value(VIR_STRDUP(name, adapter.data.name));
-        return name;
-    }
-
-    if (!(name = virGetFCHostNameByWWN(NULL,
-                                       adapter.data.fchost.wwnn,
-                                       adapter.data.fchost.wwpn))) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       _("Failed to find SCSI host with wwnn='%s', "
-                         "wwpn='%s'"), adapter.data.fchost.wwnn,
-                       adapter.data.fchost.wwpn);
+    } else if (adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) {
+        if (!(name = virGetFCHostNameByWWN(NULL,
+                                           adapter.data.fchost.wwnn,
+                                           adapter.data.fchost.wwpn))) {
+            virReportError(VIR_ERR_XML_ERROR,
+                           _("Failed to find SCSI host with wwnn='%s', "
+                             "wwpn='%s'"), adapter.data.fchost.wwnn,
+                           adapter.data.fchost.wwpn);
+        }
     }
 
     return name;
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]