]> sourceware.org Git - lvm2.git/commitdiff
Fix setting of volume limit count if converting to lvm1 format.
authorMilan Broz <mbroz@redhat.com>
Fri, 29 Aug 2008 13:41:21 +0000 (13:41 +0000)
committerMilan Broz <mbroz@redhat.com>
Fri, 29 Aug 2008 13:41:21 +0000 (13:41 +0000)
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)
  ...

WHATS_NEW
lib/metadata/metadata.c
tools/vgconvert.c

index 7524edfdf6608945785f032e822632677bafd6c7..52c381978f95f6dc5cf1fde597b9643427f1ab97 100644 (file)
--- 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.
index fc90adfa151ae68c6816828b331b0781044b8462..f1f8f99400654ecb14323b7e8a6a6659a2f01340 100644 (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;
 }
 
index 0b7d978c0523dbe795c97de9a2eefbc61435bfd6..9cc5406ca84203a337b09ff92776e28c2164a450 100644 (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)
This page took 0.043295 seconds and 5 git commands to generate.