mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Add a validation step for pvmoveN internal LVs to vg_validate.
This commit is contained in:
parent
7e0db38528
commit
75b2f3507a
@ -2157,6 +2157,7 @@ int vg_validate(struct volume_group *vg)
|
||||
{
|
||||
struct pv_list *pvl, *pvl2;
|
||||
struct lv_list *lvl, *lvl2;
|
||||
struct lv_segment *seg;
|
||||
char uuid[64] __attribute__((aligned(8)));
|
||||
int r = 1;
|
||||
uint32_t hidden_lv_count = 0, lv_count = 0, lv_visible_count = 0;
|
||||
@ -2318,6 +2319,26 @@ int vg_validate(struct volume_group *vg)
|
||||
}
|
||||
}
|
||||
|
||||
dm_list_iterate_items(lvl, &vg->lvs) {
|
||||
if (!(lvl->lv->status & PVMOVE))
|
||||
continue;
|
||||
dm_list_iterate_items(seg, &lvl->lv->segments) {
|
||||
if (seg_is_mirrored(seg)) {
|
||||
if (seg->area_count != 2) {
|
||||
log_error(INTERNAL_ERROR
|
||||
"Segment %d in %s is not 2-way.",
|
||||
loop_counter1, lvl->lv->name);
|
||||
r = 0;
|
||||
}
|
||||
} else if (seg->area_count != 1) {
|
||||
log_error(INTERNAL_ERROR
|
||||
"Segment %d in %s has wrong number of areas: %d.",
|
||||
loop_counter1, lvl->lv->name, seg->area_count);
|
||||
r = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(vg->fid->fmt->features & FMT_UNLIMITED_VOLS) &&
|
||||
(!vg->max_lv || !vg->max_pv)) {
|
||||
log_error(INTERNAL_ERROR "Volume group %s has limited PV/LV count"
|
||||
|
Loading…
Reference in New Issue
Block a user