Commit 3d43b3ed authored by Kevin Atkinson's avatar Kevin Atkinson

Fix code which logs info about images used in os_setup_new which never

worked in the "new" version.  (It continues to work fine in
os_setup (no new).  The new version is used primary by GENI related
and Utah projects.)
parent 8a7891c9
...@@ -600,6 +600,10 @@ my $exit_code = (($experiment->canceled() || $MyStruct->noretry()) ? -1 : ...@@ -600,6 +600,10 @@ my $exit_code = (($experiment->canceled() || $MyStruct->noretry()) ? -1 :
# If not failing for any reason, record some stats # If not failing for any reason, record some stats
# #
if ($exit_code == 0) { if ($exit_code == 0) {
# Record some stats on the OS requested and the images loaded to
# the image_history table. Put in in an eval loop to catch any
# errors so they are non-fatal.
use strict;
eval { eval {
my ($exptidx, $state) = my ($exptidx, $state) =
DBQuerySingleFatal("select idx,state from experiments ". DBQuerySingleFatal("select idx,state from experiments ".
...@@ -627,21 +631,27 @@ if ($exit_code == 0) { ...@@ -627,21 +631,27 @@ if ($exit_code == 0) {
} }
my %todo; my %todo;
foreach my $node_id ( keys(%osids) ) {
$todo{$node_id} = [$osids{$node_id}]; # Collect the list of nodes and store the osid requested
} # and the imageid loaded (if any).
foreach my $imageid ( keys(%reloads) ) { foreach my $object (@{$MyStruct->OperationList()}) {
my @nodelist = @{ $reloads{$imageid} }; foreach my $node_id (keys %{$object->{NODES}}) {
foreach my $node_id (@nodelist) { my $node = $object->{NODES}{$node_id};
$todo{$node_id}[1] = $imageid; my $osinfo = $node->_bootosinfo();
my $osid = $osinfo->osid();
my $op = $node->_setupoperation();
my $imageid = 0;
# Only set the imageid if the disk needed a reload
if ($op == $RELOAD) {
my $image = $node->_loadimage();
$imageid = $image->imageid();
}
$todo{$node_id} = [$osid, $imageid];
} }
} }
foreach my $node_id ( keys(%todo) ) { foreach my $node_id ( keys(%todo) ) {
#next unless defined $nodes{$node_id};
my ($osid, $imageid) = @{$todo{$node_id}}; my ($osid, $imageid) = @{$todo{$node_id}};
$imageid = 0 unless defined $imageid;
my $newly_alloc = exists $prev_alloc{$node_id} ? 0 : 1; my $newly_alloc = exists $prev_alloc{$node_id} ? 0 : 1;
$newly_alloc = 'NULL' if $cant_find_prev_alloc; $newly_alloc = 'NULL' if $cant_find_prev_alloc;
...@@ -669,8 +679,6 @@ if ($exit_code == 0) { ...@@ -669,8 +679,6 @@ if ($exit_code == 0) {
" $log_session, '$req_type', '$phys_type', ". " $log_session, '$req_type', '$phys_type', ".
" $req_os, $osid, $imageid)") " $req_os, $osid, $imageid)")
if (!$impotent); if (!$impotent);
#$done{$node_id} = 1;
} }
}; };
if ($@) { if ($@) {
......
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