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

1, make the error as node level error in sles/debian plugin so that nodeset can know which are the failure nodes (#4122)

2, using global variable for failurenodes in grub2 plugin
This commit is contained in:
Bin Xu 2017-10-19 16:09:33 +08:00 committed by yangsong
parent 9c5446645e
commit da60d783d0
3 changed files with 139 additions and 362 deletions

View File

@ -504,24 +504,6 @@ sub mkinstall {
require xCAT::Template;
# Warning message for nodeset <noderange> install/netboot/statelite
foreach my $knode (keys %osents)
{
my $ent = $osents{$knode}->[0];
if ($ent && $ent->{provmethod}
&& (($ent->{provmethod} eq 'install') || ($ent->{provmethod} eq 'netboot') || ($ent->{provmethod} eq 'statelite')))
{
my @ents = xCAT::TableUtils->get_site_attribute("disablenodesetwarning");
my $site_ent = $ents[0];
if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/))
{
$callback->({ error => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated, use \"nodeset <noderange> osimage=<osimage_name>\" instead."], errorcode => [1] });
# Do not print this warning message multiple times
exit(1);
}
}
}
foreach $node (@nodes)
{
@ -613,9 +595,7 @@ sub mkinstall {
}
}
else {
$callback->(
{ error => ["The os image $imagename does not exists on the osimage table for $node"],
errorcode => [1] });
xCAT::MsgUtils->report_node_error($callback, $node, "The OS image '$imagename' for node does not exist");
next;
}
}
@ -651,6 +631,10 @@ sub mkinstall {
xCAT::MsgUtils->trace($verbose_on_off, "d", "debian->mkinstall: imagename=$imagename pkgdir=$pkgdir pkglistfile=$pkglistfile tmplfile=$tmplfile");
}
else {
# This is deprecated mode to define node's provmethod, not supported now.
xCAT::MsgUtils->report_node_error($callback, $node, "OS image name must be specified in nodetype.provmethod");
next;
$os = $ent->{os};
$arch = $ent->{arch};
$profile = $ent->{profile};
@ -713,14 +697,12 @@ sub mkinstall {
}
unless ($os and $arch and $profile) {
$callback->({ error => [ "Missing " . join(',', @missingparms) . " for $node" ],
errorcode => [1] });
xCAT::MsgUtils->report_node_error($callback, $node, "Missing " . join(',', @missingparms) . " for $node");
next; # No profile
}
unless (-r "$tmplfile") {
$callback->({ error => [ "No $platform preseed template exists for " . $profile ],
errorcode => [1] });
xCAT::MsgUtils->report_node_error($callback, $node, "No $platform preseed template exists for " . $profile);
next;
}
@ -782,13 +764,14 @@ sub mkinstall {
my $errtmp;
if ($errtmp = $tmperr or $errtmp = $preerr or $errtmp = $posterr) {
$callback->({ node => [ { name => [$node], error => [$errtmp], errorcode => [1] } ] });
xCAT::MsgUtils->report_node_error($callback, $node, $errtmp);
next;
}
if ($arch =~ /ppc64/i and !(-e "$pkgdir/install/netboot/initrd.gz")) {
$callback->({ error => ["The network boot initrd.gz is not found in $pkgdir/install/netboot. This is provided by Ubuntu, please download and retry."],
errorcode => [1] });
xCAT::MsgUtils->report_node_error($callback, $node,
"The network boot initrd.gz is not found in $pkgdir/install/netboot. This is provided by Ubuntu, please download and retry."
);
next;
}
my $tftpdir = "/tftpboot";
@ -892,8 +875,7 @@ sub mkinstall {
#TODO: dd=<url> for driver disks
if (defined($sent->{serialport})) {
unless ($sent->{serialspeed}) {
$callback->({ error => ["serialport defined, but no serialspeed for $node in nodehm table"],
errorcode => [1] });
xCAT::MsgUtils->report_node_error($callback, $node, "serialport defined, but no serialspeed for this node in nodehm table");
next;
}
if ($arch =~ /ppc64/i) {
@ -942,10 +924,10 @@ sub mkinstall {
$bootparams->{$node}->[0]->{kcmdline} = $kcmdline;
}
else {
$callback->({ error => ["Install image not found in $installroot/$os/$arch"],
errorcode => [1] });
xCAT::MsgUtils->report_node_error($callback, $node, "Install image not found in $installroot/$os/$arch");
next;
}
}
}# end foreach node
}
sub mknetboot
@ -1023,27 +1005,6 @@ sub mknetboot
$stateHash = $statetab->getNodesAttribs(\@nodes, ['statemnt']);
}
foreach my $knode (keys %oents)
{
my $ent = $oents{$knode}->[0];
if ($ent && $ent->{provmethod}
&& (($ent->{provmethod} eq 'install') || ($ent->{provmethod} eq 'netboot') || ($ent->{provmethod} eq 'statelite')))
{
my @ents = xCAT::TableUtils->get_site_attribute("disablenodesetwarning");
my $site_ent = $ents[0];
if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/))
{
$callback->(
{
error => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated, use \"nodeset <noderange> osimage=<osimage_name>\" instead."], errorcode => [1]
}
);
# Do not print this warning message multiple times
exit(1);
}
}
}
foreach my $node (@nodes)
{
my $osver;
@ -1097,9 +1058,7 @@ sub mknetboot
$img_hash{$imagename}->{crashkernelsize} = $ref1->{'crashkernelsize'};
}
} else {
$callback->(
{ error => ["The os image $imagename does not exists on the osimage table for $node"],
errorcode => [1] });
xCAT::MsgUtils->report_node_error($callback, $node, "The OS image '$imagename' for node does not exist");
next;
}
}
@ -1120,6 +1079,10 @@ sub mknetboot
$dump = $ph->{dump};
}
else {
# This is deprecated mode to define node's provmethod, not supported now.
xCAT::MsgUtils->report_node_error($callback, $node, "OS image name must be specified in nodetype.provmethod");
next;
$osver = $ent->{os};
$arch = $ent->{arch};
$profile = $ent->{profile};
@ -1144,10 +1107,10 @@ sub mknetboot
$rootfstype = $ref1->{'rootfstype'};
}
} else {
$callback->(
{ error => [qq{Cannot find the linux image called "$osver-$arch-$imgname-$profile", maybe you need to use the "nodeset <nr> osimage=<osimage name>" command to set the boot state}],
errorcode => [1] }
);
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Cannot find the linux image called "$osver-$arch-$imgname-$profile", maybe you need to use the "nodeset <nr> osimage=<osimage name>" command to set the boot state}
);
next;
}
if (!$linuximagetab) {
@ -1162,22 +1125,17 @@ sub mknetboot
$crashkernelsize = $ref1->{'crashkernelsize'};
}
} else {
$callback->(
{ error => [qq{ Cannot find the linux image called "$osver-$arch-$imgname-$profile", maybe you need to use the "nodeset <nr> osimage=<your_image_name>" command to set the boot state}],
errorcode => [1] }
);
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Cannot find the linux image called "$osver-$arch-$imgname-$profile", maybe you need to use the "nodeset <nr> osimage=<osimage name>" command to set the boot state}
);
next;
}
}
#print"osvr=$osver, arch=$arch, profile=$profile, imgdir=$rootimgdir\n";
unless ($osver and $arch and $profile)
{
$callback->(
{
error => ["Insufficient nodetype entry or osimage entry for $node"],
errorcode => [1]
}
);
xCAT::MsgUtils->report_node_error($callback, $node, "Insufficient nodetype entry or osimage entry for $node");
next;
}
@ -1187,18 +1145,16 @@ sub mknetboot
# statelite images are not packed.
if ($statelite) {
unless (-r "$rootimgdir/kernel") {
$callback->({
error => [qq{Did you run "genimage" before running "liteimg"? kernel cannot be found at $rootimgdir/kernel on $myname}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Did you run "genimage" before running "liteimg"? kernel cannot be found at $rootimgdir/kernel on $myname}
);
next;
}
if (!-r "$rootimgdir/initrd-statelite.gz") {
if (!-r "$rootimgdir/initrd.gz") {
$callback->({
error => [qq{Did you run "genimage" before running "liteimg"? initrd.gz or initrd-statelite.gz cannot be found}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Did you run "genimage" before running "liteimg"? initrd.gz or initrd-statelite.gz cannot be found}
);
next;
}
else {
@ -1206,26 +1162,24 @@ sub mknetboot
}
}
if ($rootfstype eq "ramdisk" and !-r "$rootimgdir/rootimg-statelite.gz") {
$callback->({
error => [qq{No packed image for platform $osver, architecture $arch and profile $profile, please run "liteimg" to create it.}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node,
qq{No packed image for platform $osver, architecture $arch and profile $profile, please run "liteimg" to create it.}
);
next;
}
} else {
unless (-r "$rootimgdir/kernel") {
$callback->({
error => [qq{Did you run "genimage" before running "packimage"? kernel cannot be found at $rootimgdir/kernel on $myname}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Did you run "genimage" before running "packimage"? kernel cannot be found at $rootimgdir/kernel on $myname}
);
next;
}
if (!-r "$rootimgdir/initrd-stateless.gz") {
if (!-r "$rootimgdir/initrd.gz") {
$callback->({
error => [qq{Did you run "genimage" before running "packimage"? initrd.gz or initrd-stateless.gz cannot be found}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Did you run "genimage" before running "packimg"? initrd.gz or initrd-statelite.gz cannot be found}
);
next;
next;
}
else {
@ -1233,9 +1187,9 @@ sub mknetboot
}
}
unless (-f -r "$rootimgdir/$compressedrootimg") {
$callback->({
error => ["No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"],
errorcode => [1] });
xCAT::MsgUtils->report_node_error($callback, $node,
"No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch)"
);
next;
}
}
@ -1290,24 +1244,13 @@ sub mknetboot
$initrdloc .= "/initrd-statelite.gz";
}
unless (-r "$tftppath/kernel" and -r $initrdloc) {
$callback->({
error => [qq{copying to $tftppath failed}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node, qq{Copying to $tftppath failed.});
next;
}
} else {
unless (-r "$tftppath/kernel" and -r "$tftppath/initrd-stateless.gz")
{
$callback->(
{
error => [
"Copying to $tftppath failed"
],
errorcode => [1]
}
);
unless (-r "$tftppath/kernel" and -r "$tftppath/initrd-stateless.gz") {
xCAT::MsgUtils->report_node_error($callback, $node, qq{Copying to $tftppath failed.});
next;
}
}
@ -1358,16 +1301,8 @@ sub mknetboot
#}
$imgsrv = $xcatmaster;
}
unless ($imgsrv)
{
$callback->(
{
error => [
"Unable to determine or reasonably guess the image server for $node"
],
errorcode => [1]
}
);
unless ($imgsrv) {
xCAT::MsgUtils->report_node_error($callback, $node, "Unable to determine or reasonably guess the image server for $node");
next;
}
my $kcmdline;
@ -1527,28 +1462,19 @@ sub mknetboot
}
if (defined $sent->{serialport})
{
if (defined $sent->{serialport}) {
#my $sent = $hmtab->getNodeAttribs($node,['serialspeed','serialflow']);
unless ($sent->{serialspeed})
{
$callback->(
{
error => [
"serialport defined, but no serialspeed for $node in nodehm table"
],
errorcode => [1]
}
);
unless ($sent->{serialspeed}) {
xCAT::MsgUtils->report_node_error($callback, $node,"serialport defined, but no serialspeed for $node in nodehm table");
next;
}
if ($arch =~ /ppc64/i) {
$kcmdline .=
"console=tty0 console=hvc" . $sent->{serialport} . "," . $sent->{serialspeed};
"console=tty0 console=hvc" . $sent->{serialport} . "," . $sent->{serialspeed};
} else {
$kcmdline .=
"console=tty0 console=ttyS" . $sent->{serialport} . "," . $sent->{serialspeed};
"console=tty0 console=ttyS" . $sent->{serialport} . "," . $sent->{serialspeed};
}
if ($sent->{serialflow} =~ /(hard|tcs|ctsrts)/)
{

View File

@ -513,6 +513,8 @@ sub process_request {
$sub_req = shift;
my $command = $request->{command}->[0];
undef %failurenodes;
my @args;
#>>>>>>>used for trace log start>>>>>>>
my %opt;
@ -564,7 +566,6 @@ sub process_request {
my @nodes = ();
# Filter those nodes which have bad DNS: not resolvable or inconsistent IP
my %failurenodes = ();
my %preparednodes = ();
foreach (@rnodes) {
my $ipret = xCAT::NetworkUtils->checkNodeIPaddress($_);

View File

@ -56,36 +56,25 @@ sub mknetboot
}
my $bootparams = ${$req->{bootparams}};
my $globaltftpdir = "/tftpboot";
my $nodes = @{ $req->{node} };
my @nodes = @{ $req->{node} };
my $noupdateinitrd = $req->{'noupdateinitrd'};
my $ignorekernelchk = $req->{'ignorekernelchk'};
my $ostab = xCAT::Table->new('nodetype');
#my $sitetab = xCAT::Table->new('site');
my $linuximagetab;
my $pkgdir;
my $osimagetab;
my $installroot;
$installroot = "/install";
my $installroot = xCAT::TableUtils->getInstallDir();
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
xCAT::MsgUtils->trace(0, "d", "sles->mknetboot: installroot=$installroot globaltftpdir=$globaltftpdir");
my $xcatdport = "3001";
my $xcatiport = "3002";
my $nodestatus = "y";
#if ($sitetab)
#{
#(my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
my @entries = xCAT::TableUtils->get_site_attribute("installdir");
my @entries = xCAT::TableUtils->get_site_attribute("xcatdport");
my $t_entry = $entries[0];
if (defined($t_entry)) {
$installroot = $t_entry;
}
#($ref) = $sitetab->getAttribs({key => 'xcatdport'}, 'value');
@entries = xCAT::TableUtils->get_site_attribute("xcatdport");
$t_entry = $entries[0];
if (defined($t_entry)) {
$xcatdport = $t_entry;
}
@ -102,8 +91,8 @@ sub mknetboot
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[ (scalar @myself) - 1 ];
#}
my $ostab = xCAT::Table->new('nodetype');
my $ntents = $ostab->getNodesAttribs($req->{node}, [ 'os', 'arch', 'profile', 'provmethod' ]);
my %img_hash = ();
@ -124,28 +113,6 @@ sub mknetboot
my %donetftp = ();
# Warning message for nodeset <noderange> install/netboot/statelite
foreach my $knode (keys %{$ntents})
{
my $ent = $ntents->{$knode}->[0];
if ($ent && $ent->{provmethod}
&& (($ent->{provmethod} eq 'install') || ($ent->{provmethod} eq 'netboot') || ($ent->{provmethod} eq 'statelite')))
{
my @ents = xCAT::TableUtils->get_site_attribute("disablenodesetwarning");
my $site_ent = $ents[0];
if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/))
{
$callback->(
{
error => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated, use \"nodeset <noderange> osimage=<osimage_name>\" instead."], errorcode => [1]
}
);
# Do not print this warning message multiple times
exit(1);
}
}
}
foreach my $node (@nodes)
{
my $osver;
@ -215,9 +182,7 @@ sub mknetboot
}
} else {
$callback->(
{ error => ["The os image $imagename does not exists on the osimage table for $node"],
errorcode => [1] });
xCAT::MsgUtils->report_node_error($callback, $node, "The OS image '$imagename' for node does not exist");
next;
}
}
@ -237,6 +202,10 @@ sub mknetboot
$rootimgdir = "$installroot/netboot/$osver/$arch/$profile";
}
} else {
# This is deprecated mode to define node's provmethod, not supported now.
xCAT::MsgUtils->report_node_error($callback, $node, "OS image name must be specified in nodetype.provmethod");
next;
$osver = $ent->{os};
$arch = $ent->{arch};
$profile = $ent->{profile};
@ -258,10 +227,10 @@ sub mknetboot
$rootfstype = $ref1->{'rootfstype'};
}
} else {
$callback->(
{ error => [qq{Cannot find the linux image called "$osver-$arch-$provmethod-$profile", maybe you need to use the "nodeset <nr> osimage=<osimage name>" command to set the boot state}],
errorcode => [1] }
);
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Cannot find the linux image called "$osver-$arch-$imgname-$profile", maybe you need to use the "nodeset <nr> osimage=<osimage name>" command to set the boot state}
);
next;
}
#get the dump path and kernel crash memory side for kdump on sles
@ -299,22 +268,17 @@ sub mknetboot
}
}
else {
$callback->(
{ error => [qq{ Cannot find the linux image called "$osver-$arch-$imgname-$profile", maybe you need to use the "nodeset <nr> osimage=<your_image_name>" command to set the boot state}],
errorcode => [1] }
);
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Cannot find the linux image called "$osver-$arch-$imgname-$profile", maybe you need to use the "nodeset <nr> osimage=<osimage name>" command to set the boot state}
);
next;
}
$rootimgdir = "$installroot/netboot/$osver/$arch/$profile";
}
unless ($osver and $arch and $profile)
{
$callback->(
{
error => ["Insufficient nodetype entry or osimage entry for $node"],
errorcode => [1]
}
);
xCAT::MsgUtils->report_node_error($callback, $node, "Insufficient nodetype entry or osimage entry for $node");
next;
}
@ -334,26 +298,23 @@ sub mknetboot
if ($statelite) {
unless (-r "$rootimgdir/kernel") {
$callback->({
error => [qq{Did you run "genimage" before running "liteimg"? kernel cannot be found at $rootimgdir/kernel on $myname}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Did you run "genimage" before running "liteimg"? kernel cannot be found at $rootimgdir/kernel on $myname}
);
next;
}
if ($rootfstype eq "ramdisk" and !-r "$rootimgdir/rootimg-statelite.gz") {
$callback->({
error => [qq{No packed rootimage for the platform $osver, arch $arch and profile $profile, please run liteimg to create it}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node,
qq{No packed rootimage for the platform $osver, arch $arch and profile $profile, please run liteimg to create it}
);
next;
}
if (!-r "$rootimgdir/initrd-statelite.gz") {
if (!-r "$rootimgdir/initrd.gz") {
$callback->({
error => [qq{Did you run "genimage" before running "liteimg"? initrd.gz or initrd-statelite.gz cannot be found}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Did you run "genimage" before running "liteimg"? initrd.gz or initrd-statelite.gz cannot be found}
);
next;
}
else {
@ -363,18 +324,16 @@ sub mknetboot
} else {
unless (-r "$rootimgdir/kernel") {
$callback->({
error => [qq{Did you run "genimage" before running "packimage"? kernel cannot be found at $rootimgdir/kernel on $myname}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Did you run "genimage" before running "packimage"? kernel cannot be found at $rootimgdir/kernel on $myname}
);
next;
}
if (!-r "$rootimgdir/initrd-stateless.gz") {
if (!-r "$rootimgdir/initrd.gz") {
$callback->({
error => [qq{Did you run "genimage" before running "packimage"? initrd.gz or initrd-stateless.gz cannot be found}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node,
qq{Did you run "genimage" before running "packimage"? initrd.gz or initrd-stateless.gz cannot be found}
);
next;
}
else {
@ -383,10 +342,9 @@ sub mknetboot
}
unless (-r -f "$rootimgdir/$compressedrootimg") {
$callback->({
error => [qq{No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage before nodeset}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node,
qq{No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage before nodeset}
);
next;
}
}
@ -430,19 +388,13 @@ sub mknetboot
if ($statelite) {
unless (-r "$tftppath/kernel" and -r "$tftppath/initrd-statelite.gz") {
$callback->({
error => [qq{copying to $tftppath failed}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node, qq{Copying to $tftppath failed.});
next;
}
} else {
unless (-r "$tftppath/kernel"
and -r "$tftppath/initrd-stateless.gz") {
$callback->({
error => [qq{copying to $tftppath failed}],
errorcode => [1]
});
xCAT::MsgUtils->report_node_error($callback, $node, qq{Copying to $tftppath failed.});
next;
}
}
@ -496,16 +448,11 @@ sub mknetboot
}
unless ($imgsrv)
{
$callback->(
{
error => [
"Unable to determine or reasonably guess the image server for $node"
],
errorcode => [1]
}
);
xCAT::MsgUtils->report_node_error($callback, $node, "Unable to determine or reasonably guess the image server for $node");
next;
}
# Start to build kcmdline
my $kcmdline;
if ($statelite)
{
@ -531,8 +478,7 @@ sub mknetboot
$kcmdline = "NFSROOT=$nfssrv:$nfsdir STATEMNT=";
}
} else {
$kcmdline =
"imgurl=$httpmethod://$imgsrv/$rootimgdir/rootimg-statelite.gz STATEMNT=";
$kcmdline = "imgurl=$httpmethod://$imgsrv/$rootimgdir/rootimg-statelite.gz STATEMNT=";
}
# add support for subVars in the value of "statemnt"
@ -653,24 +599,16 @@ sub mknetboot
if (defined $sent->{serialport}) {
#my $sent = $hmtab->getNodeAttribs($node,['serialspeed','serialflow']);
unless ($sent->{serialspeed})
{
$callback->(
{
error => [
"serialport defined, but no serialspeed for $node in nodehm table"
],
errorcode => [1]
}
);
unless ($sent->{serialspeed}) {
xCAT::MsgUtils->report_node_error($callback, $node,"serialport defined, but no serialspeed for $node in nodehm table");
next;
}
if ($arch =~ /ppc64le/i) {
$kcmdline .=
"console=tty0 console=hvc" . $sent->{serialport} . "," . $sent->{serialspeed};
"console=tty0 console=hvc" . $sent->{serialport} . "," . $sent->{serialspeed};
} else {
$kcmdline .=
"console=tty0 console=ttyS" . $sent->{serialport} . "," . $sent->{serialspeed};
"console=tty0 console=ttyS" . $sent->{serialport} . "," . $sent->{serialspeed};
}
if ($sent->{serialflow} =~ /(hard|tcs|ctsrts)/)
{
@ -764,14 +702,12 @@ sub mkinstall
my $request = shift;
my $callback = shift;
my $doreq = shift;
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
my $noupdateinitrd = $request->{'noupdateinitrd'};
my $ignorekernelchk = $request->{'ignorekernelchk'};
my $bootparams = ${$request->{bootparams}};
my @nodes = @{ $request->{node} };
my $node;
my $ostab = xCAT::Table->new('nodetype');
#my $sitetab = xCAT::Table->new('site');
my $linuximagetab;
@ -793,10 +729,10 @@ sub mkinstall
#>>>>>>>used for trace log end>>>>>>>
my $ostab = xCAT::Table->new('nodetype');
my $ntents = $ostab->getNodesAttribs($request->{node}, [ 'os', 'arch', 'profile', 'provmethod' ]);
my %img_hash = ();
my $installroot;
$installroot = "/install";
my $restab = xCAT::Table->new('noderes');
my $hmtab = xCAT::Table->new('nodehm');
my $resents =
@ -810,47 +746,15 @@ sub mkinstall
my $hments =
$hmtab->getNodesAttribs(\@nodes, [ 'serialport', 'serialspeed', 'serialflow' ]);
#if ($sitetab)
#{
#(my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
my @entries = xCAT::TableUtils->get_site_attribute("installdir");
my $t_entry = $entries[0];
if (defined($t_entry)) {
$installroot = $t_entry;
}
#}
xCAT::MsgUtils->trace($verbose_on_off, "d", "sles->mkinstall: installroot=$installroot");
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
my $installroot = xCAT::TableUtils->getInstallDir();
xCAT::MsgUtils->trace($verbose_on_off, "d", "sles->mkinstall: installroot=$installroot globaltftpdir=$globaltftpdir");
my %donetftp;
require xCAT::Template; #only used here, load so memory can be COWed
# Define a variable for driver update list
my @dd_drivers;
# Warning message for nodeset <noderange> install/netboot/statelite
foreach my $knode (keys %{$ntents})
{
my $ent = $ntents->{$knode}->[0];
if ($ent && $ent->{provmethod}
&& (($ent->{provmethod} eq 'install') || ($ent->{provmethod} eq 'netboot') || ($ent->{provmethod} eq 'statelite')))
{
my @ents = xCAT::TableUtils->get_site_attribute("disablenodesetwarning");
my $site_ent = $ents[0];
if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/))
{
$callback->(
{
error => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated, use \"nodeset <noderange> osimage=<osimage_name>\" instead."], errorcode => [1]
}
);
# Do not print this warning message multiple times
exit(1);
}
}
}
foreach $node (@nodes)
{
my $os;
@ -922,9 +826,7 @@ sub mkinstall
}
}
} else {
$callback->(
{ error => ["The os image $imagename does not exists on the osimage table for $node"],
errorcode => [1] });
xCAT::MsgUtils->report_node_error($callback, $node, "The OS image '$imagename' for node does not exist");
next;
}
@ -973,6 +875,10 @@ sub mkinstall
xCAT::MsgUtils->trace($verbose_on_off, "d", "sles->mkinstall: imagename=$imagename pkgdir=$pkgdir pkglistfile=$pkglistfile tmplfile=$tmplfile partfile=$partfile");
}
else {
# This is deprecated mode to define node's provmethod, not supported now.
xCAT::MsgUtils->report_node_error($callback, $node, "OS image name must be specified in nodetype.provmethod");
next;
$os = $ent->{os};
$arch = $ent->{arch};
$profile = $ent->{profile};
@ -1011,34 +917,25 @@ sub mkinstall
}
}
else {
$callback->(
{ error => [qq{ Cannot find the linux image called "$imgname", maybe you need to use the "nodeset <nr> osimage=<your_image_name>" command to set the boot state}], errorcode => [1] }
);
xCAT::MsgUtils->report_node_error($callback, $node,
qq{ Cannot find the linux image called "$imgname", maybe you need to use the "nodeset <nr> osimage=<your_image_name>" command to set the boot state}
);
}
}
unless ($os and $arch and $profile)
{
$callback->(
{
error => ["No profile defined in nodetype or osimage table for $node"],
errorcode => [1]
}
);
xCAT::MsgUtils->report_node_error($callback, $node, "Insufficient nodetype entry or osimage entry for $node");
next;
}
unless (-r "$tmplfile")
{
$callback->(
{
error =>
[ "No AutoYaST template exists for " . $ent->{profile} . " in directory $installroot/custom/install/$plat or $::XCATROOT/share/xcat/install/$plat" ],
errorcode => [1]
}
);
xCAT::MsgUtils->report_node_error($callback, $node,
"No AutoYaST template exists for " . $ent->{profile} . " in directory $installroot/custom/install/$plat or $::XCATROOT/share/xcat/install/$plat"
);
next;
}
@ -1073,19 +970,8 @@ sub mkinstall
);
}
if ($tmperr)
{
$callback->(
{
node => [
{
name => [$node],
error => [$tmperr],
errorcode => [1]
}
]
}
);
if ($tmperr) {
xCAT::MsgUtils->report_node_error($callback, $node, $tmperr);
next;
}
@ -1262,14 +1148,8 @@ sub mkinstall
if ($::XCATSITEVALS{managedaddressmode} =~ /static/) {
my ($ipaddr, $hostname, $gateway, $netmask) = xCAT::NetworkUtils->getNodeNetworkCfg($node);
unless ($ipaddr) {
$callback->(
{
error => [
"cannot resolve the ip address of $node"
],
errorcode => [1]
}
);
xCAT::MsgUtils->report_node_error($callback, $node, "cannot resolve the ip address of $node");
next;
}
if ($gateway eq '<xcatmaster>') {
my @gatewayd = xCAT::NetworkUtils->my_ip_facing($ipaddr);
@ -1324,18 +1204,9 @@ sub mkinstall
}
if (defined $sent->{serialport})
{
unless ($sent->{serialspeed})
{
$callback->(
{
error => [
"serialport defined, but no serialspeed for $node in nodehm table"
],
errorcode => [1]
}
);
if (defined($sent->{serialport})) {
unless ($sent->{serialspeed}) {
xCAT::MsgUtils->report_node_error($callback, $node, "serialport defined, but no serialspeed for this node in nodehm table");
next;
}
if ($arch =~ /ppc64le/i) {
@ -1402,18 +1273,11 @@ sub mkinstall
}
}
}
else
{
$callback->(
{
error => [
"Failed to detect copycd configured install source at /install/$os/$arch"
],
errorcode => [1]
}
);
else {
xCAT::MsgUtils->report_node_error($callback, $node, "Failed to detect copycd configured install source at /install/$os/$arch");
next;
}
}
} # end foreach node
#my $rc = xCAT::TableUtils->create_postscripts_tar();
#if ($rc != 0)
@ -1432,23 +1296,9 @@ sub mksysclone
my $osimagetab;
my %img_hash = ();
my $installroot;
my $globaltftpdir;
$installroot = "/install";
$globaltftpdir = "/tftpboot";
my @ents = xCAT::TableUtils->get_site_attribute("installdir");
my $site_ent = $ents[0];
if (defined($site_ent))
{
$installroot = $site_ent;
}
@ents = xCAT::TableUtils->get_site_attribute("tftpdir");
$site_ent = $ents[0];
if (defined($site_ent))
{
$globaltftpdir = $site_ent;
}
my $installroot = xCAT::TableUtils->getInstallDir();
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
xCAT::MsgUtils->trace(0, "d", "sles->mksysclone: installroot=$installroot globaltftpdir=$globaltftpdir");
my $node;
my $ostab = xCAT::Table->new('nodetype');