1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Add prompt if using --metadataignore argument with vgmetadatacopies.

When using vgmetadatacopies value other than "umanaged" (0), prompt
the user if the usage of --metadataignore would change the value of
vgmetadatacopies.  The main 2 cases are:
1) pvchange --metadataignore
2) vgextend --metadataignore

We leave the prompt check in the tools, and do not change anything
if the user says 'n'.

Examples:
vgextend --metadataignore y vgtest /dev/loop0
Setting metadataignore will override preferred number of copies of VG vgtest metadata.
Are you sure? [y/n]: y
  No physical volume label read from /dev/loop0
  Physical volume "/dev/loop0" successfully created
  Volume group "vgtest" successfully extended

pvchange --metadataignore y /dev/loop3
Setting metadataignore on /dev/loop3 will override preferred number of copies of VG vgtest metadata.
Are you sure? [y/n]: y
  WARNING: Changing preferred number of copies of VG vgtest metadata from 3 to 2
  Physical volume "/dev/loop3" changed
  1 physical volume changed / 0 physical volumes not changed

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
Dave Wysochanski 2010-07-07 19:02:50 +00:00
parent 7041b476ac
commit 90b96af68f
3 changed files with 20 additions and 0 deletions

View File

@ -1,5 +1,7 @@
Version 2.02.71 -
===============================
Prompt if metadataignore with vgextend or pvchange would adjust vg_mda_copies.
Adjust vg_mda_copies if metadataignore given with vgextend or pvchange.
Adjust auto-metadata repair and caching logic to try to cope with empty mdas.
Version 2.02.70 - 6th July 2010

View File

@ -122,6 +122,14 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
}
}
} else if (arg_count(cmd, metadataignore_ARG)) {
if ((vg_mda_copies(vg) != VGMETADATACOPIES_UNMANAGED) &&
yes_no_prompt("Setting metadataignore on %s will override "
"preferred number of copies of VG %s "
"metadata.\nAre you sure? [y/n]: ",
pv_name, pv_vg_name(pv)) == 'n') {
log_error("Physical volume %s not changed", pv_name);
goto out;
}
if (!pv_change_metadataignore(pv, mda_ignore))
goto out;
} else {

View File

@ -59,6 +59,16 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
if (!archive(vg))
goto_bad;
if (arg_count(cmd, metadataignore_ARG) &&
(vg_mda_copies(vg) != VGMETADATACOPIES_UNMANAGED) &&
yes_no_prompt("Setting metadataignore will override "
"preferred number of copies of VG %s "
"metadata.\nAre you sure? [y/n]: ",
vg_name) == 'n') {
log_error("Volume group %s not changed", vg_name);
goto_bad;
}
/* extend vg */
if (!vg_extend(vg, argc, argv, &pp))
goto_bad;