New subject: [PATCH 1/2] Explicitly request all free space when no size given in custom. (#872833)
The logic for handling it implicitly only works for partitions.
---
pyanaconda/ui/gui/spokes/custom.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 29206d3..7edfdd0 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -1561,7 +1561,13 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
mountpoint = dialog.mountpoint
log.debug("requested size = %s ; available space = %s"
% (dialog.size, self._free_space))
- size = dialog.size
+
+ # if no size was entered, request as much of the free space as possible
+ if dialog.size.convertTo(spec="mb") < 1:
+ size = self._free_space
+ else:
+ size = dialog.size
+
fstype = self.storage.getFSType(mountpoint)
encrypted = self.data.autopart.encrypted
--
1.7.7.6
New subject: [PATCH 2/2] Fix error handling when new device ends up with size 0.
Related: rhbz#872833
---
pyanaconda/storage/__init__.py | 26 +++++++++++---------------
1 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index b6b3864..ee156a1 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -2194,14 +2194,7 @@ class Storage(object):
mountpoint = None
fmt_args = {}
- try:
- device = factory.new_device(parents=parents,
- size=size,
- fmt_type=fstype,
- mountpoint=mountpoint,
- fmt_args=fmt_args)
- except StorageError as e:
- log.error("device instance creation failed: %s" % e)
+ def _container_post_error():
# Clean up. If there is a container and it has other devices,
# try to revert it. If there is a container and it has no other
# devices, remove it. If there is not a container, remove all of
@@ -2221,6 +2214,15 @@ class Storage(object):
else:
self.__cleanUpMemberDevices(parents)
+ try:
+ device = factory.new_device(parents=parents,
+ size=size,
+ fmt_type=fstype,
+ mountpoint=mountpoint,
+ fmt_args=fmt_args)
+ except StorageError as e:
+ log.error("device instance creation failed: %s" % e)
+ _container_post_error()
raise
self.createDevice(device)
@@ -2234,14 +2236,8 @@ class Storage(object):
e = StorageError("failed to create device")
if e:
- # Clean up by destroying members, container, and device.
self.destroyDevice(device)
- members = device.parents
- if container:
- self.destroyDevice(container)
- members = container.parents
-
- self.__cleanUpMemberDevices(members)
+ _container_post_error()
raise StorageError(e)
if factory.encrypted and factory.encrypt_leaves:
--
1.7.7.6