[PATCH 07/11] Raise an exception if a new device ends up with size 0.

David Lehman dlehman at redhat.com
Thu Aug 16 21:48:46 UTC 2012


It means the train is off the track.
---
 pyanaconda/storage/__init__.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index f37341d..7b80072 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -2033,6 +2033,9 @@ class Storage(object):
                 device.size = size
 
             factory.post_create()
+
+            if not device.size:
+                raise StorageError("failed to adjust device")
         elif factory.new_device_attr:
             # add the new device to the container
             free = getattr(container, "freeSpace", size)
@@ -2049,6 +2052,10 @@ class Storage(object):
                                         fmt_args=fmt_args)
             self.createDevice(device)
             factory.post_create()
+            if not device.size:
+                # FIXME: this is incomplete at best (container, &c)
+                self.destroyDevice(device)
+                raise StorageError("failed to create device")
 
     def copy(self):
         new = copy.deepcopy(self)
-- 
1.7.7.6



More information about the anaconda-patches mailing list