All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 294bf7ae authored by Leigh B Stoller's avatar Leigh B Stoller

If there is a webtask associated with the image descriptor, keep that

descriptor updated with the progress of the image capture.
parent b0c5f6e9
......@@ -74,6 +74,7 @@ my $usessh = 0;
my $usenfs = 0;
my $usefup = 1;
my $noemail = 0;
my $webtask;
#
# Configure variables
......@@ -98,6 +99,7 @@ use User;
use Image;
use OSinfo;
use Logfile;
use WebTask;
#
# Turn off line buffering on output
......@@ -422,6 +424,12 @@ if ($image->Lock()) {
}
$needunlock = 1;
# See if a web task is tracking this image creation.
$webtask = WebTask->LookupByObject($image->uuid());
if (defined($webtask)) {
$webtask->AutoStore(1);
}
#
# Be sure to kill off running frisbee. If a node is trying to load that
# image, well tough.
......@@ -657,6 +665,10 @@ elsif ($isvirtnode) {
fatal("'$cmd' failed")
if ($?);
# Mark webtask
$webtask->status("imaging")
if (defined($webtask));
$EUID = $UID = $SAVEUID;
#
......@@ -703,6 +715,10 @@ if ($usessh) {
goto done;
}
# Mark webtask
$webtask->status("imaging")
if (defined($webtask));
#
# ...execute command and wait!
#
......@@ -716,6 +732,10 @@ if ($usessh) {
$args{'pfunc'} = \&check_progress;
$args{'pinterval'} = $checkwait;
# Mark webtask
$webtask->status("imaging")
if (defined($webtask));
my $retry = 1;
while ($retry) {
$retry = 0;
......@@ -791,6 +811,9 @@ if ($result != 0) {
}
ec2done:
if (defined($webtask)) {
$webtask->status("finishing");
}
#
# Everything worked, create the hash signature file.
#
......@@ -867,6 +890,10 @@ if (defined($logfile)) {
$logfile->Close();
$image->ClearLogFile();
}
if (defined($webtask)) {
$webtask->status("ready");
$webtask->Exited(0);
}
$image->Unlock();
exit 0;
......@@ -933,6 +960,12 @@ sub fatal($)
$logfile->Close();
$image->ClearLogFile();
}
if (defined($webtask)) {
$webtask->status("failed");
$webtask->imagesize(0);
$webtask->Exited(1);
}
$image->Unlock()
if ($needunlock);
# Restore old image file.
......@@ -1026,7 +1059,9 @@ sub check_progress($$)
" it has been ". $curtdiff ." minutes.".
" Current image size: $cursize bytes.\n";
}
if (defined($webtask)) {
$webtask->imagesize($cursize / 1024);
}
return 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment