diff --git a/WHATS_NEW b/WHATS_NEW index 7524edfdf..52c381978 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -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. diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index fc90adfa1..f1f8f9940 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -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; } diff --git a/tools/vgconvert.c b/tools/vgconvert.c index 0b7d978c0..9cc5406ca 100644 --- a/tools/vgconvert.c +++ b/tools/vgconvert.c @@ -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)