Commit 5882f0a2 authored by David Johnson's avatar David Johnson

Mirror libosload properly for image/os load in libosload_new.

libosload_new wasn't accepting the "new" types of ways to specify
one or more images to load on nodes, so manual os_load wasn't
working.  I also mirrored the usedefault and usecurrent stuff from
libosload into libosload_new; will make it easier in the future.
parent f71af0ff
...@@ -408,6 +408,7 @@ sub osload($$$) { ...@@ -408,6 +408,7 @@ sub osload($$$) {
$flags{zerofree} = 0; $flags{zerofree} = 0;
$flags{prepare} = 0; $flags{prepare} = 0;
$flags{swapinfo} = 0; $flags{swapinfo} = 0;
$flags{usedefault} = 1;
# These come in from the caller. # These come in from the caller.
my @imageids; my @imageids;
...@@ -442,11 +443,24 @@ sub osload($$$) { ...@@ -442,11 +443,24 @@ sub osload($$$) {
$flags{$flag} = $args->{$flag}; $flags{$flag} = $args->{$flag};
} }
# handle some of the flags specially # handle some of the flags specially
if (defined($args->{'imageid'})) { if ($flags{usecurrent}) {
@imageids = split(/,/, $args->{'imageid'}); $flags{usedefault} = 0;
}
if (defined($args->{'image'})) {
@images = split(/,/, $args->{'image'});
$flags{usedefault} = $flags{usecurrent} = 0;
}
elsif (defined($args->{'images'})) {
@images = @{$args->{'images'}};
$flags{usedefault} = $flags{usecurrent} = 0;
} }
if (defined($args->{'imageids'})) { elsif (defined($args->{'imageids'})) {
@imageids = @{$args->{'imageids'}}; @imageids = @{$args->{'imageids'}};
$flags{usedefault} = $flags{usecurrent} = 0;
}
elsif (defined($args->{'imageid'})) {
@imageids = split(/,/, $args->{'imageid'});
$flags{usedefault} = $flags{usecurrent} = 0;
} }
if (defined($args->{'nodeflags'})) { if (defined($args->{'nodeflags'})) {
%nodeflags = %{$args->{'nodeflags'}}; %nodeflags = %{$args->{'nodeflags'}};
...@@ -1739,13 +1753,17 @@ sub AddNode($$$$) ...@@ -1739,13 +1753,17 @@ sub AddNode($$$$)
my $imagelistref = $self->GetImages($nodeobject); my $imagelistref = $self->GetImages($nodeobject);
if (!defined($imagelistref) || scalar(@$imagelistref) == 0) { if ($self->nodeflag($nodeobject,'usedefault')) {
if (defined($imagelistref) && scalar(@$imagelistref)) {
tbwarn("$self AddNode($node_id): we were given $imagelist, but are " .
" going to use the default OS instead!");
}
if ($self->_LoadDefaultImages($nodeobject)) { if ($self->_LoadDefaultImages($nodeobject)) {
return -1; return -1;
} }
} }
elsif ($self->nodeflag($nodeobject,'usecurrent')) {
if ($self->nodeflag($nodeobject,'usecurrent')) {
if (defined($imagelistref) && scalar(@$imagelistref)) { if (defined($imagelistref) && scalar(@$imagelistref)) {
tbwarn("$self AddNode($node_id): we were given $imagelist, but are " . tbwarn("$self AddNode($node_id): we were given $imagelist, but are " .
" going to use the current OS instead!"); " going to use the current OS instead!");
......
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