[PATCH 13/19] Remove any preexisting autopart layout before space check. (#866895)

David Lehman dlehman at redhat.com
Thu Oct 18 21:49:41 UTC 2012


We remove autopart because it's easy to put back. We don't remove
custom layouts because they can take some time to set up. They can
be removed using the reclaim dialog.
---
 pyanaconda/ui/gui/spokes/storage.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 5804b00..11b79ae 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -328,6 +328,8 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         self.autopart = self.data.autopart.autopart
         self.clearPartType = CLEARPART_TYPE_NONE
 
+        self._previous_autopart = False
+
     def apply(self):
         self.data.ignoredisk.onlyuse = self.selected_disks[:]
         self.data.clearpart.drives = self.selected_disks[:]
@@ -468,6 +470,8 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         self.encrypted = self.data.autopart.encrypted
         self.passphrase = self.data.autopart.passphrase
 
+        self._previous_autopart = self.autopart
+
         encrypt_checkbutton = self.builder.get_object("encryption_checkbutton")
         encrypt_checkbutton.set_active(self.encrypted)
 
@@ -618,6 +622,14 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         return rc
 
     def on_continue_clicked(self, button):
+        # Remove all non-existing devices if autopart was active when we last
+        # refreshed.
+        if self._previous_autopart:
+            self._previous_autopart = False
+            actions = self.storage.devicetree.findActions(type="create")
+            for action in reversed(actions):
+                self.storage.devicetree.cancelAction(action)
+
         # hide/unhide disks as requested
         for disk in self.disks:
             if disk.name not in self.selected_disks and \
-- 
1.7.7.6



More information about the anaconda-patches mailing list