[PATCH 3/4] Set ready state properly for text storage spoke
Jesse Keating
jkeating at redhat.com
Wed Sep 19 23:54:05 UTC 2012
We weren't setting the ready state correctly, just depending upon
waiting on the storage thread when entering the spoke. This doesn't
work so well with kickstarts where the spoke isn't entered.
Also do the threads import once and only once.
---
pyanaconda/ui/tui/spokes/storage.py | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index b74096f..ba5e667 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -28,6 +28,7 @@ from pyanaconda.ui.tui.simpleline import TextWidget, CheckboxWidget
from pyanaconda.storage.size import Size
from pyanaconda.flags import flags
from pyanaconda.kickstart import doKickstartStorage
+from pyanaconda.threads import threadMgr, AnacondaThread
from pykickstart.constants import *
@@ -93,6 +94,8 @@ class StorageSpoke(NormalTUISpoke):
NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
self.selected_disks = self.data.ignoredisk.onlyuse[:]
+ self._ready = False
+
# This list gets set up once in initialize and should not be modified
# except perhaps to add advanced devices. It will remain the full list
# of disks that can be included in the install.
@@ -101,12 +104,17 @@ class StorageSpoke(NormalTUISpoke):
@property
def completed(self):
- from pyanaconda.threads import threadMgr
return (threadMgr.get("AnaCheckStorageThread") is None and
self.storage.rootDevice is not None and
not self.errors)
@property
+ def ready(self):
+ # By default, the storage spoke is not ready. We have to wait until
+ # storageInitialize is done.
+ return self._ready and not threadMgr.get("AnaExecuteStorageThread")
+
+ @property
def status(self):
""" A short string describing the current status of storage setup. """
msg = _("No disks selected")
@@ -165,8 +173,6 @@ class StorageSpoke(NormalTUISpoke):
NormalTUISpoke.refresh(self, args)
# Join the initialization thread to block on it
- from pyanaconda.threads import threadMgr
-
initThread = threadMgr.get("AnaStorageWatcher")
if initThread:
# This print is foul. Need a better message display
@@ -265,8 +271,6 @@ class StorageSpoke(NormalTUISpoke):
log.warn(w)
def initialize(self):
- from pyanaconda.threads import threadMgr, AnacondaThread
-
NormalTUISpoke.initialize(self)
threadMgr.add(AnacondaThread(name="AnaStorageWatcher",
@@ -279,8 +283,6 @@ class StorageSpoke(NormalTUISpoke):
# Secondary initialize so wait for the storage thread
# to complete before populating our disk list
- from pyanaconda.threads import threadMgr
-
storageThread = threadMgr.get("AnaStorageThread")
if storageThread:
storageThread.join()
--
1.7.11.4
More information about the anaconda-patches
mailing list