Resolves: rhbz#1154068
It might still be possible to obtain a size if the recommended flag is set and the logvol's mountpoint is "swap".
Make logvol and partition code match, as much as possible.
Signed-off-by: mulhern amulhern@redhat.com --- pyanaconda/kickstart.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index f1cde9a..f67a0cc 100644 --- a/pyanaconda/kickstart.py +++ b/pyanaconda/kickstart.py @@ -761,17 +761,10 @@ class LogVolData(commands.logvol.RHEL7_LogVolData): # we might have truncated or otherwise changed the specified vg name vgname = ksdata.onPart.get(self.vgname, self.vgname)
+ size = None + if self.percent: size = Size(0) - else: - if not self.size: - raise KickstartValueError(formatErrorMsg(self.lineno, - msg="Size must be specified.")) - try: - size = Size("%d MiB" % self.size) - except ValueError: - raise KickstartValueError(formatErrorMsg(self.lineno, - msg="The size "%s" is invalid." % self.size))
if self.mountpoint == "swap": ty = "swap" @@ -786,6 +779,16 @@ class LogVolData(commands.logvol.RHEL7_LogVolData): else: ty = storage.defaultFSType
+ if size is None: + if not self.size: + raise KickstartValueError(formatErrorMsg(self.lineno, + msg="Size can not be decided on from kickstart nor obtained from device.")) + try: + size = Size("%d MiB" % self.size) + except ValueError: + raise KickstartValueError(formatErrorMsg(self.lineno, + msg="The size "%s" is invalid." % self.size)) + if self.thin_pool: self.mountpoint = "" ty = None @@ -1005,15 +1008,6 @@ class PartitionData(commands.partition.F18_PartData):
storage.doAutoPart = False
- if self.size: - try: - size = Size("%d MiB" % self.size) - except ValueError: - raise KickstartValueError(formatErrorMsg(self.lineno, msg="The size %s is not valid." % self.size)) - else: - # Have blivet determine a default value - size = None - if self.onbiosdisk != "": for (disk, biosdisk) in storage.eddDict.iteritems(): if "%x" % biosdisk == self.onbiosdisk: @@ -1023,6 +1017,8 @@ class PartitionData(commands.partition.F18_PartData): if not self.disk: raise KickstartValueError(formatErrorMsg(self.lineno, msg="Specified BIOS disk %s cannot be determined" % self.onbiosdisk))
+ size = None + if self.mountpoint == "swap": ty = "swap" self.mountpoint = "" @@ -1091,6 +1087,12 @@ class PartitionData(commands.partition.F18_PartData): else: ty = storage.defaultFSType
+ if not size and self.size: + try: + size = Size("%d MiB" % self.size) + except ValueError: + raise KickstartValueError(formatErrorMsg(self.lineno, msg="The size %s is not valid." % self.size)) + # If this specified an existing request that we should not format, # quit here after setting up enough information to mount it later. if not self.format:
On Fri, Oct 17, 2014 at 11:10:09AM -0400, mulhern wrote:
Resolves: rhbz#1154068
It might still be possible to obtain a size if the recommended flag is set and the logvol's mountpoint is "swap".
Make logvol and partition code match, as much as possible.
Signed-off-by: mulhern amulhern@redhat.com
pyanaconda/kickstart.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-)
Ack
anaconda-patches@lists.fedorahosted.org