[PATCH 16/16] Fall back to lvm autopart if the default fails. (#864708)

David Lehman dlehman at redhat.com
Thu Oct 11 23:46:06 UTC 2012


This will only help if the disks and/or their free regions are very
small.
---
 pyanaconda/ui/gui/spokes/storage.py |   37 ++++++++++++++++++++++++++++------
 1 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 0eaabb1..711ad0c 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -378,15 +378,38 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         try:
             doKickstartStorage(self.storage, self.data, self.instclass)
         except StorageError as e:
-            log.error("storage configuration failed: %s" % e)
-            self.errors = str(e).split("\n")
             communication.send_message(self.__class__.__name__,
                                    _("Failed to save storage configuration..."))
-            self.data.clearpart.type = CLEARPART_TYPE_NONE
-            self.data.clearpart.initAll = False
-            self.storage.config.update(self.data)
-            self.storage.autoPartType = self.data.autopart.type
-            self.storage.reset()
+            log.error("storage configuration failed: %s" % e)
+            self.errors = str(e).split("\n")
+            original_type = self.data.autopart.type
+            if original_type != AUTOPART_TYPE_LVM:
+                communication.send_message(self.__class__.__name__,
+                                           _("Automatic partitioning failed..."))
+                log.info("trying with lvm...")
+                self.storage.reset()
+                communication.send_message(self.__class__.__name__,
+                                           _("Trying fallback configuration..."))
+                self.data.autopart.type = AUTOPART_TYPE_LVM
+                self.storage.autoPartType = AUTOPART_TYPE_LVM
+                try:
+                    doKickstartStorage(self.storage, self.data, self.instclass)
+                except StorageError as e2:
+                    log.error("lvm failed, too: %s" % e2)
+                else:
+                    self.errors = []
+
+            if self.errors:
+                communication.send_message(self.__class__.__name__,
+                                       _("Failed to save storage configuration..."))
+                self.data.autopart.type = original_type
+                self.data.clearpart.type = CLEARPART_TYPE_NONE
+                self.data.clearpart.initAll = False
+                self.storage.config.update(self.data)
+                self.storage.autoPartType = original_type
+                self.storage.reset()
+            else:
+                self.run()  # emulating success path below
         else:
             if self.autopart:
                 # this was already run as part of doAutoPartition. dumb.
-- 
1.7.7.6



More information about the anaconda-patches mailing list