mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
Add --mirrorsonly arg to vgreduce. (Doesn't handle mirrors yet.)
This commit is contained in:
parent
2e6d308465
commit
c9dcba6b16
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.02 -
|
Version 2.02.02 -
|
||||||
====================================
|
====================================
|
||||||
|
Add --mirrorsonly to vgreduce.
|
||||||
vgreduce replaces active LVs with error segment before removing them.
|
vgreduce replaces active LVs with error segment before removing them.
|
||||||
Set block_on_error parameter if available.
|
Set block_on_error parameter if available.
|
||||||
Add target_version.
|
Add target_version.
|
||||||
|
@ -44,6 +44,7 @@ arg(minor_ARG, '\0', "minor", minor_arg)
|
|||||||
arg(type_ARG, '\0', "type", segtype_arg)
|
arg(type_ARG, '\0', "type", segtype_arg)
|
||||||
arg(alloc_ARG, '\0', "alloc", alloc_arg)
|
arg(alloc_ARG, '\0', "alloc", alloc_arg)
|
||||||
arg(separator_ARG, '\0', "separator", string_arg)
|
arg(separator_ARG, '\0', "separator", string_arg)
|
||||||
|
arg(mirrorsonly_ARG, '\0', "mirrorsonly", NULL)
|
||||||
|
|
||||||
/* Allow some variations */
|
/* Allow some variations */
|
||||||
arg(resizable_ARG, '\0', "resizable", yes_no_arg)
|
arg(resizable_ARG, '\0', "resizable", yes_no_arg)
|
||||||
|
@ -770,6 +770,7 @@ xx(vgreduce,
|
|||||||
"\t[-A|--autobackup y|n]\n"
|
"\t[-A|--autobackup y|n]\n"
|
||||||
"\t[-d|--debug]\n"
|
"\t[-d|--debug]\n"
|
||||||
"\t[-h|--help]\n"
|
"\t[-h|--help]\n"
|
||||||
|
"\t[--mirrorsonly]\n"
|
||||||
"\t[--removemissing]\n"
|
"\t[--removemissing]\n"
|
||||||
"\t[-t|--test]\n"
|
"\t[-t|--test]\n"
|
||||||
"\t[-v|--verbose]\n"
|
"\t[-v|--verbose]\n"
|
||||||
@ -777,7 +778,7 @@ xx(vgreduce,
|
|||||||
"\tVolumeGroupName\n"
|
"\tVolumeGroupName\n"
|
||||||
"\t[PhysicalVolumePath...]\n",
|
"\t[PhysicalVolumePath...]\n",
|
||||||
|
|
||||||
all_ARG, autobackup_ARG, removemissing_ARG, test_ARG)
|
all_ARG, autobackup_ARG, mirrorsonly_ARG, removemissing_ARG, test_ARG)
|
||||||
|
|
||||||
xx(vgremove,
|
xx(vgremove,
|
||||||
"Remove volume group(s)",
|
"Remove volume group(s)",
|
||||||
|
@ -152,8 +152,9 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg)
|
|||||||
struct physical_volume *pv;
|
struct physical_volume *pv;
|
||||||
struct lv_segment *seg;
|
struct lv_segment *seg;
|
||||||
unsigned int s;
|
unsigned int s;
|
||||||
int list_unsafe;
|
int list_unsafe, only_mirror_images_found;
|
||||||
LIST_INIT(lvs_changed);
|
LIST_INIT(lvs_changed);
|
||||||
|
only_mirror_images_found = 1;
|
||||||
|
|
||||||
/* Deactivate & remove necessary LVs */
|
/* Deactivate & remove necessary LVs */
|
||||||
restart_loop:
|
restart_loop:
|
||||||
@ -172,6 +173,12 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg)
|
|||||||
|
|
||||||
pv = seg_pv(seg, s);
|
pv = seg_pv(seg, s);
|
||||||
if (!pv || !pv->dev) {
|
if (!pv || !pv->dev) {
|
||||||
|
if (arg_count(cmd, mirrorsonly_ARG) &&
|
||||||
|
!(lv->status & MIRROR_IMAGE)) {
|
||||||
|
log_error("Non-mirror-image LV %s found: can't remove.", lv->name);
|
||||||
|
only_mirror_images_found = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!_remove_lv(cmd, lv, &list_unsafe, &lvs_changed)) {
|
if (!_remove_lv(cmd, lv, &list_unsafe, &lvs_changed)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
@ -183,6 +190,11 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!only_mirror_images_found) {
|
||||||
|
log_error("Aborting because --mirrorsonly was specified.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove missing PVs */
|
/* Remove missing PVs */
|
||||||
list_iterate_safe(pvh, pvht, &vg->pvs) {
|
list_iterate_safe(pvh, pvht, &vg->pvs) {
|
||||||
pvl = list_item(pvh, struct pv_list);
|
pvl = list_item(pvh, struct pv_list);
|
||||||
@ -235,7 +247,7 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg)
|
|||||||
/* FIXME If any lvs_changed belong to mirrors, reduce those mirrors */
|
/* FIXME If any lvs_changed belong to mirrors, reduce those mirrors */
|
||||||
|
|
||||||
/* Deactivate error LVs */
|
/* Deactivate error LVs */
|
||||||
if (!test_mode) {
|
if (!test_mode()) {
|
||||||
list_iterate_items(lvl, &lvs_changed) {
|
list_iterate_items(lvl, &lvs_changed) {
|
||||||
log_verbose("Deactivating (if active) logical volume %s",
|
log_verbose("Deactivating (if active) logical volume %s",
|
||||||
lvl->lv->name);
|
lvl->lv->name);
|
||||||
@ -340,6 +352,12 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
return EINVALID_CMD_LINE;
|
return EINVALID_CMD_LINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arg_count(cmd, mirrorsonly_ARG) &&
|
||||||
|
!arg_count(cmd, removemissing_ARG)) {
|
||||||
|
log_error("--mirrorsonly requires --removemissing");
|
||||||
|
return EINVALID_CMD_LINE;
|
||||||
|
}
|
||||||
|
|
||||||
if (argc == 1 && !arg_count(cmd, all_ARG)
|
if (argc == 1 && !arg_count(cmd, all_ARG)
|
||||||
&& !arg_count(cmd, removemissing_ARG)) {
|
&& !arg_count(cmd, removemissing_ARG)) {
|
||||||
log_error("Please enter physical volume paths or option -a");
|
log_error("Please enter physical volume paths or option -a");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user