Commit 475598b2 authored by David Johnson's avatar David Johnson

Couple bugs: code copy from libosload in prev commit was incomplete.

(Also, sometimes the list of images supplied to libosload_new will be
null, like in the case where we want to just reconfigure a switch.  So,
handle that safely.)
parent 5991c2d1
......@@ -499,6 +499,17 @@ sub osload($$$) {
}
}
if (@imageids) {
foreach my $imageid (@imageids) {
my $image = Image->Lookup($imageid);
if (!defined($image)) {
tberror("No such imageid $imageid");
return -1;
}
push(@images, $image);
}
}
foreach my $i (0 .. $#imageids) {
my $imageid = $imageids[$i];
$images[$i] = Image->Lookup($imageid);
......@@ -1788,7 +1799,15 @@ sub _CheckImages($$)
$self->dprint(0,"_CheckImages($node_id)");
my @images = @{$self->GetImages($nodeobject)};
my $imagelistref = $self->GetImages($nodeobject);
if (!defined($imagelistref)) {
#
# Sometimes we can be called with no images to load, just so we
# can reconfigure the node. So catch that case.
#
return 0;
}
my @images = @$imagelistref;
my @imageids = map { $_->imageid() } @images;
my @imageidxs = (0 .. $#imageids);
......
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