diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 0eb224ba7..1ca4bd68a 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -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; } diff --git a/xCAT-server/lib/xcat/plugins/onie.pm b/xCAT-server/lib/xcat/plugins/onie.pm index 833f7e5f0..b26214ec8 100644 --- a/xCAT-server/lib/xcat/plugins/onie.pm +++ b/xCAT-server/lib/xcat/plugins/onie.pm @@ -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); } }