mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
cleanup: share the nonremoval message
Use common goto label for not remove log error.
This commit is contained in:
parent
3cb9041764
commit
89a8c7bea6
@ -4709,10 +4709,8 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
|
|||||||
} else if ((snap_percent == PERCENT_MERGE_FAILED) &&
|
} else if ((snap_percent == PERCENT_MERGE_FAILED) &&
|
||||||
(force == PROMPT) &&
|
(force == PROMPT) &&
|
||||||
yes_no_prompt("Removing snapshot \"%s\" that failed to merge may leave origin \"%s\" inconsistent. "
|
yes_no_prompt("Removing snapshot \"%s\" that failed to merge may leave origin \"%s\" inconsistent. "
|
||||||
"Proceed? [y/n]: ", lv->name, origin_from_cow(lv)->name) == 'n') {
|
"Proceed? [y/n]: ", lv->name, origin_from_cow(lv)->name) == 'n')
|
||||||
log_error("Logical volume %s not removed.", lv->name);
|
goto no_remove;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (!level && lv_is_virtual_origin(origin = origin_from_cow(lv)))
|
} else if (!level && lv_is_virtual_origin(origin = origin_from_cow(lv)))
|
||||||
/* If this is a sparse device, remove its origin too. */
|
/* If this is a sparse device, remove its origin too. */
|
||||||
@ -4727,10 +4725,8 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
|
|||||||
!lv_is_active(lv) &&
|
!lv_is_active(lv) &&
|
||||||
yes_no_prompt("Removing origin %s will also remove %u "
|
yes_no_prompt("Removing origin %s will also remove %u "
|
||||||
"snapshots(s). Proceed? [y/n]: ",
|
"snapshots(s). Proceed? [y/n]: ",
|
||||||
lv->name, lv->origin_count) == 'n') {
|
lv->name, lv->origin_count) == 'n')
|
||||||
log_error("Logical volume %s not removed.", lv->name);
|
goto no_remove;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dm_list_iterate_safe(snh, snht, &lv->snapshot_segs)
|
dm_list_iterate_safe(snh, snht, &lv->snapshot_segs)
|
||||||
if (!lv_remove_with_dependencies(cmd, dm_list_struct_base(snh, struct lv_segment,
|
if (!lv_remove_with_dependencies(cmd, dm_list_struct_base(snh, struct lv_segment,
|
||||||
@ -4766,12 +4762,15 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
|
|||||||
(force == PROMPT) &&
|
(force == PROMPT) &&
|
||||||
(yes_no_prompt("Removal of pool metadata spare logical volume \"%s\" "
|
(yes_no_prompt("Removal of pool metadata spare logical volume \"%s\" "
|
||||||
"disables automatic recovery attempts after damage "
|
"disables automatic recovery attempts after damage "
|
||||||
"to a thin pool. Proceed? [y/n]: ", lv->name) == 'n')) {
|
"to a thin pool. Proceed? [y/n]: ", lv->name) == 'n'))
|
||||||
log_error("Logical volume \"%s\" not removed.", lv->name);
|
goto no_remove;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return lv_remove_single(cmd, lv, force);
|
return lv_remove_single(cmd, lv, force);
|
||||||
|
|
||||||
|
no_remove:
|
||||||
|
log_error("Logical volume \"%s\" not removed.", lv->name);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user