summaryrefslogtreecommitdiffstats
path: root/kickstart.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2006-05-24 17:24:03 +0000
committerChris Lumens <clumens@redhat.com>2006-05-24 17:24:03 +0000
commitb5196ea09c02993061ca41b614b2cb03a0fba9d4 (patch)
tree95640f57a9dfd51c5988ed2bdd09d011afc3aa7d /kickstart.py
parent87c1e94bdc02289ca3f6e029932d6d53cdb232e8 (diff)
downloadanaconda-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).
Diffstat (limited to 'kickstart.py')
-rw-r--r--kickstart.py18
1 files changed, 11 insertions, 7 deletions
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,