[PATCH 1/3] Move custom storage setup into its own thread.

Chris Lumens clumens at redhat.com
Fri Mar 15 18:17:13 UTC 2013


Instantiating all those device formats can result in lengthy processes like
loading kernel modules, some of which are very large.  This results in lag
between when the user leaves the welcome spoke and the hub being displayed.

In my thoroughly unscientific testing on one computer, this knocks about two
seconds off the amount of time between the welcome screen and the hub.
---
 pyanaconda/ui/gui/spokes/custom.py  | 18 +++++++++++++-----
 pyanaconda/ui/gui/spokes/storage.py |  1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index b20f3eb..368b742 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -45,7 +45,7 @@ import re
 from pykickstart.constants import *
 
 from pyanaconda.product import productName, productVersion
-from pyanaconda.threads import threadMgr
+from pyanaconda.threads import AnacondaThread, threadMgr
 
 from blivet import devicefactory
 from blivet.formats import device_formats
@@ -79,7 +79,7 @@ from pyanaconda.ui.gui.spokes.lib.passphrase import PassphraseDialog
 from pyanaconda.ui.gui.spokes.lib.accordion import *
 from pyanaconda.ui.gui.spokes.lib.refresh import RefreshDialog
 from pyanaconda.ui.gui.spokes.lib.summary import ActionSummaryDialog
-from pyanaconda.ui.gui.utils import setViewportBackground
+from pyanaconda.ui.gui.utils import setViewportBackground, gtk_thread_wait
 from pyanaconda.ui.gui.categories.storage import StorageCategory
 
 from gi.repository import Gtk
@@ -518,8 +518,16 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         # Populate the list of valid filesystem types from the format classes.
         # Unfortunately, we have to narrow them down a little bit more because
         # this list will include things like PVs and RAID members.
-        fsCombo = self.builder.get_object("fileSystemTypeCombo")
-        fsCombo.remove_all()
+        self.fsCombo = self.builder.get_object("fileSystemTypeCombo")
+        self.fsCombo.remove_all()
+
+        threadMgr.add(AnacondaThread(name="AnaCustomStorageInit", target=self._initialize))
+
+    def _initialize(self):
+        @gtk_thread_wait
+        def gtk_action(name):
+            self.fsCombo.append_text(name)
+
         self._fs_types = []
         for cls in device_formats.itervalues():
             obj = cls()
@@ -530,7 +538,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
                             (isinstance(obj, FS) or
                              obj.type in ["biosboot", "prepboot", "swap"]))
             if supported_fs:
-                fsCombo.append_text(obj.name)
+                gtk_action(obj.name)
                 self._fs_types.append(obj.name)
 
     @property
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 1b474f0..17bfbeb 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -561,6 +561,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         communication.send_message(self.__class__.__name__, _("Probing storage..."))
 
         threadMgr.wait("AnaStorageThread")
+        threadMgr.wait("AnaCustomStorageInit")
 
         self.disks = getDisks(self.storage.devicetree)
 
-- 
1.8.1.2



More information about the anaconda-patches mailing list