1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix setting of volume limit count if converting to lvm1 format.

Fixes problem when after downconvert to lvm1 VG is broken:

# lvcreate -n lv1 -l 4 vg_test
  Invalid LV in extent map (PV /dev/sdb1, PE 0, LV 0, LE 0)
  ...
This commit is contained in:
Milan Broz 2008-08-29 13:41:21 +00:00
parent 18c8a64d3c
commit 3a2fb07349
3 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.40 -
================================
Fix setting of volume limit count if converting to lvm1 format.
Fix vgconvert logical volume id metadata validation.
Fix lvmdump metadata gather option (-m) to work correctly.
Fix allocation bug in text metadata format write error path.

View File

@ -1255,6 +1255,13 @@ int vg_validate(struct volume_group *vg)
}
}
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"
" but limit is not set.", vg->name);
r = 0;
}
return r;
}

View File

@ -81,6 +81,15 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
return ECMD_FAILED;
}
/* Set PV/LV limit if converting from unlimited metadata format */
if (vg->fid->fmt->features & FMT_UNLIMITED_VOLS &&
!(cmd->fmt->features & FMT_UNLIMITED_VOLS)) {
if (!vg->max_lv)
vg->max_lv = 255;
if (!vg->max_pv)
vg->max_pv = 255;
}
/* If converting to restricted lvid, check if lvid is compatible */
if (!(vg->fid->fmt->features & FMT_RESTRICTED_LVIDS) &&
cmd->fmt->features & FMT_RESTRICTED_LVIDS)