提交 9aced8c9 编写于 作者: J John Ferlan

storage: Create virStoragePoolSourceMatchSingleHost

Split out the nhost == 1 and hosts[0].name logic into a separate routine
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 fc20b412
......@@ -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))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册