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>
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
}
}
} 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 {
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;