diff options
author | David Teigland <teigland@redhat.com> | 2016-04-29 16:26:25 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2016-04-29 16:41:05 -0500 |
commit | 688c06e91a136459a251280e613c9ed46bc019e3 (patch) | |
tree | b33668a39d8f036c991572ad77a07de54eb936e9 | |
parent | 8748312b87834c21be2e58ea54e07692e45154bb (diff) | |
download | lvm2-dev-dct-lvmetad-disabled-11.tar.gz |
pvs: display duplicates when named or with -adev-dct-lvmetad-disabled-11
'pvs' warns about duplicates, but the formal output only
includes the single chosen/preferred PV.
'pvs -a' has the same warnings, and the duplicate PVs are
displayed in the output.
'pvs <path>' has the same warnings, and displays the
named PV, whether it is a duplicate or not.
-rw-r--r-- | tools/toollib.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/toollib.c b/tools/toollib.c index 53f75e0cc..20a2e186b 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -3030,7 +3030,7 @@ static int _process_device_list(struct cmd_context *cmd, struct dm_list *all_dev static int _process_duplicate_pvs(struct cmd_context *cmd, struct dm_list *all_devices, struct dm_list *arg_devices, - int process_all_pvs, + int process_all_devices, struct processing_handle *handle, process_single_pv_fn_t process_single_pv) { @@ -3052,14 +3052,19 @@ static int _process_duplicate_pvs(struct cmd_context *cmd, return_ECMD_FAILED; dm_list_iterate_items(devl, &unused_duplicate_devs) { - if (!process_all_pvs) { - if (!(dil = _device_list_find_dev(arg_devices, devl->dev))) - continue; - _device_list_remove(arg_devices, devl->dev); - } + /* Duplicates are displayed if -a is used or the dev is named as an arg. */ _device_list_remove(all_devices, devl->dev); + if (!process_all_devices && dm_list_empty(arg_devices)) + continue; + + if ((dil = _device_list_find_dev(arg_devices, devl->dev))) + _device_list_remove(arg_devices, devl->dev); + + if (!process_all_devices && !dil) + continue; + if (!(cmd->command->flags & ENABLE_DUPLICATE_DEVS)) continue; @@ -3440,7 +3445,7 @@ int process_each_pv(struct cmd_context *cmd, * them a new VG name. */ - ret = _process_duplicate_pvs(cmd, &all_devices, &arg_devices, process_all_pvs, + ret = _process_duplicate_pvs(cmd, &all_devices, &arg_devices, process_all_devices, handle, process_single_pv); if (ret != ECMD_PROCESSED) stack; |