This is continuation of bz #867376 which should cover criteria-based LVM processing. Similarly as in bz #867376 where the selection criteria are applied for reporting, let's reuse the same logic for LVM processing too - we should be able to execute a non-reporting LVM command to process only volumes that match selection criteria. A few examples: lvchange -ay --select 'lv_size > 1g' (activate LVs where the size is more than 1g) vgchange --metadatacopies 4 --select '(pv_count > 30) && (pv_count < 50)' (keep 4 metadata copies managed in VGs with PV count more than 30 and less than 50) pvchange --allocatable n 'pv_size < 10g' (disable allocation on PVs less than 10g) ...and so on and similarly including other possible fields. Inspect which fields may be causing problems - one issue that could be hit is that the selection is actually done on fields which we normally report - there must be a mapping between these fields and internal PV/VG/LV structures where we keep this information. The comparison logic must be adapted to this. Currently, it compares selection fields with reporting fields - we should be able to replace the reporting field with the PV/VG/LV structure and make it possible to do direct comparisons with values stored in these structures... (We probably don't need this for dmsetup.)
Current development branch: https://git.fedorahosted.org/cgit/lvm2.git/log/?h=dev-prajnoha-tool-select (not adequate for review yet - it's still work in progress) More patches will follow, this is an early version of the code supporting this feature. The --select is not yet recognized in LVM processing tools, I haven't done any testing yet... I'll be updating this branch progressively.
Is not this merged?
Yes, this code is merged already since lvm2 v 2.02.117 (the nearest released rawhide package is lvm2-2.02.118-1.fc23). We've added support for selection in these LVM processing commands: pvchange, vgchange, lvchange vgremove, lvremove vgimport, vgexport Also these reporting commands (but not using libdevmapper's reporting infrastructure): pvdisplay, vgdisplay, lvdisplay if used without -C (With -C option, it uses libdevmapper's reporting infra and hence it already supported selection even before.)