Mailinglist Archive: yast-devel (105 mails)

< Previous Next >
Re: [yast-devel] Hackweek: Unified Installation Progress
  • From: Stanislav Visnovsky <visnov@xxxxxxx>
  • Date: Tue, 2 Sep 2008 14:43:29 +0200
  • Message-id: <200809021443.30175.visnov@xxxxxxx>
Hi!

Here is updated patch for yast2-storage to make 'yast disk' work on running
system. Arvin, does this look better?

The installation part and packager part is commited now in trunk (and thanks
to Bubli now even sw_single works - sorry for that). control.xml for products
still need to be adapted.

Stano

Dňa Monday 01 September 2008 09:29:59 Stanislav Visnovsky ste napísal:
Hi Hackers!

So, Hackweek III is over and here is the result of my work - a grand
unified installation progress.

Global progress
===============
The basic idea is that the progress consists "stages" - during a new
install, there are 3: disk preparation, image deployment and package
installation.

Before the first client using the unified progress, the stages need to be
set up, e.g. :

list< map<string,any> > stages = [
$[
"name" : "disk",
"description": _("Preparing disks..."),
"value" : Mode::update() ? 0 : 120, // 2 minutes, who needs more? ;-)
"units" : `sec,
],
$[
"name" : "images",
"description": _("Deploying Images..."),
"value" : ImageInstallation::TotalSize() / 1024, // kilobytes
"units" : `kb,
],
$[
"name" : "packages",
"description": _("Installing Packages..."),
// here, we do a hack, because until images are deployed, we cannot
determine how many
// packages will be really installed additionally
"value" : (PackageSlideShow::total_size_to_install -
ImageInstallation::TotalSize()) / 1024 , // kilobytes
"units" : `kb,
],
];

SlideShow::Setup( stages );

The function will calculate the partitioning of the unified progress based
on estimate of a needed time. A stage can provide the estimate of time or
an amount of data to be transferred (the constants used are based on
assumption of 15 min install time and that the data are downloaded and
written to disk). The logic is no rocket science as the only goal for a
progress bar is to have it move somewhat regularly.

A client using the new unified progress will do basically 2 things:

1) calls SlideShow::MoveToStage( stage-id )
- this will move the global progress to a proper position for start of the
stage and updates also the label ("description" entry in the map)

2) calls regularly SlideShow::StageProgress( new_percent, new_label )
- new_percent is the progress inside of the current stage, the library will
recompute this to get a global progress percents.
- if new_label is nil, label is not updated.

More functionality
==================
The SlideShow dialog contains the following functionality:
- global progress (see above)
- subprogress for the current action (e.g. download a package, format
disk, ...)
- installation log
- slide show support
- optional package table
- release notes viewer

See the SlideShow API how to handle those.

Implementation Notes
====================
During the hacking, I've splitted the old SlideShow module into 3:
- Slides.ycp - handling of slide loading from the installation medium
- SlideShow.ycp - generic API for the unified installation progress
- PackageSlideShow - code specific for handling package installation, e.g.
CDs, summary table, ....

Attached are the complete new modules as diffs do not make much sense.
Next, there is updated control.xml with a new installation client
inst_prepareprogress which sets up the stages for normal installation.
The rest are diffs for adapting to new APIs. Influenced code is in
yast2-installation, yast2-packager and yast2-storage

I've tested the code on modified alpha2 - new installation, update and also
on running system. Qt and ncurses.

Stano


Index: storage/src/inst_prepdisk.ycp
===================================================================
--- storage/src/inst_prepdisk.ycp (revision 50564)
+++ storage/src/inst_prepdisk.ycp (working copy)
@@ -36,6 +36,8 @@
import "Storage";
import "Hotplug";
import "String";
+ import "SlideShow";
+ import "StorageClients";

if (Mode::update ())
return `auto;
@@ -51,6 +53,7 @@
// Define macro that creates a dialog with progressbar
define void MakefsDialog()
``{
+ return;

if (!Wizard::IsWizardDialog())
return;
@@ -93,8 +96,28 @@
// check for ppc-PReP/CHRP system, they need a special boot partition
// todo -> put this in a lib, we need it also in inst_custom_part ...

- MakefsDialog();
+ if( Mode::normal() )
+ {
+ // we need to open dialog and set up slideshow
+ SlideShow::Setup(
+ [
+ $[
+ "name" : "disk",
+ "description": _("Preparing disks..."),
+ "value" : Mode::update() ? 0 : 120, // FIXME: 2 minutes
+ "units" : `sec,
+ ],
+ ]

+ );
+
+ SlideShow::OpenDialog();
+ }
+
+ StorageClients::total_actions = Storage::ActionsCount();
+
+ SlideShow::MoveToStage( "disk" );
+
y2milestone( "installation=%1", Stage::initial() );
symbol ret_val = `next;

@@ -145,6 +168,10 @@
}
Storage::UpdateTargetMap();

+ // close progress on running system
+ if( Mode::normal() )
+ SlideShow::CloseDialog();
+
SCR::Write( .target.ycp, Storage::SaveDumpPath("targetMap_pe"),
Storage::GetTargetMap() );

Index: storage/src/modules/StorageClients.ycp
===================================================================
--- storage/src/modules/StorageClients.ycp (revision 50564)
+++ storage/src/modules/StorageClients.ycp (working copy)
@@ -15,6 +15,7 @@
import "Label";
import "Popup";
import "Report";
+ import "SlideShow";
import "StorageCallbacks";

textdomain "storage";
@@ -22,11 +23,14 @@
boolean enable_popup = false;
list<string> texts = [];

+global integer total_actions = 0;
+integer current_action = 0;

global void ProgressBar (string id, integer cur, integer max)
{
integer f = 100 * cur / max;
- UI::ChangeWidget (`id(`progress), `Value, f);
+ SlideShow::SubProgress( f, nil );
+ SlideShow::GenericHandleInput();
}

global void EnablePopup()
@@ -47,7 +51,14 @@

global void ShowInstallInfo (string text)
{
- UI::ChangeWidget (`id(`progress), `Label, text);
+ SlideShow::SubProgressStart( text );
+ SlideShow::AppendMessageToInstLog(text);
+
+ current_action = current_action + 1;
+
+ // hack: assume every text change means another action
+ y2milestone( "Current action: %1, total stage progress: %2",
current_action, current_action * 100 / total_actions );
+ SlideShow::StageProgress( current_action * 100 / total_actions, nil );
}


@@ -77,4 +88,5 @@
StorageCallbacks::YesNoPopup ("StorageClients::YesNoPopup");
}

-}
+} // module StorageClients
+
Index: storage/src/modules/Storage.ycp
===================================================================
--- storage/src/modules/Storage.ycp (revision 50564)
+++ storage/src/modules/Storage.ycp (working copy)
@@ -6426,4 +6426,10 @@
return( ret );
}

+global integer ActionsCount()
+ {
+ return size(LibStorage::StorageInterface::getCommitActions( sint, true
));
+ }
+
}
+
< Previous Next >
List Navigation
References