1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-28 05:57:49 +03:00

Allow vgremove of a VG with PVs missing.

This commit is contained in:
Petr Rockai 2010-01-08 14:03:54 +00:00
parent e53a955115
commit 891246562f
2 changed files with 14 additions and 8 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.57 -
====================================
Allow vgremove of a VG with PVs missing.
Keep log type consistent when changing mirror image count.
Always set environment variables for an LVM2 device in 11-dm-lvm.rules.
Add activation/udev_rules config option in lvm.conf.

View File

@ -19,7 +19,7 @@ static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
void *handle __attribute((unused)))
{
unsigned lv_count;
unsigned lv_count, missing;
force_t force;
if (!vg_check_status(vg, EXPORTED_VG)) {
@ -31,13 +31,17 @@ static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
force = arg_count(cmd, force_ARG);
if (lv_count) {
if ((force == PROMPT) &&
(yes_no_prompt("Do you really want to remove volume "
"group \"%s\" containing %u "
"logical volumes? [y/n]: ",
vg_name, lv_count) == 'n')) {
log_error("Volume group \"%s\" not removed", vg_name);
return ECMD_FAILED;
if (force == PROMPT) {
if ((missing = vg_missing_pv_count(vg)))
log_warn("WARNING: %d physical volumes are currently missing "
"from the system.", missing);
if (yes_no_prompt("Do you really want to remove volume "
"group \"%s\" containing %u "
"logical volumes? [y/n]: ",
vg_name, lv_count) == 'n') {
log_error("Volume group \"%s\" not removed", vg_name);
return ECMD_FAILED;
}
}
if (!remove_lvs_in_vg(cmd, vg, force)) {
stack;
@ -67,6 +71,7 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
cmd->handles_missing_pvs = 1;
ret = process_each_vg(cmd, argc, argv,
READ_FOR_UPDATE,
NULL, &vgremove_single);