1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-08-03 08:22:00 +03:00
This commit is contained in:
Alasdair Kergon
2001-10-16 16:25:28 +00:00
parent d36240499b
commit a381c45a6e
14 changed files with 301 additions and 28 deletions

View File

@ -319,6 +319,9 @@ int read_pvs_in_vg(const char *vg_name, struct dev_filter *filter,
}
dev_iter_destroy(iter);
if (list_empty(head))
return 0;
return 1;
}

View File

@ -12,22 +12,34 @@
#include "log.h"
#include "display.h"
/* VG consistency checks */
static int _check_vgs(struct list_head *pvs)
{
struct list_head *tmp;
struct disk_list *dl;
struct vg_disk *first = NULL;
struct disk_list *first = NULL;
int pv_count = 0;
/* check all the vg's are the same */
list_for_each(tmp, pvs) {
dl = list_entry(tmp, struct disk_list, list);
if (!first)
first = &dl->vg;
else if (memcmp(first, &dl->vg, sizeof(*first))) {
log_err("vg data differs on pvs\n");
first = dl;
else if (memcmp(&first->vg, &dl->vg, sizeof(first->vg))) {
log_err("VG data differs between PVs %s and %s",
first->dev->name, dl->dev->name);
return 0;
}
pv_count++;
}
/* On entry to fn, list known to be non-empty */
if (!(pv_count == dl->vg.pv_cur)) {
log_error("Only %d out of %d PV(s) found for VG %s",
pv_count, dl->vg.pv_cur, dl->pv.vg_name);
return 0;
}
return 1;
@ -313,6 +325,9 @@ static struct list_head *_get_vgs(struct io_space *is)
list_add(&nl->list, names);
}
if (list_empty(names))
goto bad;
return names;
bad:

View File

@ -64,6 +64,25 @@ static void _calc_simple_layout(struct pv_disk *pvd)
pvd->pe_on_disk.size = pvd->pe_total * sizeof(struct pe_disk);
}
int _check_vg_limits(struct disk_list *dl)
{
if (dl->vg.lv_max >= MAX_LV) {
log_error("MaxLogicalVolumes of %d exceeds format limit of %d "
"for VG '%s'", dl->vg.lv_max, MAX_LV - 1,
dl->pv.vg_name);
return 0;
}
if (dl->vg.pv_max >= MAX_PV) {
log_error("MaxPhysicalVolumes of %d exceeds format limit of %d "
"for VG '%s'", dl->vg.pv_max, MAX_PV - 1,
dl->pv.vg_name);
return 0;
}
return 1;
}
/*
* This assumes pe_count and pe_start have already
* been calculated correctly.
@ -74,10 +93,13 @@ int calculate_layout(struct disk_list *dl)
_calc_simple_layout(pvd);
if (!_adjust_pe_on_disk(pvd)) {
log_err("insufficient space for metadata and PE's.");
log_error("Insufficient space for metadata and PE's.");
return 0;
}
if (!_check_vg_limits(dl))
return 0;
return 1;
}