[anaconda:all] Don't panic prematurely on a missing size (#1154068)
mulhern
amulhern at redhat.com
Fri Oct 17 15:10:09 UTC 2014
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 at 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:
--
1.9.3
More information about the anaconda-patches
mailing list