[PATCH 3/4] Set ready state properly for text storage spoke

Vratislav Podzimek vpodzime at redhat.com
Thu Sep 20 08:15:51 UTC 2012


On Wed, 2012-09-19 at 16:54 -0700, Jesse Keating wrote:
> 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")
Two points here:
1) it would be better to use "threadMgr.get("...") is None"

2) the comment mentions the storageInitialize, which is a target of
"AnaStorageThread", but you are checking the
"AnaExecuteStorageThread" (which doesn't make sense for the "ready"
property)

Also one thing that applies to both TUI and GUI -- could we please use
constants for the names of threads, that are started in one module and
joined in another one? E.g. having "AnaStorageThread" as a
STORAGE_INIT_THREAD_NAME constant in the storage module and use it in
anaconda and GUI/TUI spokes.



More information about the anaconda-patches mailing list