]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
storage: Create virStoragePoolSourceMatchSingleHost
authorJohn Ferlan <jferlan@redhat.com>
Wed, 1 Apr 2015 18:05:54 +0000 (14:05 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 15 Apr 2015 10:40:07 +0000 (06:40 -0400)
Split out the nhost == 1 and hosts[0].name logic into a separate routine

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/conf/storage_conf.c

index 351eea88959b207753b2fcb31563ea1b6141bfd8..f609f85762f4a30e2797bc23ee86c04bdf429009 100644 (file)
@@ -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))