Commit 1f8e054b authored by Leigh B Stoller's avatar Leigh B Stoller

Fix problem in new webtask code that was causing clone to not work.

parent 50841a48
......@@ -619,8 +619,8 @@ sub DoSnapshot()
}
# Bind the process id. This is important when the caller is
# manage_profile, doing a clone.
$swebtask->SetProcessID($PID)
if (defined($swebtask));
$webtask->SetProcessID($PID)
if (defined($webtask));
#
# Poll for a reasonable amount of time.
......
......@@ -530,7 +530,9 @@ if (defined($instance)) {
my $new_uuid = $profile->uuid();
# We want to use the webtask associated with the new profile.
my $pwebtask = $profile->webtask();
# But the image details are stored in the instance webtask.
my $iwebtask = $instance->webtask();
if ($profile->Lock()) {
$profile->Delete(1);
fatal("Could not lock new profile");
......@@ -558,17 +560,19 @@ if (defined($instance)) {
#
# The script helpfully put the new image urn in the webtask.
#
$pwebtask->AutoStore(1);
$pwebtask->Refresh();
$iwebtask->Refresh();
my $newimage;
if (GetSiteVar("protogeni/use_imagetracker") &&
EmulabFeatures->FeatureEnabled("APT_UseImageTracker",
$this_user, $project)) {
$newimage = $pwebtask->image_urn();
$newimage = $iwebtask->image_urn();
}
else {
$newimage = $pwebtask->image_url();
$newimage = $iwebtask->image_url();
}
if (!defined($newimage) ||
$profile->UpdateDiskImage($node_id, $newimage, 0)) {
......@@ -577,6 +581,8 @@ if (defined($instance)) {
}
# Tell web interface cloning has started.
$pwebtask->cloning(1);
# And what is being cloned.
$pwebtask->cloning_instance($instance->uuid());
#
# Exit and leave child to poll.
......@@ -631,6 +637,7 @@ if (defined($instance)) {
}
# Tell web interface cloning has finished
$pwebtask->cloning(0);
$pwebtask->cloning_instance(undef);
$profile->Unlock();
exit(0);
}
......
......@@ -61,7 +61,21 @@ function Do_CloneStatus()
SPITAJAX_ERROR(1, "Cloning has terminated");
return;
}
$taskdata = $webtask->TaskData();
if (!$webtask->TaskValue("cloning_instance")) {
SPITAJAX_ERROR(1, "The cloned experiment is gone");
return;
}
$instance = Instance::Lookup($webtask->TaskValue("cloning_instance"));
if (!$instance) {
SPITAJAX_ERROR(1, "The cloned experiment is no where");
return 1;
}
$instance_webtask = $instance->WebTask();
if (!$instance_webtask) {
SPITAJAX_ERROR(1, "No status descriptor found for instance");
return;
}
$taskdata = $instance_webtask->TaskData();
$blob = array();
#
......@@ -97,10 +111,10 @@ function Do_CloneStatus()
}
}
}
if ($webtask->exited()) {
if ($instance_webtask->exited()) {
# Success, but not sure what to report. Come back to this later.
$blob["exited"] = $webtask->exited();
$blob["exitcode"] = $webtask->exitcode();
$blob["exited"] = $instance_webtask->exited();
$blob["exitcode"] = $instance_webtask->exitcode();
if (isset($taskdata["image_name"])) {
$blob["image_name"] = $taskdata["image_name"];
}
......
<?php
#
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -412,18 +412,17 @@ if (! isset($create)) {
session_destroy();
session_commit();
}
#
# See if we have a task running in the background
# for this profile. At the moment it can only be a
# clone task. If there is one, we have to tell
# the js code to show the status of the clone.
#
$webtask = $profile->webtask();
if ($webtask->TaskValue("cloning")) {
$notifyclone = 1;
}
}
#
# See if we have a task running in the background
# for this profile. At the moment it can only be a
# clone task. If there is one, we have to tell
# the js code to show the status of the clone.
#
$webtask = $profile->webtask();
if ($webtask->TaskValue("cloning")) {
$notifyclone = 1;
}
}
else {
# Default the project if in only one project.
......
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