]> sourceware.org Git - lvm2.git/commit
report: selection: fix selection criteria to not match reserved values when using...
authorPeter Rajnoha <prajnoha@redhat.com>
Mon, 27 Oct 2014 10:25:08 +0000 (11:25 +0100)
committerPeter Rajnoha <prajnoha@redhat.com>
Mon, 27 Oct 2014 10:25:08 +0000 (11:25 +0100)
commit2f7f6932dcd450ba75fe590aba8c09838d2618dc
tree7544549b3cc32389912030168cee32ef26154014
parente223c801fc3eb12c2a4502aee471f18a0b903de8
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

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
libdm/libdm-report.c
This page took 0.034148 seconds and 5 git commands to generate.