1
0
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:
Petr Rockai 2010-12-14 17:07:35 +00:00
parent 7e0db38528
commit 75b2f3507a

View File

@ -2157,6 +2157,7 @@ int vg_validate(struct volume_group *vg)
{ {
struct pv_list *pvl, *pvl2; struct pv_list *pvl, *pvl2;
struct lv_list *lvl, *lvl2; struct lv_list *lvl, *lvl2;
struct lv_segment *seg;
char uuid[64] __attribute__((aligned(8))); char uuid[64] __attribute__((aligned(8)));
int r = 1; int r = 1;
uint32_t hidden_lv_count = 0, lv_count = 0, lv_visible_count = 0; 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) && if (!(vg->fid->fmt->features & FMT_UNLIMITED_VOLS) &&
(!vg->max_lv || !vg->max_pv)) { (!vg->max_lv || !vg->max_pv)) {
log_error(INTERNAL_ERROR "Volume group %s has limited PV/LV count" log_error(INTERNAL_ERROR "Volume group %s has limited PV/LV count"