[PATCH 2/3] Improve error granularity slightly in automatic partitioning.

David Lehman dlehman at redhat.com
Tue Sep 11 16:01:13 UTC 2012


Also remove unused PartitioningWarning exception.
---
 pyanaconda/storage/errors.py       |    2 +-
 pyanaconda/storage/partitioning.py |   10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/storage/errors.py b/pyanaconda/storage/errors.py
index 90a9b13..a2afb61 100644
--- a/pyanaconda/storage/errors.py
+++ b/pyanaconda/storage/errors.py
@@ -157,7 +157,7 @@ class DeviceActionError(StorageError):
 class PartitioningError(StorageError):
     pass
 
-class PartitioningWarning(StorageError):
+class NotEnoughFreeSpaceError(StorageError):
     pass
 
 # udev
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index a61b1ce..0587e8d 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -267,13 +267,17 @@ def doAutoPartition(storage, data):
     devs = []
 
     if storage.doAutoPart:
+        if not storage.partitioned:
+            raise NoDisksError("No usable disks selected")
+
         disks = _getCandidateDisks(storage)
         devs = _scheduleImplicitPartitions(storage, disks)
         log.debug("candidate disks: %s" % disks)
         log.debug("devs: %s" % devs)
 
         if disks == []:
-            raise NoDisksError
+            raise NotEnoughFreeSpaceError("Not enough free space on disks for "
+                                          "automatic partitioning")
 
         _schedulePartitions(storage, disks)
 
@@ -286,10 +290,6 @@ def doAutoPartition(storage, data):
 
         # grow LVs
         growLVM(storage)
-    except PartitioningWarning as e:
-        log.warning(str(e))
-        if errorHandler.cb(e) == ERROR_RAISE:
-            raise
     except PartitioningError as e:
         log.error(str(e))
         if errorHandler.cb(e) == ERROR_RAISE:
-- 
1.7.7.6



More information about the anaconda-patches mailing list