2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 01:26:38 +00:00

add recommend netboot value for vios

This commit is contained in:
immarvin 2015-05-25 04:49:48 -04:00
parent 357ba37a75
commit ce7c2b6012
2 changed files with 21 additions and 19 deletions

View File

@ -4542,6 +4542,7 @@ sub splitkcmdline{
#Input Params:
# $osvers: the osname of the osimage,i.e,rhels7.1,sles11.3,ubuntu14.04.1 ...
# $osarch: the osarch of the osimage,i.e, x86_64,ppc64,ppc64le ...
# $imagetype: the osimage.imagetype, i.e, Linux,NIM
#Return value:
# a string of the possible noderes.netboot values delimited with comma ","
# i.e, "pxe,xnba", empty on fail.
@ -4553,6 +4554,7 @@ sub lookupNetboot{
$osvers=shift;
}
my $osarch=shift;
my $imgtype=shift;
my $ret="";
my $osv;
@ -4569,19 +4571,21 @@ sub lookupNetboot{
$osm = 0;
}
if ($osarch =~ /^x86_64$/i){
$ret= "xnba,pxe";
}elsif($osarch =~ /^ppc64$/i){
if(($osv =~ /rh/i and $osn < 7) or ($osv =~ /sles/i and $osn < 12)){
$ret="yaboot";
}else{
$ret="grub2,grub2-tftp,grub2-http";
if($imgtype =~ /^NIM$/i){
$ret="nimol";
}elsif($imgtype =~ /^Linux$/i){
if ($osarch =~ /^x86_64$/i){
$ret= "xnba,pxe";
}elsif($osarch =~ /^ppc64$/i){
if(($osv =~ /rh/i and $osn < 7) or ($osv =~ /sles/i and $osn < 12)){
$ret="yaboot";
}else{
$ret="grub2,grub2-tftp,grub2-http";
}
}elsif($osarch =~ /^ppc64le$/i or $osarch =~ /^ppc64el$/i){
$ret="petiboot,grub2,grub2-tftp,grub2-http";
}
}elsif($osarch =~ /^ppc64le$/i or $osarch =~ /^ppc64el$/i){
$ret="petitboot,grub2,grub2-tftp,grub2-http";
}
}
return $ret;
}

View File

@ -208,7 +208,7 @@ sub setdestiny {
if (@{$req->{node}} == 0) { return;}
if ($target) {
my $osimagetable=xCAT::Table->new('osimage');
(my $ref) = $osimagetable->getAttribs({imagename => $target}, 'provmethod', 'osvers', 'profile', 'osarch');
(my $ref) = $osimagetable->getAttribs({imagename => $target}, 'provmethod', 'osvers', 'profile', 'osarch','imagetype');
if ($ref) {
if ($ref->{provmethod}) {
@ -222,10 +222,8 @@ sub setdestiny {
$errored =1; $callback->({errorcode=>[1],error=>"Cannot find the OS image $target on the osimage table."});
return;
}
#if the noderes.netboot is invalid for the specified osimage provision
#report error and exit
my $netbootval=xCAT::Utils->lookupNetboot($ref->{osvers},$ref->{osarch});
my $netbootval=xCAT::Utils->lookupNetboot($ref->{osvers},$ref->{osarch},$ref->{imagetype});
unless($netbootval =~ /$curnetboot/i){
$errored =1;
$callback->({errorcode=>[1],error=> [join(",",@{$req->{node}}).":stop configuration because $curnetboot DOES NOT work for provision of $target, please choose the correct noderes.netboot value in the subset \"$netbootval\",see description of 'netboot' attributes in 'tabdump -d noderes' for details."]});
@ -258,11 +256,11 @@ sub setdestiny {
if (($osimage) && ($osimage ne 'install') && ($osimage ne 'netboot') && ($osimage ne 'statelite')) {
if (!exists($updatestuff->{$osimage})) {
my $osimagetable=xCAT::Table->new('osimage');
(my $ref) = $osimagetable->getAttribs({imagename => $osimage}, 'provmethod', 'osvers', 'profile', 'osarch');
(my $ref) = $osimagetable->getAttribs({imagename => $osimage}, 'provmethod', 'osvers', 'profile', 'osarch','imagetype');
if ($ref) {
#check whether the noderes.netboot is set appropriately
#if not,push the nodes into $invalidosimghash->{$osimage}->{netboot}
my $netbootval=xCAT::Utils->lookupNetboot($ref->{osvers},$ref->{osarch});
my $netbootval=xCAT::Utils->lookupNetboot($ref->{osvers},$ref->{osarch},$ref->{imagetype});
if($netbootval =~ /$curnetboot/i){
push(@validnodes,$tmpnode);
}else{