2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-12 17:30:19 +00:00

Support nodeset <switch> osimage command for cumulus switch (#5144)

* Support nodeset <switch> osimage command for cumulus switch

* Add logical checking for provemethod and pkgdir

* fix conflict
This commit is contained in:
cxhong
2018-05-02 22:47:17 -04:00
committed by yangsong
parent 2fdfe18151
commit 7bbf1cacec
2 changed files with 26 additions and 4 deletions

View File

@ -693,7 +693,31 @@ sub addnode
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'petitboot') {
$lstatements = 'option conf-file \"http://' . $nxtsrv . '/tftpboot/petitboot/' . $node . '\";' . $lstatements;
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'onie') {
$lstatements = 'if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { option www-server = \"http://' . $nxtsrv . $ntent->{provmethod} . '\";}' . $lstatements;
my $provmethod = $ntent->{provmethod};
if ($provmethod) {
my $linuximagetab = xCAT::Table->new('linuximage');
my $imagetab = $linuximagetab->getAttribs({ imagename => $provmethod }, 'pkgdir');
if ($imagetab) {
my $image_pkgdir = $imagetab->{'pkgdir'};
my @pkgdirs = split(/,/,$image_pkgdir);
my $validpkgdir;
foreach my $mypkgdir (@pkgdirs){
if (-f $mypkgdir) {
$lstatements = 'if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { option www-server = \"http://' . $nxtsrv . $mypkgdir . '\";}' . $lstatements;
$validpkgdir = 1;
last;
}
}
unless ($validpkgdir) {
$callback->({ warning => ["osimage $provmethod pkgdir doesn't exists"]});
}
} else {
$callback->({ warning => ["osimage $provmethod is not defined in the osimage table"]});
}
} else {
$callback->({ warning => ["provmethod is not defined for $node"]});
}
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'nimol') {
$lstatements = 'supersede server.filename=\"/vios/nodes/' . $node . '\";' . $lstatements;
}

View File

@ -91,14 +91,12 @@ sub process_request {
my $command = $request->{command}->[0];
my $args = $request->{arg};
my %hosts;
if ($::XCATSITEVALS{xcatdebugmode} != 0) { $::VERBOSE = 1}
if ($command eq "copydata") {
copydata($request, $callback);
} elsif ($command eq "nodeset") {
nodeset($request, $callback, $subreq, \%hosts);
nodeset($request, $callback, $subreq);
}
}