master - report: selection: fix selection criteria to not match reserved values when using >, <, >=, <
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2f7f6932dcd450ba75fe590aba8c09838d2618dc Commit: 2f7f6932dcd450ba75fe590aba8c09838d2618dc Parent: e223c801fc3eb12c2a4502aee471f18a0b903de8 Author: Peter Rajnoha <[email protected]> AuthorDate: Mon Oct 27 11:25:08 2014 +0100 Committer: Peter Rajnoha <[email protected]> CommitterDate: Mon Oct 27 11:25:08 2014 +0100
report: selection: fix selection criteria to not match reserved values when using >, <, >=, <
Some values are reserved for special purpose like 'undefined', 'unmanaged' etc. When using >, <, >= and < comparison operators where the range is considered, do not include reserved values as proper values in this range which would otherwise result in not so obvious criteria match (as the reserved value is actually transparent for the user). It's incorrect.
Example scenario:
$ vgs -o vg_name,vg_mda_copies vg1 vg2 VG #VMdaCps vg1 1 vg2 unmanaged
The "unmanaged" is actually mapped onto reserved value 18446744073709551615 (2^64 - 1) internally.
Such reseved value is already caught on selection criteria input properly:
$ vgs -o name,vg_mda_copies vg1 vg2 -S 'vg_mda_copies=18446744073709551615' Numeric value 18446744073709551615 found in selection is reserved.
However, we still need to fix situaton where the reserved value may be included in resulting range:
Before this patch:
$ vgs -o vg_name,vg_mda_copies vg1 vg2 -S 'vg_mda_copies >= 1' VG #VMdaCps vg1 1 vg2 unmanaged
With this patch applied:
$ vgs -o vg_name,vg_mda_copies vg1 vg2 -S 'vg_mda_copies >= 1' VG #VMdaCps vg1 1
Quoted 1 line
From the examples above, we can see that without this patch applied,
the vg_mda_copies >= 1 also matched the reserved value 18446744073709551615 (which is represented by the "unamanged" string on report). When applying the operators, such values must be skipped! They're meant to be matched only against their string representation only, e.g.:
$ vgs -o name,vg_mda_copies vg1 vg2 -S 'vg_mda_copies=unmanaged' VG #VMdaCps vg2 unmanaged
...or any synonyms:
$ vgs -o name,vg_mda_copies vg1 vg2 -S 'vg_mda_copies=undefined' VG #VMdaCps vg2 unmanaged --- WHATS_NEW_DM | 1 + libdm/libdm-report.c | 118 ++++++++++++++++++++++++++------------------------ 2 files changed, 62 insertions(+), 57 deletions(-)
WHATS_NEW_DM +1 -0
@@ -1,5 +1,6 @@ Version 1.02.91 - ==================================== + Fix selection criteria to not match reserved values when using >, <, >=, <. Add DM_LIST_HEAD_INIT macro to libdevmapper.h Fix dm_is_dm_major to not issue error about missing /proc lines for dm module.
libdm/libdm-report.c +61 -57
178 lines not on this page · raw message