[PATCH 2/3] Clear out custom storage ksdata after first attempt to apply it.
David Lehman
dlehman at redhat.com
Tue Sep 16 16:34:34 UTC 2014
This will prevent us from trying to apply it every time we leave the
storage spoke.
---
pyanaconda/kickstart.py | 6 ++++++
pyanaconda/ui/gui/spokes/storage.py | 3 ++-
pyanaconda/ui/tui/spokes/storage.py | 8 ++++----
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index f5929e8..9103d25 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1917,6 +1917,12 @@ def runTracebackScripts(scripts):
script.run("/")
log.info("All kickstart %%traceback script(s) have been run")
+def resetCustomStorageData(ksdata):
+ cmds = ["partition", "raid", "volgroup", "logvol", "btrfs"]
+ map(lambda c: ksdata.resetCommand(c), cmds)
+
+ ksdata.clearpart.type = CLEARPART_TYPE_NONE
+
def doKickstartStorage(storage, ksdata, instClass):
""" Setup storage state from the kickstart data """
ksdata.clearpart.execute(storage, ksdata, instClass)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 902c4ae..8305a5f 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -54,7 +54,7 @@ from pyanaconda.ui.categories.system import SystemCategory
from pyanaconda.ui.gui.utils import escape_markup, gtk_action_nowait, ignoreEscape
from pyanaconda.ui.helpers import StorageChecker
-from pyanaconda.kickstart import doKickstartStorage, refreshAutoSwapSize
+from pyanaconda.kickstart import doKickstartStorage, refreshAutoSwapSize, resetCustomStorageData
from blivet import storageInitialize, arch
from blivet.size import Size
from blivet.devices import MultipathDevice
@@ -345,6 +345,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
if self.autopart:
self.run()
finally:
+ resetCustomStorageData(self.data)
self._ready = True
hubQ.send_ready(self.__class__.__name__, True)
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index d000857..d215ad0 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -35,7 +35,7 @@ from blivet.errors import StorageError, DasdFormatError
from blivet.devices import DASDDevice, FcoeDiskDevice, iScsiDiskDevice, MultipathDevice, ZFCPDiskDevice
from blivet.devicelibs.dasd import format_dasd, make_unformatted_dasd_list
from pyanaconda.flags import flags
-from pyanaconda.kickstart import doKickstartStorage
+from pyanaconda.kickstart import doKickstartStorage, resetCustomStorageData
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.constants import THREAD_STORAGE, THREAD_STORAGE_WATCHER, THREAD_DASDFMT, DEFAULT_AUTOPART_TYPE
from pyanaconda.constants_text import INPUT_PROCESSED
@@ -382,26 +382,26 @@ class StorageSpoke(NormalTUISpoke):
self.storage.reset()
# now set ksdata back to the user's specified config
applyDiskSelection(self.storage, self.data, self.selected_disks)
- self._ready = True
except BootLoaderError as e:
log.error("BootLoader setup failed: %s", e)
print(_("storage configuration failed: %s") % e)
self.errors = [str(e)]
self.data.bootloader.bootDrive = ""
- self._ready = True
else:
print(_("Checking storage configuration..."))
exns = sanity_check(self.storage)
errors = [exn.message for exn in exns if isinstance(exn, SanityError)]
warnings = [exn.message for exn in exns if isinstance(exn, SanityWarning)]
(self.errors, self.warnings) = (errors, warnings)
- self._ready = True
for e in self.errors:
log.error(e)
print(e)
for w in self.warnings:
log.warning(w)
print(w)
+ finally:
+ resetCustomStorageData(self.data)
+ self._ready = True
def initialize(self):
NormalTUISpoke.initialize(self)
--
1.9.3
More information about the anaconda-patches
mailing list