[rhel7-branch/master][PATCH] Update the on-disk snapshot of storage when adv. disks are added (#1267944)

Vratislav Podzimek vpodzime at redhat.com
Tue Oct 6 15:40:29 UTC 2015


If users add advanced storage devices we need to recreate the on-disk snapshot
of storage because it's really a new on-disk state. Also, adding such devices is
a change in disk selection so we need to revert to the snapshot first before
going there.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/ui/gui/spokes/filter.py  | 8 +++++++-
 pyanaconda/ui/gui/spokes/storage.py | 4 ++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ui/gui/spokes/filter.py b/pyanaconda/ui/gui/spokes/filter.py
index 76b0601..ee1a0eb 100644
--- a/pyanaconda/ui/gui/spokes/filter.py
+++ b/pyanaconda/ui/gui/spokes/filter.py
@@ -30,7 +30,7 @@ from blivet.fcoe import has_fcoe
 
 from pyanaconda.flags import flags
 from pyanaconda.i18n import CN_, CP_
-from pyanaconda.storage_utils import try_populate_devicetree
+from pyanaconda.storage_utils import try_populate_devicetree, on_disk_storage
 
 from pyanaconda.ui.lib.disks import getDisks
 from pyanaconda.ui.gui.utils import timed_action
@@ -509,6 +509,12 @@ class FilterSpoke(NormalSpoke):
         self.data.ignoredisk.onlyuse = onlyuse
         self.data.clearpart.drives = self.selected_disks[:]
 
+        # some disks may have been added in this spoke, we need to recreate the
+        # snapshot of on-disk storage
+        if on_disk_storage.created:
+            on_disk_storage.dispose_snapshot()
+        on_disk_storage.create_snapshot(self.storage)
+
     def initialize(self):
         NormalSpoke.initialize(self)
 
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index c6751fb..4c4bffa 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -1011,6 +1011,10 @@ class StorageSpoke(NormalSpoke, StorageChecker):
             self._reclaim.set_tooltip_text(_("You'll be able to make space available during custom partitioning."))
 
     def on_specialized_clicked(self, button):
+        # there will be changes in disk selection, revert storage to an early snapshot (if it exists)
+        if on_disk_storage.created:
+            on_disk_storage.reset_to_snapshot(self.storage)
+
         # Don't want to run apply or execute in this case, since we have to
         # collect some more disks first.  The user will be back to this spoke.
         self.applyOnSkip = False
-- 
2.1.0



More information about the anaconda-patches mailing list