[PATCH v2 2/8] storage: Create virStoragePoolSourceMatchSingleHost

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

 



Split out the nhost == 1 and hosts[0].name logic into a separate routine

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/storage_conf.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 351eea8..f609f85 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -2405,6 +2405,16 @@ matchSCSIAdapterParent(virStoragePoolObjPtr pool,
     return false;
 }
 
+static bool
+virStoragePoolSourceMatchSingleHost(virStoragePoolSourcePtr poolsrc,
+                                    virStoragePoolSourcePtr defsrc)
+{
+    if (poolsrc->nhost != 1 && defsrc->nhost != 1)
+        return false;
+
+    return STREQ(poolsrc->hosts[0].name, defsrc->hosts[0].name);
+}
+
 
 static bool
 virStoragePoolSourceISCSIMatch(virStoragePoolObjPtr matchpool,
@@ -2413,10 +2423,7 @@ virStoragePoolSourceISCSIMatch(virStoragePoolObjPtr matchpool,
     virStoragePoolSourcePtr poolsrc = &matchpool->def->source;
     virStoragePoolSourcePtr defsrc = &def->source;
 
-    if (poolsrc->nhost != 1 && defsrc->nhost != 1)
-        return false;
-
-    if (STRNEQ(poolsrc->hosts[0].name, defsrc->hosts[0].name))
+    if (!virStoragePoolSourceMatchSingleHost(poolsrc, defsrc))
         return false;
 
     if (STRNEQ_NULLABLE(poolsrc->initiator.iqn, defsrc->initiator.iqn))
-- 
2.1.0

--
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]