mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
validation: support empty lv segments
Revert 373372c8ab
and instead update
our validation code to handle LVs with empty segment - currently
we should need this only for pvmove operation, thus such LV should
have name 'pvmove%u'.
This fixes a problem where user tried i.e. pvmove on a VG with single
PV - as reported: https://github.com/lvmteam/lvm2/issues/148
Reported-by: bob@redhat.com
This commit is contained in:
parent
9df8dd97c3
commit
07b6174f7c
@ -8654,19 +8654,9 @@ int insert_layer_for_segments_on_pv(struct cmd_context *cmd,
|
||||
layer_lv->name, lv_where->name,
|
||||
pvl ? pv_dev_name(pvl->pv) : "any");
|
||||
|
||||
/* Temporarily hide layer_lv from vg->lvs list
|
||||
* so the lv_split_segment() passes vg_validate()
|
||||
* since here layer_lv has empty segment list */
|
||||
if (!(lvl = find_lv_in_vg(lv_where->vg, layer_lv->name)))
|
||||
return_0;
|
||||
dm_list_del(&lvl->list);
|
||||
|
||||
if (!_align_segment_boundary_to_pe_range(lv_where, pvl))
|
||||
return_0;
|
||||
|
||||
/* Put back layer_lv in vg->lv */
|
||||
dm_list_add(&lv_where->vg->lvs, &lvl->list);
|
||||
|
||||
/* Work through all segments on the supplied PV */
|
||||
dm_list_iterate_items(seg, &lv_where->segments) {
|
||||
for (s = 0; s < seg->area_count; s++) {
|
||||
|
@ -744,9 +744,13 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
|
||||
}
|
||||
|
||||
if (!le) {
|
||||
if (sscanf(lv->name, "pvmove%u", &le) == 1)
|
||||
log_debug("LV pvmove %s has no segment.", lv->name);
|
||||
else {
|
||||
log_error("LV %s: has no segment.", lv->name);
|
||||
inc_error_count;
|
||||
}
|
||||
}
|
||||
|
||||
dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
|
||||
seg = sl->seg;
|
||||
|
Loading…
Reference in New Issue
Block a user