diff options
author | Chris Lumens <clumens@redhat.com> | 2006-05-24 17:24:03 +0000 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2006-05-24 17:24:03 +0000 |
commit | b5196ea09c02993061ca41b614b2cb03a0fba9d4 (patch) | |
tree | 95640f57a9dfd51c5988ed2bdd09d011afc3aa7d | |
parent | 87c1e94bdc02289ca3f6e029932d6d53cdb232e8 (diff) | |
download | anaconda-b5196ea09c02993061ca41b614b2cb03a0fba9d4.tar.gz anaconda-b5196ea09c02993061ca41b614b2cb03a0fba9d4.tar.xz anaconda-b5196ea09c02993061ca41b614b2cb03a0fba9d4.zip |
Don't allow logical volumes to be smaller than their volume group's PE size
(#186412).
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | kickstart.py | 18 |
2 files changed, 15 insertions, 7 deletions
@@ -1,5 +1,9 @@ 2006-05-23 Chris Lumens <clumens@redhat.com> + * kickstart.py (AnacondaKSHandlers.doLogicalVolume): Don't allow + logical volumes to be smaller than their volume group's PE size + (#186412). + * scripts/upd-instroot: glib2 has moved. 2006-05-23 Chris Lumens <clumens@redhat.com> diff --git a/kickstart.py b/kickstart.py index c58a04eb5..2e9e715f8 100644 --- a/kickstart.py +++ b/kickstart.py @@ -219,13 +219,6 @@ class AnacondaKSHandlers(KickstartHandlers): if lvd.mountpoint != "" and lvd.mountpoint[0] != '/': raise KickstartValueError, formatErrorMsg(self.lineno, msg="The mount point \"%s\" is not valid." % (lvd.mountpoint,)) - if lvd.percent == 0: - if lvd.size == 0 and not lvd.preexist: - raise KickstartValueError, formatErrorMsg(self.lineno, - msg="Size required") - elif lvd.percent <= 0 or lvd.percent > 100: - raise KickstartValueError, formatErrorMsg(self.lineno, msg="Percentage must be between 0 and 100") - try: vgid = self.ksVGMapping[lvd.vgname] except KeyError: @@ -235,10 +228,21 @@ class AnacondaKSHandlers(KickstartHandlers): if areq.type == REQUEST_LV: if areq.volumeGroup == vgid and areq.logicalVolumeName == lvd.name: raise KickstartValueError, formatErrorMsg(self.lineno, msg="Logical volume name already used in volume group %s" % lvd.vgname) + elif areq.type == REQUEST_VG and areq.uniqueID == vgid: + # Store a reference to the VG so we can do the PE size check. + vg = areq if not self.ksVGMapping.has_key(lvd.vgname): raise KickstartValueError, formatErrorMsg(self.lineno, msg="Logical volume specifies a non-existent volume group" % lvd.name) + if lvd.percent == 0: + if lvd.size == 0 and not lvd.preexist: + raise KickstartValueError, formatErrorMsg(self.lineno, msg="Size required") + elif lvd.size*1024 < vg.pesize and not lvd.grow: + raise KickstartValueError, formatErrorMsg(self.lineno, msg="Logical volume size must be larger than the volume group physical extent size.") + elif lvd.percent <= 0 or lvd.percent > 100: + raise KickstartValueError, formatErrorMsg(self.lineno, msg="Percentage must be between 0 and 100") + request = partRequests.LogicalVolumeRequestSpec(filesystem, format = lvd.format, mountpoint = lvd.mountpoint, |