master - lvresize: support passing --yes to fsadm
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e3f63693a4ea76975fb...
Commit: e3f63693a4ea76975fb01f8456f1f263b029b07f
Parent: 48f06005ab53420241e0c1da3a56a8f5c1a28974
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 21 14:02:57 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 21 14:03:29 2017 +0200
lvresize: support passing --yes to fsadm
Since fsadm now needs --yes to pass prompting operations,
we need to pass --yes from lvresize to fsadm.
---
lib/metadata/lv_manip.c | 12 ++++++++----
lib/metadata/metadata-exported.h | 1 +
tools/lvresize.c | 1 +
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 9e98ee3..c431868 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4578,6 +4578,7 @@ enum fsadm_cmd_e { FSADM_CMD_CHECK, FSADM_CMD_RESIZE };
static int _fsadm_cmd(enum fsadm_cmd_e fcmd,
struct logical_volume *lv,
uint32_t extents,
+ int yes,
int force,
int *status)
{
@@ -4585,7 +4586,7 @@ static int _fsadm_cmd(enum fsadm_cmd_e fcmd,
struct cmd_context *cmd = vg->cmd;
char lv_path[PATH_MAX];
char size_buf[SIZE_BUF];
- const char *argv[FSADM_CMD_MAX_ARGS + 2];
+ const char *argv[FSADM_CMD_MAX_ARGS + 4];
unsigned i = 0;
argv[i++] = find_config_tree_str(cmd, global_fsadm_executable_CFG, NULL);
@@ -4596,6 +4597,9 @@ static int _fsadm_cmd(enum fsadm_cmd_e fcmd,
if (verbose_level() >= _LOG_NOTICE)
argv[i++] = "--verbose";
+ if (yes)
+ argv[i++] = "--yes";
+
if (force)
argv[i++] = "--force";
@@ -5498,7 +5502,7 @@ int lv_resize(struct logical_volume *lv,
if (lp->resizefs) {
if (!lp->nofsck &&
- !_fsadm_cmd(FSADM_CMD_CHECK, lv, 0, lp->force, &status)) {
+ !_fsadm_cmd(FSADM_CMD_CHECK, lv, 0, lp->yes, lp->force, &status)) {
if (status != FSADM_CHECK_FAILS_FOR_MOUNTED) {
log_error("Filesystem check failed.");
return 0;
@@ -5508,7 +5512,7 @@ int lv_resize(struct logical_volume *lv,
/* FIXME forks here */
if ((lp->resize == LV_REDUCE) &&
- !_fsadm_cmd(FSADM_CMD_RESIZE, lv, lp->extents, lp->force, NULL)) {
+ !_fsadm_cmd(FSADM_CMD_RESIZE, lv, lp->extents, lp->yes, lp->force, NULL)) {
log_error("Filesystem resize failed.");
return 0;
}
@@ -5589,7 +5593,7 @@ out:
display_lvname(lv));
if (lp->resizefs && (lp->resize == LV_EXTEND) &&
- !_fsadm_cmd(FSADM_CMD_RESIZE, lv, lp->extents, lp->force, NULL))
+ !_fsadm_cmd(FSADM_CMD_RESIZE, lv, lp->extents, lp->yes, lp->force, NULL))
return_0;
ret = 1;
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index c4bebd0..6c3d8d7 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -649,6 +649,7 @@ struct lvresize_params {
int use_policies;
alloc_policy_t alloc;
+ int yes;
int force;
int nosync;
int nofsck;
diff --git a/tools/lvresize.c b/tools/lvresize.c
index 1d59239..9b061ac 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -147,6 +147,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,
lp->argv = ++argv;
lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, 0);
+ lp->yes = arg_is_set(cmd, yes_ARG);
lp->force = arg_is_set(cmd, force_ARG);
lp->nofsck = arg_is_set(cmd, nofsck_ARG);
lp->nosync = arg_is_set(cmd, nosync_ARG);
6 years, 11 months
master - raid: update path for repair
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=48f06005ab53420241e...
Commit: 48f06005ab53420241e0c1da3a56a8f5c1a28974
Parent: 5f4cfa7c4a6da707354f8c1c059531dac5287192
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 21 13:57:22 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 21 14:00:50 2017 +0200
raid: update path for repair
Updating path from commit 61980bcf0624790bfdc07d371fd510d1c4079fb5.
When repair is running, no removing PVS are given so it shall return
success in such case.
---
lib/metadata/raid_manip.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 34545b4..9e4f3a3 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6661,9 +6661,14 @@ static int _lv_raid_rebuild_or_replace(struct logical_volume *lv,
}
if (!match_count) {
- log_error("Logical volume %s does not contain devices specified to %s.",
- display_lvname(lv), action_str);
- return 0;
+ if (remove_pvs && !dm_list_empty(remove_pvs)) {
+ log_error("Logical volume %s does not contain devices specified to %s.",
+ display_lvname(lv), action_str);
+ return 0;
+ }
+ log_print_unless_silent("%s does not contain devices specified to %s.",
+ display_lvname(lv), action_str);
+ return 1;
} else if (match_count == raid_seg->area_count) {
log_error("Unable to %s all PVs from %s at once.",
action_str, display_lvname(lv));
6 years, 11 months
master - debug: missing traces
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5f4cfa7c4a6da707354...
Commit: 5f4cfa7c4a6da707354f8c1c059531dac5287192
Parent: 07fe64b47317daba1744c8c1ccbef38754fe8a4e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 21 11:29:16 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 21 12:36:01 2017 +0200
debug: missing traces
---
lib/metadata/raid_manip.c | 87 +++++++++++++++++++++++----------------------
1 files changed, 44 insertions(+), 43 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index b91bfba..34545b4 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -912,7 +912,7 @@ static int _reorder_raid10_near_seg_areas(struct lv_segment *seg, enum raid0_rai
break;
default:
- return 0;
+ return_0;
}
/* Sort areas */
@@ -1591,7 +1591,7 @@ static int _lv_alloc_reshape_space(struct logical_volume *lv,
lv->size = lv_size_cur;
/* pay attention to lv_extend maybe having allocated more because of layout specific rounding */
if (!_lv_set_reshape_len(lv, _lv_total_rimage_len(lv) - prev_rimage_len))
- return 0;
+ return_0;
}
/* Preset data offset in case we fail relocating reshape space below */
@@ -1668,7 +1668,7 @@ static int _lv_free_reshape_space_with_status(struct logical_volume *lv, enum al
seg->extents_copied = first_seg(lv)->area_len;
if (!_lv_set_reshape_len(lv, 0))
- return 0;
+ return_0;
/*
* Only in case reshape space was freed at the beginning,
@@ -1722,7 +1722,7 @@ static int _reshaped_state(struct logical_volume *lv, const unsigned dev_count,
return_0;
if (!_get_dev_health(lv, &kernel_devs, devs_health, devs_in_sync, NULL))
- return 0;
+ return_0;
if (kernel_devs == dev_count)
return 1;
@@ -1773,7 +1773,7 @@ static int _reshape_adjust_to_size(struct logical_volume *lv,
uint32_t new_le_count;
if (!_lv_reshape_get_new_len(lv, old_image_count, new_image_count, &new_le_count))
- return 0;
+ return_0;
/* Externally visible LV size w/o reshape space */
lv->le_count = seg->len = new_le_count;
@@ -1836,7 +1836,7 @@ static int _raid_reshape_add_images(struct logical_volume *lv,
}
if (!_lv_reshape_get_new_len(lv, old_image_count, new_image_count, &grown_le_count))
- return 0;
+ return_0;
current_le_count = lv->le_count - _reshape_len_per_lv(lv);
grown_le_count -= _reshape_len_per_dev(seg) * _data_rimages_count(seg, new_image_count);
@@ -1861,7 +1861,7 @@ static int _raid_reshape_add_images(struct logical_volume *lv,
new_image_count - old_image_count, new_image_count - old_image_count > 1 ? "s" : "",
display_lvname(lv));
if (!_lv_raid_change_image_count(lv, 1, new_image_count, allocate_pvs, NULL, 0, 0))
- return 0;
+ return_0;
/* Reshape adding image component pairs -> change sizes/counters accordingly */
if (!_reshape_adjust_to_size(lv, old_image_count, new_image_count)) {
@@ -1872,7 +1872,7 @@ static int _raid_reshape_add_images(struct logical_volume *lv,
/* Allocate forward out of place reshape space at the beginning of all data image LVs */
log_debug_metadata("(Re)allocating reshape space for %s.", display_lvname(lv));
if (!_lv_alloc_reshape_space(lv, alloc_begin, NULL, allocate_pvs))
- return 0;
+ return_0;
/*
* Reshape adding image component pairs:
@@ -1947,7 +1947,7 @@ static int _raid_reshape_remove_images(struct logical_volume *lv,
}
if (!_lv_reshape_get_new_len(lv, old_image_count, new_image_count, &reduced_le_count))
- return 0;
+ return_0;
reduced_le_count -= seg->reshape_len * _data_rimages_count(seg, new_image_count);
current_le_count = lv->le_count - seg->reshape_len * _data_rimages_count(seg, old_image_count);
@@ -1985,7 +1985,7 @@ static int _raid_reshape_remove_images(struct logical_volume *lv,
* to remove disks from a raid set
*/
if (!_lv_alloc_reshape_space(lv, alloc_end, NULL, allocate_pvs))
- return 0;
+ return_0;
/* Flag all disks past new images as delta disks minus to kernel */
for (s = new_image_count; s < old_image_count; s++)
@@ -2031,7 +2031,7 @@ static int _raid_reshape_remove_images(struct logical_volume *lv,
old_image_count - new_image_count, old_image_count - new_image_count > 1 ? "s" : "",
display_lvname(lv));
if (!_lv_raid_change_image_count(lv, 1, new_image_count, allocate_pvs, removal_lvs, 0, 0))
- return 0;
+ return_0;
seg->area_count = new_image_count;
break;
@@ -2102,7 +2102,7 @@ static int _raid_reshape_keep_images(struct logical_volume *lv,
if (alloc_reshape_space &&
!_lv_alloc_reshape_space(lv, where, NULL, allocate_pvs))
- return 0;
+ return_0;
seg->segtype = new_segtype;
@@ -2198,7 +2198,7 @@ static int _pre_raid0_remove_rmeta(struct logical_volume *lv, void *data)
struct dm_list *lv_list = data;
if (!_vg_write_lv_suspend_vg_commit(lv, 1))
- return 0;
+ return_0;
/* 1: ok+ask caller to update, 2: metadata commited+ask caller to resume */
return _activate_sub_lvs_excl_local_list(lv, lv_list) ? 2 : 0;
@@ -2245,7 +2245,7 @@ static int _raid_reshape(struct logical_volume *lv,
return_0;
if (!_check_region_size_constraints(lv, new_segtype, new_region_size, new_stripe_size))
- return 0;
+ return_0;
if (!_raid_in_sync(lv)) {
log_error("Unable to convert %s while it is not in-sync.",
@@ -2343,7 +2343,7 @@ static int _raid_reshape(struct logical_volume *lv,
if (!_raid_reshape_add_images(lv, new_segtype, yes,
old_image_count, new_image_count,
new_stripes, new_stripe_size, allocate_pvs))
- return 0;
+ return_0;
/* Handle disk removal reshaping */
} else if (old_image_count > new_image_count) {
@@ -2351,7 +2351,7 @@ static int _raid_reshape(struct logical_volume *lv,
old_image_count, new_image_count,
new_stripes, new_stripe_size,
allocate_pvs, &removal_lvs))
- return 0;
+ return_0;
/*
* Handle raid set layout reshaping w/o changing # of legs (allocation algorithm or stripe size change)
@@ -2359,7 +2359,7 @@ static int _raid_reshape(struct logical_volume *lv,
*/
} else if (!_raid_reshape_keep_images(lv, new_segtype, yes, force, &force_repair,
new_data_copies, new_stripe_size, allocate_pvs))
- return 0;
+ return_0;
/* HM FIXME: workaround for not resetting "nosync" flag */
init_mirror_in_sync(0);
@@ -2368,13 +2368,13 @@ static int _raid_reshape(struct logical_volume *lv,
/* https://bugzilla.redhat.com/1447812 also check open count */
if (!_check_lv_open_count(lv, 1))
- return 0;
+ return_0;
if (seg->area_count != 2 || old_image_count != seg->area_count) {
if (!_lv_update_reload_fns_reset_eliminate_lvs(lv, 0, &removal_lvs, NULL))
- return 0;
+ return_0;
} if (!_vg_write_commit_backup(lv->vg))
- return 0;
+ return_0;
return 1;
/* FIXME force_repair ? _lv_cond_repair(lv) : 1; */
@@ -3549,7 +3549,7 @@ static int _add_image_component_list(struct lv_segment *seg, int delete_from_lis
if (delete_from_list)
dm_list_del(&lvl->list);
if (!_add_component_lv(seg, lvl->lv, lv_flags, s++))
- return 0;
+ return_0;
}
return 1;
@@ -3655,7 +3655,7 @@ static int _extract_image_component_sublist(struct lv_segment *seg,
for (s = idx; s < end; s++) {
if (!_extract_image_component_error_seg(seg, type, s, &lvl->lv, error_seg))
- return 0;
+ return_0;
dm_list_add(removal_lvs, &lvl->list);
lvl++;
@@ -3812,7 +3812,7 @@ static int _raid0_add_or_remove_metadata_lvs(struct logical_volume *lv,
new_raid_type_flag = SEG_RAID0;
} else {
if (!_alloc_and_add_rmeta_devs_for_lv(lv, allocate_pvs))
- return 0;
+ return_0;
new_raid_type_flag = SEG_RAID0_META;
}
@@ -4526,7 +4526,7 @@ static int _process_type_flags(const struct logical_volume *lv, struct possible_
!(t & seg->segtype->flags) &&
((segtype = get_segtype_from_flag(lv->vg->cmd, t))))
if (!tfn(processed_segtypes, data ? : (void *) segtype))
- return 0;
+ return_0;
}
return 1;
@@ -4857,7 +4857,7 @@ static int _clear_meta_lvs(struct logical_volume *lv)
dm_list_iterate_items(lvl, &meta_lvs) {
lv_set_hidden(lvl->lv);
if (!set_lv_segment_area_lv(seg, s++, lvl->lv, 0, RAID_META))
- return 0;
+ return_0;
}
return 1;
@@ -5011,7 +5011,7 @@ static int _raid45_to_raid54_wrapper(TAKEOVER_FN_ARGS)
/* Shift parity SubLV pair "PDD..." <-> "DD...P" on raid4 <-> raid5_n conversion */
if( !_shift_parity_dev(seg))
- return 0;
+ return_0;
/* Don't resync */
init_mirror_in_sync(1);
@@ -5051,7 +5051,7 @@ static int _takeover_downconvert_wrapper(TAKEOVER_FN_ARGS)
}
if (!_check_region_size_constraints(lv, new_segtype, new_region_size, new_stripe_size))
- return 0;
+ return_0;
if (seg_is_any_raid10(seg) && (seg->area_count % seg->data_copies)) {
log_error("Can't convert %s LV %s to %s with odd number of stripes.",
@@ -5096,12 +5096,12 @@ static int _takeover_downconvert_wrapper(TAKEOVER_FN_ARGS)
if (seg_is_raid4(seg)) {
/* Shift parity SubLV pair "PDD..." -> "DD...P" to be able to remove it off the end */
if (!_shift_parity_dev(seg))
- return 0;
+ return_0;
} else if (seg_is_raid10_near(seg)) {
log_debug_metadata("Reordering areas for raid10 -> raid0 takeover.");
if (!_reorder_raid10_near_seg_areas(seg, reorder_from_raid10_near))
- return 0;
+ return_0;
}
if (segtype_is_any_raid0(new_segtype) &&
@@ -5116,7 +5116,7 @@ static int _takeover_downconvert_wrapper(TAKEOVER_FN_ARGS)
lv_raid_image_count(lv) - new_image_count,
display_lvname(lv));
if (!_lv_raid_change_image_count(lv, 1, new_image_count, allocate_pvs, &removal_lvs, 0, 0))
- return 0;
+ return_0;
seg->area_count = new_image_count;
}
@@ -5266,7 +5266,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
}
if (!_check_region_size_constraints(lv, new_segtype, new_region_size, new_stripe_size))
- return 0;
+ return_0;
/* Archive metadata */
if (!archive(lv->vg))
@@ -5287,7 +5287,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
if (seg_is_raid0(seg)) {
log_debug_metadata("Adding metadata LVs to %s.", display_lvname(lv));
if (!_raid0_add_or_remove_metadata_lvs(lv, 0 /* update_and_reload */, allocate_pvs, NULL))
- return 0;
+ return_0;
}
/* Have to be cleared in conversion from raid0_meta -> raid4 or kernel will reject due to reordering disks */
@@ -5337,7 +5337,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
if (!_eliminate_extracted_lvs(lv->vg, &removal_lvs)) /* Updates vg */
return_0;
- return 0;
+ return_0;
}
seg = first_seg(lv);
@@ -5367,11 +5367,11 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
if (!_raid45_to_raid54_wrapper(lv, raid5_n_segtype, 1 /* yes */, force, seg->area_count,
1 /* data_copies */, 0, 0, 0, allocate_pvs))
- return 0;
+ return_0;
if (!_drop_suffix(meta_lv->name, "_extracted") ||
!_drop_suffix(data_lv->name, "_extracted"))
- return 0;
+ return_0;
data_lv->status |= RAID_IMAGE;
meta_lv->status |= RAID_META;
@@ -5386,7 +5386,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
} else if (segtype_is_raid5_n(new_segtype) &&
!_raid45_to_raid54_wrapper(lv, raid5_n_segtype, yes, force, seg->area_count,
1 /* data_copies */, 0, 0, 0, allocate_pvs))
- return 0;
+ return_0;
}
seg->data_copies = new_data_copies;
@@ -5402,7 +5402,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
log_debug_metadata("Reordering areas for raid0 -> raid10_near takeover.");
if (!_reorder_raid10_near_seg_areas(seg, reorder_to_raid10_near))
- return 0;
+ return_0;
/* Set rebuild flags accordingly */
for (s = 0; s < seg->area_count; s++) {
seg_lv(seg, s)->status &= ~LV_REBUILD;
@@ -5420,7 +5420,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
log_debug_metadata("Updating VG metadata and reloading %s LV %s.",
lvseg_name(seg), display_lvname(lv));
if (!_lv_update_reload_fns_reset_eliminate_lvs(lv, 0, &removal_lvs, NULL))
- return 0;
+ return_0;
if (segtype_is_raid4(new_segtype) &&
seg->area_count != 2) {
@@ -6094,7 +6094,7 @@ static int _region_size_change_requested(struct logical_volume *lv, int yes, con
}
if (!_check_region_size_constraints(lv, seg->segtype, region_size, seg->stripe_size))
- return 0;
+ return_0;
if (!_raid_in_sync(lv)) {
log_error("Unable to change region size on %s LV %s while it is not in-sync.",
@@ -6348,12 +6348,12 @@ int lv_raid_convert(struct logical_volume *lv,
/* https://bugzilla.redhat.com/1447812 reject reshape on open LV */
if (!_check_lv_open_count(lv, 0))
- return 0;
+ return_0;
if (!_lv_open_excl(lv, &dev))
- return 0;
+ return_0;
if (!_check_lv_open_count(lv, 1)) {
dev_close(dev);
- return 0;
+ return_0;
}
if (!_raid_reshape(lv, new_segtype, yes, force,
@@ -6377,7 +6377,8 @@ int lv_raid_convert(struct logical_volume *lv,
/* Prohibit any takeover in case sub LVs to be removed still exist after a previous reshape */
if (!_get_available_removed_sublvs(lv, &available_slvs, &removed_slvs))
- return 0;
+ return_0;
+
if (removed_slvs) {
log_error("Can't convert %s LV %s to %s containing sub LVs to remove after a reshape.",
lvseg_name(seg), display_lvname(lv), new_segtype->name);
6 years, 11 months
master - raid: use log_error on error path
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=07fe64b47317daba174...
Commit: 07fe64b47317daba1744c8c1ccbef38754fe8a4e
Parent: 61980bcf0624790bfdc07d371fd510d1c4079fb5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 21 11:58:38 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 21 12:35:17 2017 +0200
raid: use log_error on error path
Converting log_warn to log_error since error must be logged
when tool returns error.
---
lib/metadata/raid_manip.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 31fb0f7..b91bfba 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1969,7 +1969,7 @@ static int _raid_reshape_remove_images(struct logical_volume *lv,
new_stripes, display_lvname(lv));
if (!force) {
- log_warn("WARNING: Can't remove stripes without --force option.");
+ log_error("Can't remove stripes without --force option.");
return 0;
}
@@ -5956,7 +5956,7 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
/* raid1 -> */
} else if (seg_is_raid1(seg_from) && !segtype_is_mirror(*segtype)) {
if (seg_from->area_count != 2) {
- log_warn("Convert %s LV %s to 2 images first.",
+ log_error("Convert %s LV %s to 2 images first.",
lvseg_name(seg_from), display_lvname(seg_from->lv));
return 0;
@@ -5972,8 +5972,8 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
} else if (seg_is_raid4(seg_from) || seg_is_any_raid5(seg_from)) {
if (segtype_is_raid1(*segtype) &&
seg_from->area_count != 2) {
- log_warn("Convert %s LV %s to 2 stripes first (i.e. --stripes 1).",
- lvseg_name(seg_from), display_lvname(seg_from->lv));
+ log_error("Convert %s LV %s to 2 stripes first (i.e. --stripes 1).",
+ lvseg_name(seg_from), display_lvname(seg_from->lv));
return 0;
} else if (seg_is_raid4(seg_from) &&
@@ -5988,8 +5988,8 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
else if (segtype_is_raid10(*segtype)) {
if (seg_from->area_count < 3) {
- log_warn("Convert %s LV %s to minimum 3 stripes first (i.e. --stripes 2).",
- lvseg_name(seg_from), display_lvname(seg_from->lv));
+ log_error("Convert %s LV %s to minimum 3 stripes first (i.e. --stripes 2).",
+ lvseg_name(seg_from), display_lvname(seg_from->lv));
return 0;
}
@@ -5997,8 +5997,8 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
} else if (segtype_is_any_raid6(*segtype)) {
if (seg_from->area_count < 4) {
- log_warn("Convert %s LV %s to minimum 4 stripes first (i.e. --stripes 3).",
- lvseg_name(seg_from), display_lvname(seg_from->lv));
+ log_error("Convert %s LV %s to minimum 4 stripes first (i.e. --stripes 3).",
+ lvseg_name(seg_from), display_lvname(seg_from->lv));
return 0;
} else if (seg_is_raid4(seg_from) && !segtype_is_raid6_n_6(*segtype))
@@ -6034,12 +6034,12 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
/* -> raid1 */
} else if (!seg_is_mirror(seg_from) && segtype_is_raid1(*segtype)) {
if (!seg_is_raid4(seg_from) && !seg_is_any_raid5(seg_from)) {
- log_warn("Convert %s LV %s to raid4/raid5 first.",
- lvseg_name(seg_from), display_lvname(seg_from->lv));
+ log_error("Convert %s LV %s to raid4/raid5 first.",
+ lvseg_name(seg_from), display_lvname(seg_from->lv));
return 0;
} else if (seg_from->area_count != 2) {
- log_warn("Convert %s LV %s to 2 stripes first (i.e. --stripes 1).",
+ log_error("Convert %s LV %s to 2 stripes first (i.e. --stripes 1).",
lvseg_name(seg_from), display_lvname(seg_from->lv));
return 0;
6 years, 11 months
master - raid: report error when specified devices are not contained
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=61980bcf0624790bfdc...
Commit: 61980bcf0624790bfdc07d371fd510d1c4079fb5
Parent: 31d153ced07dda004cff3a67a6e9a740b52253fd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 21 11:45:20 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 21 12:35:17 2017 +0200
raid: report error when specified devices are not contained
lvm2 always return non-zero error code when action cannot happen.
---
lib/metadata/raid_manip.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index ab89bdf..31fb0f7 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6660,9 +6660,9 @@ static int _lv_raid_rebuild_or_replace(struct logical_volume *lv,
}
if (!match_count) {
- log_print_unless_silent("%s does not contain devices specified to %s.",
- display_lvname(lv), action_str);
- return 1;
+ log_error("Logical volume %s does not contain devices specified to %s.",
+ display_lvname(lv), action_str);
+ return 0;
} else if (match_count == raid_seg->area_count) {
log_error("Unable to %s all PVs from %s at once.",
action_str, display_lvname(lv));
6 years, 11 months
master - raid: drop debug code
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=31d153ced07dda004cf...
Commit: 31d153ced07dda004cff3a67a6e9a740b52253fd
Parent: 49fa2bea1c82c4763fb87785683040fc0fe093d7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 21 11:09:47 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 21 12:35:16 2017 +0200
raid: drop debug code
---
lib/metadata/raid_manip.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index d3bbb60..ab89bdf 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -562,7 +562,6 @@ static int _lv_update_reload_fns_reset_eliminate_lvs(struct logical_volume *lv,
display_lvname(lv), display_lvname(lock_lv));
origin_only = 0;
}
- origin_only = 0;
/* TODO/FIXME: this function should be simplified to just call
* lv_update_and_reload() and cleanup of remained LVs */
6 years, 11 months
master - raid: more origin_only updates
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=49fa2bea1c82c4763fb...
Commit: 49fa2bea1c82c4763fb87785683040fc0fe093d7
Parent: 1766eaec4b65a3e6d0cd54bca5ed11d73f675d90
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 21 11:17:03 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 21 12:35:16 2017 +0200
raid: more origin_only updates
Seems the code is multiplied - so keep it consistent for now.
TODO: drop all uneeded code
---
lib/metadata/raid_manip.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 290dec7..d3bbb60 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -650,6 +650,12 @@ static int _lv_update_and_reload_list(struct logical_volume *lv, int origin_only
struct lv_list *lvl;
int r;
+ if (lock_lv != lv) {
+ log_debug_activation("Dropping origin_only for %s as lock holds %s",
+ display_lvname(lv), display_lvname(lock_lv));
+ origin_only = 0;
+ }
+
log_very_verbose("Updating logical volume %s on disk(s)%s.",
display_lvname(lock_lv), origin_only ? " (origin only)": "");
@@ -2112,15 +2118,22 @@ static int _vg_write_lv_suspend_commit_backup(struct volume_group *vg,
struct logical_volume *lv,
int origin_only, int do_backup)
{
+ const struct logical_volume *lock_lv = lv_lock_holder(lv);
int r = 1;
+ if (lock_lv != lv) {
+ log_debug_activation("Dropping origin_only for %s as lock holds %s",
+ display_lvname(lv), display_lvname(lock_lv));
+ origin_only = 0;
+ }
+
if (!vg_write(vg)) {
log_error("Write of VG %s failed.", vg->name);
return_0;
}
- if (lv && !(r = (origin_only ? suspend_lv_origin(vg->cmd, lv_lock_holder(lv)) :
- suspend_lv(vg->cmd, lv_lock_holder(lv))))) {
+ if (lv && !(r = (origin_only ? suspend_lv_origin(vg->cmd, lock_lv) :
+ suspend_lv(vg->cmd, lock_lv)))) {
log_error("Failed to suspend %s before committing changes.",
display_lvname(lv));
vg_revert(lv->vg);
6 years, 11 months
master - lvconvert: provide better reshape reject message for open RaidLV
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1766eaec4b65a3e6d0c...
Commit: 1766eaec4b65a3e6d0cd54bca5ed11d73f675d90
Parent: 76314183e28321741bec1cb769a7d8a77e5faa81
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Tue Jun 20 19:06:18 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Tue Jun 20 19:06:18 2017 +0200
lvconvert: provide better reshape reject message for open RaidLV
On commits
5e611c700ba1032ffb71bf0cdd33e062e5e16439 and
601ad1c73faa5fe3d74ff5b06cc47073b40a1850.
Related: rhbz1447812
---
lib/metadata/raid_manip.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 8a5ae32..290dec7 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -84,7 +84,8 @@ static int _check_lv_open_count(struct logical_volume *lv, int open_count) {
return 0;
}
if (info.open_count != open_count) {
- log_error("Reshape of open %s not supported.", display_lvname(lv));
+ log_error("Reshape is only supported when %s is not in use (e.g. unmount filesystem).",
+ display_lvname(lv));
return 0;
}
@@ -6205,7 +6206,8 @@ static int _lv_open_excl(struct logical_volume *lv, struct device **dev) {
if (!(*dev = dev_create_file(dev_path, NULL, NULL, 0)))
return_0;
if (!dev_open_flags(*dev, O_EXCL, 1, 1)) {
- log_error("Reshape of open %s not supported.", display_lvname(lv));
+ log_error("Reshape is only supported when %s is not in use (e.g. unmount filesystem).",
+ display_lvname(lv));
return 0;
}
6 years, 11 months
master - raid: avoid explicit activation of SubLVs on reshape/takeover
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=76314183e28321741be...
Commit: 76314183e28321741bec1cb769a7d8a77e5faa81
Parent: 0dfe1bc29d0ba4da31e83e25d338bfe46209c96c
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Tue Jun 20 18:56:45 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Tue Jun 20 18:56:45 2017 +0200
raid: avoid explicit activation of SubLVs on reshape/takeover
Remove explicit activation of SubLVs and let lv_update_and_reload()
perform the proper (pre-)loading sequencing of tables.
This avoids related callback functions which are removed.
Related: rhbz1448116
Related: rhbz1461526
Related: rhbz1448123
---
lib/metadata/raid_manip.c | 54 +-------------------------------------------
1 files changed, 2 insertions(+), 52 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index a832f7b..8a5ae32 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2160,24 +2160,6 @@ static int _activate_sub_lv_excl_local(struct logical_volume *lv)
return 1;
}
-/* Helper: function to activate any sub LVs of @lv exclusively local starting with area indexed by @start_idx */
-static int _activate_sub_lvs_excl_local(struct logical_volume *lv, uint32_t start_idx)
-{
- uint32_t s;
- struct lv_segment *seg = first_seg(lv);
-
- /* seg->area_count may be 0 here! */
- log_debug_metadata("Activating %u image component%s of LV %s.",
- seg->area_count - start_idx, seg->meta_areas ? " pairs" : "s",
- display_lvname(lv));
- for (s = start_idx; s < seg->area_count; s++)
- if (!_activate_sub_lv_excl_local(seg_lv(seg, s)) ||
- (seg->meta_areas && !_activate_sub_lv_excl_local(seg_metalv(seg, s))))
- return_0;
-
- return 1;
-}
-
/* Helper: function to activate any LVs on @lv_list */
static int _activate_sub_lvs_excl_local_list(struct logical_volume *lv, struct dm_list *lv_list)
{
@@ -2196,20 +2178,6 @@ static int _activate_sub_lvs_excl_local_list(struct logical_volume *lv, struct d
return r;
}
-/* Helper: callback function to activate image component pairs of @lv to update size after reshape space allocation */
-static int _pre_raid_reactivate_legs(struct logical_volume *lv, void *data)
-{
- if (!_vg_write_lv_suspend_vg_commit(lv, 1))
- return 0;
-
- /* Reload any changed image component pairs for out-of-place reshape space */
- if (!_activate_sub_lvs_excl_local(lv, 0))
- return 0;
-
- /* 1: ok+ask caller to update, 2: metadata commited+ask caller to resume */
- return 2;
-}
-
/* Helper: callback function to activate any rmetas on @data list */
__attribute__ ((__unused__))
static int _pre_raid0_remove_rmeta(struct logical_volume *lv, void *data)
@@ -2223,20 +2191,6 @@ static int _pre_raid0_remove_rmeta(struct logical_volume *lv, void *data)
return _activate_sub_lvs_excl_local_list(lv, lv_list) ? 2 : 0;
}
-/* Helper: callback dummy needed for takeover+reshape */
-static int _post_raid_reshape(struct logical_volume *lv, void *data)
-{
- /* 1: ask caller to update, 2: don't ask caller to update */
- return 1;
-}
-
-/* Helper: callback dummy needed for takeover+reshape */
-static int _post_raid_takeover(struct logical_volume *lv, void *data)
-{
- /* 1: ask caller to update, 2: don't ask caller to update */
- return 2;
-}
-
/*
* Reshape logical volume @lv by adding/removing stripes
* (absolute new stripes given in @new_stripes), changing
@@ -2404,9 +2358,7 @@ static int _raid_reshape(struct logical_volume *lv,
return 0;
if (seg->area_count != 2 || old_image_count != seg->area_count) {
- if (!_lv_update_reload_fns_reset_eliminate_lvs(lv, 0, &removal_lvs,
- _post_raid_reshape, NULL,
- _pre_raid_reactivate_legs, NULL))
+ if (!_lv_update_reload_fns_reset_eliminate_lvs(lv, 0, &removal_lvs, NULL))
return 0;
} if (!_vg_write_commit_backup(lv->vg))
return 0;
@@ -5454,9 +5406,7 @@ static int _takeover_upconvert_wrapper(TAKEOVER_FN_ARGS)
log_debug_metadata("Updating VG metadata and reloading %s LV %s.",
lvseg_name(seg), display_lvname(lv));
- if (!_lv_update_reload_fns_reset_eliminate_lvs(lv, 0, &removal_lvs,
- _post_raid_takeover, NULL,
- _pre_raid_reactivate_legs, NULL))
+ if (!_lv_update_reload_fns_reset_eliminate_lvs(lv, 0, &removal_lvs, NULL))
return 0;
if (segtype_is_raid4(new_segtype) &&
6 years, 11 months
master - raid: provide clickable URL BZ references
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0dfe1bc29d0ba4da31e...
Commit: 0dfe1bc29d0ba4da31e83e25d338bfe46209c96c
Parent: 710f51e7f24bfc6c4e4300e4bec3316796bf0c78
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Tue Jun 20 18:42:09 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Tue Jun 20 18:43:26 2017 +0200
raid: provide clickable URL BZ references
---
lib/metadata/raid_manip.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 6d3a509..a832f7b 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -75,7 +75,7 @@ static int _rebuild_with_emptymeta_is_supported(struct cmd_context *cmd,
return 1;
}
-/* BZ1447812: check open count of @lv vs. @open_count */
+/* https://bugzilla.redhat.com/1447812 check open count of @lv vs. @open_count */
static int _check_lv_open_count(struct logical_volume *lv, int open_count) {
struct lvinfo info = { 0 };
@@ -2399,7 +2399,7 @@ static int _raid_reshape(struct logical_volume *lv,
seg->region_size = new_region_size;
- /* BZ1447812: also check open count */
+ /* https://bugzilla.redhat.com/1447812 also check open count */
if (!_check_lv_open_count(lv, 1))
return 0;
@@ -6242,7 +6242,7 @@ static int _conversion_options_allowed(const struct lv_segment *seg_from,
return r;
}
-/* BZ1447812: try opening LV exclusively */
+/* https://bugzilla.redhat.com/1447812 try opening LV exclusively */
static int _lv_open_excl(struct logical_volume *lv, struct device **dev) {
char *dev_path;
size_t sz = strlen(lv->vg->cmd->dev_dir) + strlen(lv->vg->name) + strlen(lv->name) + 2;
@@ -6363,7 +6363,7 @@ int lv_raid_convert(struct logical_volume *lv,
new_stripes, new_stripe_size_supplied))
return _log_possible_conversion_types(lv, new_segtype);
- /* BZ1439399 */
+ /* https://bugzilla.redhat.com/1439399 */
if (lv_is_origin(lv)) {
log_error("Can't convert snapshot origin %s.", display_lvname(lv));
return 0;
@@ -6382,7 +6382,7 @@ int lv_raid_convert(struct logical_volume *lv,
return 0;
}
- /* BZ1447812: reject reshape on open LV */
+ /* https://bugzilla.redhat.com/1447812 reject reshape on open LV */
if (!_check_lv_open_count(lv, 0))
return 0;
if (!_lv_open_excl(lv, &dev))
6 years, 11 months