2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

check the existance of osimage; set os and arch of node to be the relevant attribute in osimage during nodeset (#5162)

This commit is contained in:
yangsong 2018-05-03 17:03:54 +08:00 committed by Bin Xu
parent 5d6e9fe7a0
commit 9874c11063

View File

@ -23,7 +23,6 @@ use xCAT::MsgUtils;
use xCAT::TableUtils;
use xCAT::SvrUtils;
use xCAT::Table;
my $xcatdebugmode = 0;
$::VERBOSE = 0;
@ -256,18 +255,30 @@ sub nodeset {
xCAT::MsgUtils->message("E", { error => ["nodeset command is not processed for $switch, only supports switchtype=onie"], errorcode => ["1"] }, $callback);
next;
}
if ($setosimg) {
$provmethod = $setosimg;
$nodetab->setAttribs({ 'node' => $switch }, {'provmethod' => $setosimg});
} else {
$provmethod = $nodehash->{$switch}->[0]->{provmethod};
}
if ($::VERBOSE) {
xCAT::MsgUtils->message("I", { data => ["$switch has provmethod=$provmethod"] }, $callback);
}
#get pkgdir from osimage
my $linuximagetab = xCAT::Table->new('linuximage');
my $imagetab = $linuximagetab->getAttribs({ imagename => $provmethod }, 'pkgdir');
my $osimagetab = xCAT::Table->new('osimage');
my $imagetab = $linuximagetab->getAttribs({ imagename => $provmethod },'pkgdir');
my $osimghash = $osimagetab->getAttribs({ imagename => $provmethod },'osvers','osarch');
unless($imagetab and $osimghash){
xCAT::MsgUtils->message("E", { error => ["cannot find osimage \"$provmethod\" for $switch, please make sure the osimage specified in command line or node.provmethod exists!"], errorcode => ["1"] }, $callback);
next;
}
my %attribs=('provmethod' => $provmethod,'os'=>$osimghash->{'osvers'},'arch'=>$osimghash->{'osarch'} );
$nodetab->setAttribs({ 'node' => $switch }, \%attribs);
$image_pkgdir = $imagetab->{'pkgdir'};
#validate the image pkgdir