summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2017-01-03 13:04:51 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2017-01-03 14:55:16 +0100
commit4fd41cf67f0b9ea44a103b059dbbb2d74d8289eb (patch)
tree3f1bd26462e7d90ff45e1857ff0b526c75a590a8
parent9f65a3f0c54fc349da279f9a9e8f1b214945489e (diff)
downloadlvm2-4fd41cf67f0b9ea44a103b059dbbb2d74d8289eb.tar.gz
vgchange: max_pv limited to uint32
Solves: https://bugzilla.redhat.com/1280496 The only reasonable behaviour here is to error on any number out of accepted range (i.e. now numbers wrapping around with some hidden logic). As this is plain bug there is no support for backward compatibility since noone should set numbers >UINT32_MAX and expect 0 or error depending on how big number was used.... TODO: more fields might need to be converted.
-rw-r--r--WHATS_NEW1
-rw-r--r--test/shell/vgchange-usage.sh7
-rw-r--r--tools/args.h2
3 files changed, 9 insertions, 1 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index e5bbfe01d..9e16b278e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.169 -
=====================================
+ vgchange -p accepts only uint32 numbers.
Report thin LV date for merged LV when the merge is in progress.
Detect if snapshot merge really started before polling for progress.
Checking LV for merging origin requires also it has merged snapshot.
diff --git a/test/shell/vgchange-usage.sh b/test/shell/vgchange-usage.sh
index 91637411c..08d811438 100644
--- a/test/shell/vgchange-usage.sh
+++ b/test/shell/vgchange-usage.sh
@@ -53,6 +53,13 @@ not vgchange -p 2 $vg 2>err
grep "MaxPhysicalVolumes is less than the current number $pv_count of PVs for" err
check vg_field $vg max_pv 128
+# try some numbers around MAX limit (uint32)
+vgchange -p 4294967295 $vg
+invalid vgchange -p 4294967296 $vg
+invalid vgchange -p 18446744073709551615 $vg
+invalid vgchange -p 18446744073709551616 $vg
+check vg_field $vg max_pv 4294967295
+
# vgchange -l MaxLogicalVolumes
check vg_field $vg max_lv 0
invalid vgchange -l -128 $vg
diff --git a/tools/args.h b/tools/args.h
index a04d81d5e..d5f1186a1 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -198,7 +198,7 @@ arg(novolumegroup_ARG, 'n', "novolumegroup", NULL, 0, 0)
arg(oldpath_ARG, 'n', "oldpath", NULL, 0, 0)
arg(options_ARG, 'o', "options", string_arg, ARG_GROUPABLE, 0)
arg(sort_ARG, 'O', "sort", string_arg, ARG_GROUPABLE, 0)
-arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", int_arg, 0, 0)
+arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", uint32_arg, 0, 0)
arg(permission_ARG, 'p', "permission", permission_arg, 0, 0)
arg(partial_ARG, 'P', "partial", NULL, 0, 0)
arg(physicalvolume_ARG, 'P', "physicalvolume", NULL, 0, 0)