Create local matchSCSIAdapter() function to handle the duplicate adapter check. Future patches will expand upon the checks. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/conf/storage_conf.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 36696a4..19b6589 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -2084,6 +2084,18 @@ matchSCSIAdapterParent(virStoragePoolObjPtr pool, return false; } +static bool +matchSCSIAdapter(virStoragePoolObjPtr pool, + virStoragePoolDefPtr def) +{ + if (pool->def->source.adapter.data.scsi_host.name) { + return STREQ(pool->def->source.adapter.data.scsi_host.name, + def->source.adapter.data.scsi_host.name); + } else { + return matchSCSIAdapterParent(pool, def); + } +} + int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, virStoragePoolDefPtr def) @@ -2130,14 +2142,8 @@ virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST && def->source.adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) { - if (pool->def->source.adapter.data.scsi_host.name) { - if (STREQ(pool->def->source.adapter.data.scsi_host.name, - def->source.adapter.data.scsi_host.name)) - matchpool = pool; - } else { - if (matchSCSIAdapterParent(pool, def)) - matchpool = pool; - } + if (matchSCSIAdapter(pool, def)) + matchpool = pool; } break; case VIR_STORAGE_POOL_ISCSI: -- 1.9.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list