[libvirt] [PATCH 4/9] storage: Create matchPoolSourceHost

John Ferlan jferlan at redhat.com
Thu Apr 2 17:39:41 UTC 2015


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

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/conf/storage_conf.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index e4cb54b..b3e930b 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -2290,6 +2290,17 @@ matchSCSIAdapterParent(virStoragePoolObjPtr pool,
     return false;
 }
 
+static bool
+matchPoolSourceHost(virStoragePoolSourcePtr poolsrc,
+                    virStoragePoolSourcePtr defsrc)
+{
+    /* NB: nhost cannot be > 1 */
+    if (poolsrc->nhost == 0 || defsrc->nhost == 0)
+        return false;
+
+    return STREQ(poolsrc->hosts[0].name, defsrc->hosts[0].name);
+}
+
 
 static bool
 matchISCSISource(virStoragePoolObjPtr matchpool,
@@ -2299,11 +2310,7 @@ matchISCSISource(virStoragePoolObjPtr matchpool,
     virStoragePoolSourcePtr defsrc = &def->source;
 
 
-    /* NB: nhost cannot be > 1 */
-    if (poolsrc->nhost == 0 || defsrc->nhost == 0)
-        return false;
-
-    if (STRNEQ(poolsrc->hosts[0].name, defsrc->hosts[0].name))
+    if (!matchPoolSourceHost(poolsrc, defsrc))
         return false;
 
     if (STRNEQ_NULLABLE(poolsrc->initiator.iqn, defsrc->initiator.iqn))
-- 
2.1.0




More information about the libvir-list mailing list