[anaconda:rhel7/master 1/2] Handle case where device.maxSize is 0 differently (#1076055)
mulhern
amulhern at redhat.com
Tue Sep 16 17:26:22 UTC 2014
Related: rhbz#1076055
Previously, if maxSize was 0, meaning no specified maxSize, and size was
not set, size was set to 0. Now, size is set to old_size instead since it
is not clear when maxSize is not given what size ought to be.
If statements rearranged a bit to increase clarity with this extra condition,
and log.info and log.warning messages added.
Signed-off-by: mulhern <amulhern at redhat.com>
---
pyanaconda/ui/gui/spokes/custom.py | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 1e46d6b..f4484ec 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -1612,15 +1612,22 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self.__storage.resetDevice(original_device)
if changed_size and device.resizable:
- # If no size was specified, we just want to grow to
- # the maximum. But resizeDevice doesn't take None for
- # a value.
+ max_size = device.maxSize
+ min_size = device.minSize
if not size:
- size = device.maxSize
- elif size < device.minSize:
- size = device.minSize
- elif size > device.maxSize:
- size = device.maxSize
+ if max_size:
+ log.info("No size specified, using maximum size for this device (%d).", max_size)
+ size = max_size
+ else:
+ log.warning("No size specified and no maximum size available, setting size back to original size (%d).", old_size)
+ size = old_size
+ else:
+ if size < min_size:
+ log.warning("Size specified (%d) is less than the minimum size for this device (%d), using minimum size.", size, min_size)
+ size = min_size
+ elif max_size and size > max_size:
+ log.warning("Size specified (%d) is greater than the maximum size for this device (%d), using maximum size.", size, max_size)
+ size = max_size
# And then we need to re-check that the max size is actually
# different from the current size.
--
1.9.3
More information about the anaconda-patches
mailing list