master - pvcreate: add prompt when setting dev size
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4f9ff14508084789c731e99d8921c052da694319 Commit: 4f9ff14508084789c731e99d8921c052da694319 Parent: 5cf51fb2f74ad43a2555bc391cf069caa1d99775 Author: David Teigland <[email protected]> AuthorDate: Thu Apr 27 12:13:09 2017 -0500 Committer: David Teigland <[email protected]> CommitterDate: Thu Apr 27 13:25:41 2017 -0500
pvcreate: add prompt when setting dev size
If the device size does not match the size requested by --setphysicalvolumesize, then prompt the user.
Make the pvcreate checking/prompting code handle multiple prompts for the same device, since the new prompt can be in addition to the existing prompt when the PV is in a VG.
--- test/shell/pv-check-dev-size.sh | 4 +- test/shell/snapshot-usage.sh | 2 +- tools/args.h | 2 +- tools/pvcreate.c | 4 +- tools/pvresize.c | 4 +- tools/toollib.c | 133 +++++++++++++++++++++++++++++++-------- 6 files changed, 115 insertions(+), 34 deletions(-)
test/shell/pv-check-dev-size.sh +2 -2
@@ -27,7 +27,7 @@ not grep "$CHECK_MSG" err vgremove -ff $vg # set PV size to 2x dev size -pvcreate --setphysicalvolumesize 16m $dev1 +pvcreate --yes --setphysicalvolumesize 16m $dev1 vgcreate $vg $dev1 2>err grep "$CHECK_MSG" err pvs 2>err
@@ -36,7 +36,7 @@ vgremove -ff $vg # should be quiet if requested aux lvmconf 'metadata/check_pv_device_sizes = 0' -pvcreate --setphysicalvolumesize 16m $dev1 +pvcreate --yes --setphysicalvolumesize 16m $dev1 vgcreate $vg $dev1 2>err not grep "$CHECK_MSG" err pvs 2>err
test/shell/snapshot-usage.sh +1 -1
@@ -78,7 +78,7 @@ aux lvmconf "activation/snapshot_autoextend_percent = 20" \ "activation/snapshot_autoextend_threshold = 50" # Check usability with smallest (1k) extent size ($lv has 15P) -pvcreate --setphysicalvolumesize 4T "$DM_DEV_DIR/$vg/$lv" +pvcreate --yes --setphysicalvolumesize 4T "$DM_DEV_DIR/$vg/$lv" trap 'cleanup_tail' EXIT vgcreate -s 1K $vg1 "$DM_DEV_DIR/$vg/$lv"
tools/args.h +1 -1
@@ -402,7 +402,7 @@ arg(originname_ARG, '\0', "originname", lv_VAL, 0, 0, "to a thin LV. The LV being converted becomes a read-only external origin\n" "with this name.\n") -arg (physicalvolumesize_ARG,'\0' ,"setphysicalvolumesize" , sizemb_VAL,0 ,0 , +arg (setphysicalvolumesize_ARG,'\0' ,"setphysicalvolumesize" , sizemb_VAL,0 ,0 ,"Overrides the automatically detected size of the PV.\n" "Use with care, or prior to reducing the physical size of the device.\n" )
tools/pvcreate.c +2 -2
@@ -52,11 +52,11 @@ static int pvcreate_restore_params_from_args(struct cmd_context *cmd, int argc, pp->pva.idp = &pp->pva.id; } -if (arg_sign_value (cmd, physicalvolumesize_ARG,SIGN_NONE ) ==SIGN_MINUS ) { +if (arg_sign_value (cmd, setphysicalvolumesize_ARG,SIGN_NONE ) ==SIGN_MINUS ) {log_error ("Physical volume size may not be negative" );return 0 ; } - pp->pva.size =arg_uint64_value (cmd, physicalvolumesize_ARG,UINT64_C (0 )); + pp->pva.size =arg_uint64_value (cmd, setphysicalvolumesize_ARG,UINT64_C (0 ));if (arg_is_set (cmd, restorefile_ARG) ||arg_is_set (cmd, uuidstr_ARG)) pp->zero =0 ;
tools/pvresize.c +2 -2
@@ -72,13 +72,13 @@ int pvresize(struct cmd_context *cmd, int argc, char **argv) goto out; } -if (arg_sign_value (cmd, physicalvolumesize_ARG,SIGN_NONE ) ==SIGN_MINUS ) { +if (arg_sign_value (cmd, setphysicalvolumesize_ARG,SIGN_NONE ) ==SIGN_MINUS ) {log_error ("Physical volume size may not be negative" ); ret =EINVALID_CMD_LINE ; goto out; } - params.new_size =arg_uint64_value (cmd, physicalvolumesize_ARG, + params.new_size =arg_uint64_value (cmd, setphysicalvolumesize_ARG,UINT64_C (0 )); params.done =0 ;
tools/toollib.c +107 -26
219 lines not on this page · raw message