[PATCH] Sync up step counts in install.py with reality.
David Lehman
dlehman at redhat.com
Fri Mar 21 22:53:28 UTC 2014
On Fri, 2014-03-21 at 16:45 -0400, Chris Lumens wrote:
> Our counts were off, plus a lot of steps are conditionalized which was not
> being reflected in the count we established beforehand.
> ---
> pyanaconda/install.py | 44 ++++++++++++++++++++++++++++++++++----------
> 1 file changed, 34 insertions(+), 10 deletions(-)
Looks good to me.
>
> diff --git a/pyanaconda/install.py b/pyanaconda/install.py
> index be2e1a5..a7e9d38 100644
> --- a/pyanaconda/install.py
> +++ b/pyanaconda/install.py
> @@ -52,12 +52,22 @@ def _writeKS(ksdata):
> def doConfiguration(storage, payload, ksdata, instClass):
> from pyanaconda.kickstart import runPostScripts
>
> - step_count = 6
> + willWriteNetwork = not flags.flags.imageInstall and not flags.flags.dirInstall
> + willRunRealmd = ksdata.realm.discovered
> +
> + # configure base, create users, configure addons, initramfs, post-install
> + step_count = 5
> +
> + # network, maybe
> + if willWriteNetwork:
> + step_count += 1
> +
> # if a realm was discovered,
> # increment the counter as the
> # real joining step will be executed
> - if ksdata.realm.discovered:
> + if willRunRealmd:
> step_count += 1
> +
> progressQ.send_init(step_count)
>
> # Now run the execute methods of ksdata that require an installed system
> @@ -74,7 +84,7 @@ def doConfiguration(storage, payload, ksdata, instClass):
> ksdata.xconfig.execute(storage, ksdata, instClass)
> ksdata.skipx.execute(storage, ksdata, instClass)
>
> - if not flags.flags.imageInstall and not flags.flags.dirInstall:
> + if willWriteNetwork:
> with progress_report(_("Writing network configuration")):
> ksdata.network.execute(storage, ksdata, instClass)
>
> @@ -93,7 +103,7 @@ def doConfiguration(storage, payload, ksdata, instClass):
> with progress_report(_("Generating initramfs")):
> payload.recreateInitrds(force=True)
>
> - if ksdata.realm.discovered:
> + if willRunRealmd:
> with progress_report(_("Joining realm: %s") % ksdata.realm.discovered):
> ksdata.realm.execute(storage, ksdata, instClass)
>
> @@ -112,6 +122,9 @@ def doInstall(storage, payload, ksdata, instClass):
> The two main tasks for this are putting filesystems onto disks and
> installing packages onto those filesystems.
> """
> + willRunRealmd = ksdata.realm.join_realm
> + willInstallBootloader = not flags.flags.dirInstall and not ksdata.bootloader.disabled
> +
> # First save system time to HW clock.
> if flags.can_touch_runtime_system("save system time to HW clock"):
> timezone.save_hw_clock(ksdata.timezone)
> @@ -120,16 +133,27 @@ def doInstall(storage, payload, ksdata, instClass):
> # those are the ones that take the most time.
> steps = len(storage.devicetree.findActions(type="create", object="format")) + \
> len(storage.devicetree.findActions(type="resize", object="format"))
> - steps += 6
> - # pre setup phase, packages setup, packages, bootloader, realmd,
> - # post install
> - progressQ.send_init(steps)
> +
> + # pre setup phase, post install
> + steps += 2
> +
> + # realmd, maybe
> + if willRunRealmd:
> + steps += 1
> +
> + # bootloader, maybe
> + if willInstallBootloader:
> + steps += 1
>
> # This should be the only thread running, wait for the others to finish if not.
> if threadMgr.running > 1:
> + progressQ.send_init(steps+1)
> +
> with progress_report(_("Waiting for %s threads to finish") % (threadMgr.running-1)):
> map(log.debug, ("Thread %s is running" % n for n in threadMgr.names))
> threadMgr.wait_all()
> + else:
> + progressQ.send_init(steps)
>
> with progress_report(_("Setting up the installation environment")):
> ksdata.firstboot.setup(storage, ksdata, instClass)
> @@ -148,7 +172,7 @@ def doInstall(storage, payload, ksdata, instClass):
>
> # Discover information about realms to join,
> # to determine additional packages
> - if ksdata.realm.join_realm:
> + if willRunRealmd:
> with progress_report(_("Discovering realm to join")):
> ksdata.realm.setup()
>
> @@ -171,7 +195,7 @@ def doInstall(storage, payload, ksdata, instClass):
> payload.postInstall()
>
> # Do bootloader.
> - if not flags.flags.dirInstall and not ksdata.bootloader.disabled:
> + if willInstallBootloader:
> with progress_report(_("Installing bootloader")):
> writeBootLoader(storage, payload, instClass, ksdata)
>
More information about the anaconda-patches
mailing list