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