Commit a62de08a authored by Mike Hibler's avatar Mike Hibler

Fix a bug when expanding the list of images implied by delta images.

I was expanding a global list in a loop for every node. So for each
node, I was finding all the delta images in the ever-growing list and
adding their dependencies (again!) making the list even larger. In an
experiment loading a two-level delta image on 8 nodes, the list included
40+ copies of the same three images to load by the time we got to the last
node. However, no node attempted to load all those images because tmcd
exceeded its reply buffer size on the "loadinfo" call and would not
return anything. Of course, by then we had computed a max wait time
based on image.max_wait * 45 so the experiment suffered a slow, lingering
death even though the nodes were not doing anything.

Beware, I do not know if I got the "access key" code right for remote
nodes. Not even sure if we use that path anymore. I attempted to fix it
in libosload, I did not even try in libosload_new.
parent 473aeb2e
......@@ -115,25 +115,25 @@ sub osload ($$) {
if (defined($args->{'debug'})) {
$debug = $args->{'debug'};
}
if (defined($args->{'usecurrent'}) && $args->{'usecurrent'}) {
$usecurrent = 1;
$usedefault = 0;
}
if (defined($args->{'image'})) {
@images = split(/,/, $args->{'image'});
$usedefault = 0;
$usedefault = $usecurrent = 0;
}
elsif (defined($args->{'images'})) {
@images = @{$args->{'images'}};
$usedefault = 0;
$usedefault = $usecurrent = 0;
}
elsif (defined($args->{'imageids'})) {
@imageids = @{$args->{'imageids'}};
$usedefault = 0;
$usedefault = $usecurrent = 0;
}
elsif (defined($args->{'imageid'})) {
@imageids = split(/,/, $args->{'imageid'});
$usedefault = 0;
}
if (defined($args->{'usecurrent'}) && $args->{'usecurrent'}) {
$usecurrent = 1;
$usedefault = 0;
$usedefault = $usecurrent = 0;
}
if (defined($args->{'asyncmode'})) {
$asyncmode = $args->{'asyncmode'};
......@@ -579,8 +579,9 @@ sub osload ($$) {
# find the latest full version of the image, then load those in
# reverse order.
#
my @allimages = ();
if ($WITHPROVENANCE && $WITHDELTAS) {
my @nimages = ();
my $founddelta = 0;
foreach my $image (@images) {
if ($image->isdelta()) {
my $pimage = $image;
......@@ -594,12 +595,25 @@ sub osload ($$) {
}
push(@ilist, $pimage);
} while ($pimage->isdelta());
push @nimages, reverse(@ilist);
push @allimages, reverse(@ilist);
$founddelta = 1;
}
push(@allimages, $image);
}
#
# If we added any images to the list, we need to recompute
# the access keys.
#
if ($founddelta) {
@access_keys = ();
foreach my $image (@allimages) {
push(@access_keys, $image->access_key());
}
push(@nimages, $image);
}
@images = @nimages;
} else {
@allimages = @images;
}
my @allimageidxs = (0 .. $#allimages);
#
# Determine which mode to use for reloading this node (note: this may
......@@ -634,7 +648,7 @@ sub osload ($$) {
$wait_required = !$nodeflags{$node}{'nowait'};
}
foreach my $i (@imageidxs) {
foreach my $i (@allimageidxs) {
# This is passed along so that remote node can request the file.
# Make sure the image object has an access key defined.
if (($nodeobject->isremotenode() || $nodeobject->OnRemoteNode())
......@@ -642,7 +656,7 @@ sub osload ($$) {
$access_keys[$i] = TBGenSecretKey();
$rowref->{'access_key'} = $access_keys[$i];
if ($images[$i]->Update({'access_key' => $access_keys[$i]}) != 0) {
if ($allimages[$i]->Update({'access_key' => $access_keys[$i]}) != 0) {
tberror "$node: Could not initialize image access key";
goto failednode;
}
......@@ -659,7 +673,7 @@ sub osload ($$) {
'node' => $node,
'mode' => $reload_mode,
'func' => $reload_func,
'images' => \@images,
'images' => \@allimages,
'osid' => $defosid,
'osid_vers'=> $defvers,
'reboot' => $reboot_required,
......
......@@ -2340,8 +2340,9 @@ sub SetupReload($$)
# find the latest full version of the image, then load those in
# reverse order.
#
my @allimages = ();
if ($WITHPROVENANCE && $WITHDELTAS) {
my @nimages = ();
my $founddelta = 0;
foreach my $image (@images) {
if ($image->isdelta()) {
my $pimage = $image;
......@@ -2355,11 +2356,19 @@ sub SetupReload($$)
}
push(@ilist, $pimage);
} while ($pimage->isdelta());
push @nimages, reverse(@ilist);
push @allimages, reverse(@ilist);
$founddelta = 1;
}
push(@nimages, $image);
push(@allimages, $image);
}
@images = @nimages;
#
# XXX we need to recompute access keys here.
#
if ($founddelta) {
;
}
} else {
@allimages = @images;
}
my $prepare = $self->nodeflag($nodeobject,'prepare');
......@@ -2379,7 +2388,7 @@ sub SetupReload($$)
my $needswinpe = 0;
my $idx = 1;
foreach my $image (@images) {
foreach my $image (@allimages) {
my $imageid = $image->imageid();
my $version = $image->version();
......@@ -2412,7 +2421,7 @@ sub SetupReload($$)
# XXX windows load
if ($needswinpe) {
if (@images > 1) {
if (@allimages > 1) {
tberror("$self: Cannot load more than one image with WinPE/ImageX");
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