support for powerkvm provisioning
This commit is contained in:
parent
5a3847d3ea
commit
17aa3f84ac
@ -89,6 +89,7 @@ require Exporter;
|
||||
|
||||
"1273608367.051780" => "SL5.5", #x86_64 DVD ISO
|
||||
"1299104542.844706" => "SL6", #x86_64 DVD ISO
|
||||
"1394111947.452332" => "pkvm2.1", # ppc64
|
||||
);
|
||||
my %numdiscs = (
|
||||
"1156364963.862322" => 4,
|
||||
|
@ -39,11 +39,27 @@ sub getIPMIAuth {
|
||||
if (defined($tmp)) {
|
||||
$ipmiuser = $tmp->{username};
|
||||
$ipmipass = $tmp->{password};
|
||||
if ($ipmiuser or $ipmipass) {
|
||||
unless($ipmiuser) {
|
||||
$ipmiuser = '';
|
||||
}
|
||||
unless($ipmipass) {
|
||||
$ipmipass = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
($tmp)=$passtab->getAttribs({'key'=>'blade'},'username','password');
|
||||
if (defined($tmp)) {
|
||||
$bladeuser = $tmp->{username};
|
||||
$bladepass = $tmp->{password};
|
||||
if ($bladeuser or $bladepass) {
|
||||
unless($bladeuser) {
|
||||
$bladeuser = '';
|
||||
}
|
||||
unless($bladepass) {
|
||||
$bladepass = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
my $mpatab;
|
||||
@ -58,9 +74,19 @@ sub getIPMIAuth {
|
||||
my $mpa = $mphash->{$node}->[0]->{mpa};
|
||||
if (not $mpaauth{$mpa} and $mpatab) {
|
||||
my $mpaent = $mpatab->getNodeAttribs($mpa,[qw/username password/],prefetchcache=>1); #TODO: this might make more sense to do as one retrieval, oh well
|
||||
if (ref $mpaent and $mpaent->{username}) { $mpaauth{$mpa}->{username} = $mpaent->{username} }
|
||||
if (ref $mpaent and $mpaent->{password}) { $mpaauth{$mpa}->{password} = $mpaent->{password} }
|
||||
$mpaauth{$mpa}->{checked} = 1; #remember we already looked this up, to save lookup time even if search was fruitless
|
||||
if (ref $mpaent and ($mpaent->{username} or $mpaent->{password})) {
|
||||
if (!exists($mpaent->{username})) {
|
||||
$mpaauth{$mpa}->{username} = '';
|
||||
} else {
|
||||
$mpaauth{$mpa}->{username} = $mpaent->{username};
|
||||
}
|
||||
if (!exists($mpaent->{password})) {
|
||||
$mpaauth{$mpa}->{password} = '';
|
||||
} else {
|
||||
$mpaauth{$mpa}->{password} = $mpaent->{password};
|
||||
}
|
||||
}
|
||||
$mpaauth{$mpa}->{checked} = 1; #remember we already looked this up, to save lookup time even if search was fruitless
|
||||
}
|
||||
if ($mpaauth{$mpa}->{username}) { $authmap{$node}->{username} = $mpaauth{$mpa}->{username}; $authmap{$node}->{cliusername}=$mpaauth{$mpa}->{username}; }
|
||||
if ($mpaauth{$mpa}->{password}) { $authmap{$node}->{password} = $mpaauth{$mpa}->{password} ; $authmap{$node}->{clipassword}=$mpaauth{$mpa}->{password} }
|
||||
@ -68,8 +94,18 @@ sub getIPMIAuth {
|
||||
unless (ref $ipmihash and ref $ipmihash->{$node}) {
|
||||
next;
|
||||
}
|
||||
if ($ipmihash->{$node}->[0]->{username}) { $authmap{$node}->{username}=$ipmihash->{$node}->[0]->{username} }
|
||||
if ($ipmihash->{$node}->[0]->{password}) { $authmap{$node}->{password}=$ipmihash->{$node}->[0]->{password} }
|
||||
if ($ipmihash->{$node}->[0]->{username} or $ipmihash->{$node}->[0]->{password}) {
|
||||
unless($ipmihash->{$node}->[0]->{username}) {
|
||||
$authmap{$node}->{username} = '';
|
||||
} else {
|
||||
$authmap{$node}->{username}=$ipmihash->{$node}->[0]->{username};
|
||||
}
|
||||
unless($ipmihash->{$node}->[0]->{password}) {
|
||||
$authmap{$node}->{password} = '';
|
||||
} else {
|
||||
$authmap{$node}->{password}=$ipmihash->{$node}->[0]->{password};
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%authmap;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ sub handled_commands
|
||||
return {
|
||||
copycd => "anaconda",
|
||||
mknetboot => "nodetype:os=(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)",
|
||||
mkinstall => "nodetype:os=(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)",
|
||||
mkinstall => "nodetype:os=(pkvm.*)|(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)",
|
||||
mksysclone => "nodetype:os=(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)",
|
||||
mkstatelite => "nodetype:os=(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)",
|
||||
|
||||
@ -1287,7 +1287,11 @@ sub mkinstall
|
||||
my $kernpath;
|
||||
my $initrdpath;
|
||||
my $maxmem;
|
||||
my $esxi = 0;
|
||||
my $esxi = 0;
|
||||
my $pkvm = 0;
|
||||
if ($os =~ /^pkvm/) {
|
||||
$pkvm = 1;
|
||||
}
|
||||
|
||||
if (
|
||||
(
|
||||
@ -1383,11 +1387,16 @@ sub mkinstall
|
||||
} else {
|
||||
$httpprefix =~ s/^$installroot/\/install/;
|
||||
}
|
||||
my $kcmdline =
|
||||
my $kcmdline;
|
||||
if ($pkvm) {
|
||||
$kcmdline = "ksdevice=bootif kssendmac text selinux=0 rd.dm=0 rd.md=0 repo=$httpmethod://$instserver:$httpport$httpprefix/packages/ kvmp.inst.auto=$httpmethod://$instserver:$httpport/install/autoinst/$node root=live:$httpmethod://$instserver:$httpport$httpprefix/LiveOS/squashfs.img";
|
||||
} else {
|
||||
$kcmdline =
|
||||
"quiet repo=$httpmethod://$instserver:$httpport$httpprefix ks=$httpmethod://"
|
||||
. $instserver . ":". $httpport
|
||||
. "/install/autoinst/"
|
||||
. $node;
|
||||
}
|
||||
if ($maxmem) {
|
||||
$kcmdline.=" mem=$maxmem";
|
||||
}
|
||||
@ -1482,6 +1491,9 @@ sub mkinstall
|
||||
foreach(@addfiles){
|
||||
$kcmdline .= " --- $rtftppath/$_";
|
||||
}
|
||||
}elsif ($pkvm) {
|
||||
$k = "$httpmethod://$instserver:$httpport$tftppath/vmlinuz";
|
||||
$i = "$httpmethod://$instserver:$httpport$tftppath/initrd.img";
|
||||
}else{
|
||||
$k = "$rtftppath/vmlinuz";
|
||||
$i = "$rtftppath/initrd.img";
|
||||
@ -1989,6 +2001,7 @@ sub copycd
|
||||
and $distname !~ /^fedora/
|
||||
and $distname !~ /^SL/
|
||||
and $distname !~ /^ol/
|
||||
and $distname !~ /^pkvm/
|
||||
and $distname !~ /^rh/)
|
||||
{
|
||||
|
||||
|
488
xCAT-server/lib/xcat/plugins/petitboot.pm
Normal file
488
xCAT-server/lib/xcat/plugins/petitboot.pm
Normal file
@ -0,0 +1,488 @@
|
||||
# IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
package xCAT_plugin::petitboot;
|
||||
|
||||
use File::Path;
|
||||
use Getopt::Long;
|
||||
use xCAT::Table;
|
||||
|
||||
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
|
||||
|
||||
my %usage = (
|
||||
"nodeset" => "Usage: nodeset <noderange> osimage[=<imagename>]",
|
||||
);
|
||||
sub handled_commands {
|
||||
return {
|
||||
nodeset => "noderes:netboot"
|
||||
}
|
||||
}
|
||||
|
||||
sub check_dhcp {
|
||||
return 1;
|
||||
#TODO: omapi magic to do things right
|
||||
my $node = shift;
|
||||
my $dhcpfile;
|
||||
open ($dhcpfile,$dhcpconf);
|
||||
while (<$dhcpfile>) {
|
||||
if (/host $node\b/) {
|
||||
close $dhcpfile;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
close $dhcpfile;
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub _slow_get_tftpdir { #make up for paths where tftpdir is not passed in
|
||||
my $node=shift;
|
||||
my $nrtab = xCAT::Table->new('noderes',-create=>0); #in order to detect per-node tftp directories
|
||||
unless ($nrtab) { return $globaltftpdir; }
|
||||
my $ent = $nrtab->getNodeAttribs($node,["tftpdir"]);
|
||||
if ($ent and $ent->{tftpdir}) {
|
||||
return $ent->{tftpdir};
|
||||
} else {
|
||||
return $globaltftpdir;
|
||||
}
|
||||
}
|
||||
|
||||
sub getstate {
|
||||
my $node = shift;
|
||||
my $tftpdir = shift;
|
||||
unless ($tftpdir) { $tftpdir = _slow_get_tftpdir($node); }
|
||||
if (check_dhcp($node)) {
|
||||
if (-r $tftpdir . "/petitboot/".$node) {
|
||||
my $fhand;
|
||||
open ($fhand,$tftpdir . "/petitboot/".$node);
|
||||
my $headline = <$fhand>;
|
||||
close $fhand;
|
||||
$headline =~ s/^#//;
|
||||
chomp($headline);
|
||||
return $headline;
|
||||
} else {
|
||||
return "boot";
|
||||
}
|
||||
} else {
|
||||
return "discover";
|
||||
}
|
||||
}
|
||||
|
||||
sub setstate {
|
||||
=pod
|
||||
|
||||
This function will manipulate the yaboot structure to match what the noderes/chain tables indicate the node should be booting.
|
||||
|
||||
=cut
|
||||
my $node = shift;
|
||||
my %bphash = %{shift()};
|
||||
my %chainhash = %{shift()};
|
||||
my %machash = %{shift()};
|
||||
my $tftpdir = shift;
|
||||
my %nrhash = %{shift()};
|
||||
my $linuximghash = shift();
|
||||
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
|
||||
if ($kern->{kcmdline} =~ /!myipfn!/) {
|
||||
my $ipfn = xCAT::NetworkUtils->my_ip_facing($node);
|
||||
unless ($ipfn) {
|
||||
my $servicenodes = $nrhash{$node}->[0];
|
||||
if ($servicenodes and $servicenodes->{servicenode}) {
|
||||
my @sns = split /,/, $servicenodes->{servicenode};
|
||||
foreach my $sn ( @sns ) {
|
||||
# We are in the service node pools, print error if no facing ip.
|
||||
if (xCAT::InstUtils->is_me($sn)) {
|
||||
my @myself = xCAT::NetworkUtils->determinehostname();
|
||||
my $myname = $myself[(scalar @myself)-1];
|
||||
$::callback->(
|
||||
{
|
||||
error => [
|
||||
"$myname: Unable to determine the image server for $node on service node $sn"
|
||||
],
|
||||
errorcode => [1]
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$::callback->(
|
||||
{
|
||||
error => [
|
||||
"$myname: Unable to determine the image server for $node"
|
||||
],
|
||||
errorcode => [1]
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$kern->{kernel} =~ s/!myipfn!/$ipfn/g;
|
||||
$kern->{initrd} =~ s/!myipfn!/$ipfn/g;
|
||||
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
|
||||
}
|
||||
}
|
||||
if ($kern->{addkcmdline}) {
|
||||
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
|
||||
}
|
||||
|
||||
if($linuximghash and $linuximghash->{'addkcmdline'})
|
||||
{
|
||||
unless($linuximghash->{'boottarget'})
|
||||
{
|
||||
$kern->{kcmdline} .= " ".$linuximghash->{'addkcmdline'};
|
||||
}
|
||||
}
|
||||
|
||||
my $pcfg;
|
||||
unless (-d "$tftpdir/petitboot") {
|
||||
mkpath("$tftpdir/petitboot");
|
||||
}
|
||||
my $nodemac;
|
||||
|
||||
open($pcfg,'>',$tftpdir."/petitboot/".$node);
|
||||
my $cref=$chainhash{$node}->[0]; #$chaintab->getNodeAttribs($node,['currstate']);
|
||||
if ($cref->{currstate}) {
|
||||
print $pcfg "#".$cref->{currstate}."\n";
|
||||
}
|
||||
$normalnodes{$node}=1; #Assume a normal netboot (well, normal dhcp,
|
||||
#which is normally with a valid 'filename' field,
|
||||
#but the typical ppc case will be 'special' makedhcp
|
||||
#to clear the filename field, so the logic is a little
|
||||
#opposite
|
||||
# $sub_req->({command=>['makedhcp'], #This is currently batched elswhere
|
||||
# node=>[$node]},$callback); #It hopefully will perform correctly
|
||||
if ($cref and $cref->{currstate} eq "boot") {
|
||||
$breaknetbootnodes{$node}=1;
|
||||
delete $normalnodes{$node}; #Signify to omit this from one makedhcp command
|
||||
#$sub_req->({command=>['makedhcp'], #batched elsewhere, this code is stale, hopefully
|
||||
# node=>[$node],
|
||||
# arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
|
||||
#print $pcfg "bye\n";
|
||||
close($pcfg);
|
||||
} elsif ($kern and $kern->{kernel}) {
|
||||
#It's time to set yaboot for this node to boot the kernel..
|
||||
print $pcfg "default xCAT\n";
|
||||
print $pcfg "label xCAT\n";
|
||||
print $pcfg "\tkernel $kern->{kernel}\n";
|
||||
if ($kern and $kern->{initrd}) {
|
||||
print $pcfg "\tinitrd ".$kern->{initrd}."\n";
|
||||
}
|
||||
if ($kern and $kern->{kcmdline}) {
|
||||
print $pcfg "\tappend \"".$kern->{kcmdline}."\"\n";
|
||||
}
|
||||
close($pcfg);
|
||||
my $inetn = xCAT::NetworkUtils->getipaddr($node);
|
||||
unless ($inetn) {
|
||||
syslog("local1|err","xCAT unable to resolve IP for $node in petitboot plugin");
|
||||
return;
|
||||
}
|
||||
} else { #TODO: actually, should possibly default to xCAT image?
|
||||
#print $pcfg "bye\n";
|
||||
close($pcfg);
|
||||
}
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($node);
|
||||
unless ($ip) {
|
||||
syslog("local1|err","xCAT unable to resolve IP in petitboot plugin");
|
||||
return;
|
||||
}
|
||||
|
||||
my @ipa=split(/\./,$ip);
|
||||
my $pname = sprintf("%02x%02x%02x%02x",@ipa);
|
||||
$pname = uc($pname);
|
||||
unlink($tftpdir."/".$pname);
|
||||
link($tftpdir."/petitboot/".$node,$tftpdir."/".$pname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $errored = 0;
|
||||
sub pass_along {
|
||||
my $resp = shift;
|
||||
|
||||
# print Dumper($resp);
|
||||
|
||||
$callback->($resp);
|
||||
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
|
||||
$errored=1;
|
||||
}
|
||||
foreach (@{$resp->{node}}) {
|
||||
if ($_->{error} or $_->{errorcode}) {
|
||||
$errored=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub preprocess_request {
|
||||
my $req = shift;
|
||||
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
|
||||
|
||||
my $callback1 = shift;
|
||||
my $command = $req->{command}->[0];
|
||||
my $sub_req = shift;
|
||||
my @args=();
|
||||
if (ref($req->{arg})) {
|
||||
@args=@{$req->{arg}};
|
||||
} else {
|
||||
@args=($req->{arg});
|
||||
}
|
||||
@ARGV = @args;
|
||||
my $nodes = $req->{node};
|
||||
#use Getopt::Long;
|
||||
Getopt::Long::Configure("bundling");
|
||||
Getopt::Long::Configure("pass_through");
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION) ) {
|
||||
if($usage{$command}) {
|
||||
my %rsp;
|
||||
$rsp{data}->[0]=$usage{$command};
|
||||
$callback1->(\%rsp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ($HELP) {
|
||||
if($usage{$command}) {
|
||||
my %rsp;
|
||||
$rsp{data}->[0]=$usage{$command};
|
||||
$callback1->(\%rsp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ($VERSION) {
|
||||
my $ver = xCAT::Utils->Version();
|
||||
my %rsp;
|
||||
$rsp{data}->[0]="$ver";
|
||||
$callback1->(\%rsp);
|
||||
return;
|
||||
}
|
||||
|
||||
if (@ARGV==0) {
|
||||
if($usage{$command}) {
|
||||
my %rsp;
|
||||
$rsp{data}->[0]=$usage{$command};
|
||||
$callback1->(\%rsp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when
|
||||
#if they specify no sharedtftp in site table
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
|
||||
my $t_entry = $entries[0];
|
||||
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
|
||||
# check for computenodes and servicenodes from the noderange, if so error out
|
||||
my @SN;
|
||||
my @CN;
|
||||
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
|
||||
if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] =
|
||||
"Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback1);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$req->{'_disparatetftp'}=[1];
|
||||
if ($req->{inittime}->[0]) {
|
||||
return [$req];
|
||||
}
|
||||
if (@CN >0 ) { # if compute nodes broadcast to all servicenodes
|
||||
return xCAT::Scope->get_broadcast_scope($req,@_);
|
||||
}
|
||||
}
|
||||
return [$req];
|
||||
}
|
||||
|
||||
|
||||
sub process_request {
|
||||
$request = shift;
|
||||
$callback = shift;
|
||||
$::callback=$callback;
|
||||
$sub_req = shift;
|
||||
my $command = $request->{command}->[0];
|
||||
%breaknetbootnodes=();
|
||||
%normalnodes=();
|
||||
|
||||
my @args;
|
||||
my @nodes;
|
||||
my @rnodes;
|
||||
if (ref($request->{node})) {
|
||||
@rnodes = @{$request->{node}};
|
||||
} else {
|
||||
if ($request->{node}) { @rnodes = ($request->{node}); }
|
||||
}
|
||||
unless (@rnodes) {
|
||||
if ($usage{$request->{command}->[0]}) {
|
||||
$callback->({data=>$usage{$request->{command}->[0]}});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#if not shared tftpdir, then filter, otherwise, set up everything
|
||||
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
|
||||
@nodes = ();
|
||||
foreach (@rnodes) {
|
||||
if (xCAT::NetworkUtils->nodeonmynet($_)) {
|
||||
push @nodes,$_;
|
||||
} else {
|
||||
xCAT::MsgUtils->message("S", "$_: petitboot netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@nodes = @rnodes;
|
||||
}
|
||||
|
||||
# return directly if no nodes in the same network
|
||||
unless (@nodes) {
|
||||
xCAT::MsgUtils->message("S", "xCAT: petitboot netboot: no valid nodes. Stop the operation on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ref($request->{arg})) {
|
||||
@args=@{$request->{arg}};
|
||||
} else {
|
||||
@args=($request->{arg});
|
||||
}
|
||||
|
||||
#now run the begin part of the prescripts
|
||||
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
$errored=0;
|
||||
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
|
||||
$sub_req->({command=>['runbeginpre'],
|
||||
node=>\@nodes,
|
||||
arg=>[$args[0], '-l']},\&pass_along);
|
||||
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
|
||||
$sub_req->({command=>['runbeginpre'],
|
||||
node=>\@rnodes,
|
||||
arg=>[$args[0]]},\&pass_along);
|
||||
}
|
||||
if ($errored) {
|
||||
my $rsp;
|
||||
$rsp->{errorcode}->[0]=1;
|
||||
$rsp->{error}->[0]="Failed in running begin prescripts.\n";
|
||||
$callback->($rsp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#back to normal business
|
||||
my $inittime=0;
|
||||
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
|
||||
if (!$inittime) { $inittime=0;}
|
||||
$errored=0;
|
||||
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
$sub_req->({command=>['setdestiny'],
|
||||
node=>\@nodes,
|
||||
inittime=>[$inittime],
|
||||
arg=>\@args},\&pass_along);
|
||||
}
|
||||
if ($errored) { return; }
|
||||
|
||||
my $bptab=xCAT::Table->new('bootparams',-create=>1);
|
||||
my $bphash = $bptab->getNodesAttribs(\@nodes,['kernel','initrd','kcmdline','addkcmdline']);
|
||||
my $chaintab=xCAT::Table->new('chain',-create=>1);
|
||||
my $chainhash=$chaintab->getNodesAttribs(\@nodes,['currstate']);
|
||||
my $noderestab=xCAT::Table->new('noderes',-create=>1);
|
||||
my $nodereshash=$noderestab->getNodesAttribs(\@nodes,['tftpdir']);
|
||||
my $mactab=xCAT::Table->new('mac',-create=>1);
|
||||
my $machash=$mactab->getNodesAttribs(\@nodes,['mac']);
|
||||
my $nrtab=xCAT::Table->new('noderes',-create=>1);
|
||||
my $nrhash=$nrtab->getNodesAttribs(\@nodes,['servicenode']);
|
||||
my $typetab=xCAT::Table->new('nodetype',-create=>1);
|
||||
my $typehash=$typetab->getNodesAttribs(\@nodes,['os','provmethod','arch','profile']);
|
||||
my $linuximgtab=xCAT::Table->new('linuximage',-create=>1);
|
||||
my $osimagetab=xCAT::Table->new('osimage',-create=>1);
|
||||
|
||||
my $rc;
|
||||
my $errstr;
|
||||
|
||||
my $tftpdir;
|
||||
foreach (@nodes) {
|
||||
my %response;
|
||||
if ($nodereshash->{$_} and $nodereshash->{$_}->[0] and $nodereshash->{$_}->[0]->{tftpdir}) {
|
||||
$tftpdir = $nodereshash->{$_}->[0]->{tftpdir};
|
||||
} else {
|
||||
$tftpdir = $globaltftpdir;
|
||||
}
|
||||
$response{node}->[0]->{name}->[0]=$_;
|
||||
if ($args[0] eq 'stat') {
|
||||
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
|
||||
$callback->(\%response);
|
||||
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
|
||||
my $ent = $typehash->{$_}->[0];
|
||||
my $osimgname = $ent->{'provmethod'};
|
||||
my $linuximghash = $linuximghash = $linuximgtab->getAttribs({imagename => $osimgname}, 'boottarget', 'addkcmdline');
|
||||
|
||||
|
||||
($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir,$nrhash,$linuximghash);
|
||||
if ($rc) {
|
||||
$response{node}->[0]->{errorcode}->[0]= $rc;
|
||||
$response{node}->[0]->{errorc}->[0]= $errstr;
|
||||
$callback->(\%response);
|
||||
}
|
||||
}
|
||||
}# end of foreach node
|
||||
|
||||
my @normalnodeset = keys %normalnodes;
|
||||
my @breaknetboot=keys %breaknetbootnodes;
|
||||
#print "yaboot:inittime=$inittime; normalnodeset=@normalnodeset; breaknetboot=@breaknetboot\n";
|
||||
my %osimagenodehash;
|
||||
for my $nn (@normalnodeset){
|
||||
#record the os version for node
|
||||
my $ent = $typehash->{$nn}->[0];
|
||||
my $osimage=$ent->{'provmethod'};
|
||||
push @{$osimagenodehash{$osimage}}, $nn;
|
||||
}
|
||||
|
||||
#Don't bother to try dhcp binding changes if sub_req not passed, i.e. service node build time
|
||||
unless (($args[0] eq 'stat') || ($inittime) || ($args[0] eq 'offline')) {
|
||||
#dhcp stuff
|
||||
my $do_dhcpsetup=1;
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("dhcpsetup");
|
||||
my $t_entry = $entries[0];
|
||||
if (defined($t_entry) ) {
|
||||
if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; }
|
||||
}
|
||||
|
||||
if ($do_dhcpsetup) {
|
||||
foreach my $node (@normalnodeset) {
|
||||
|
||||
my $fpath = "http://9.3.190.175/tftpboot/petitboot/$node";
|
||||
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=> [$node],
|
||||
arg=>['-l','-s','conf-file = \"'.$fpath.'\";']},$callback);
|
||||
} else {
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=> [$node],
|
||||
arg=>['-s','conf-file = \"'.$fpath.'\";']},$callback);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#now run the end part of the prescripts
|
||||
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
|
||||
$errored=0;
|
||||
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
|
||||
$sub_req->({command=>['runendpre'],
|
||||
node=>\@nodes,
|
||||
arg=>[$args[0], '-l']},\&pass_along);
|
||||
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
|
||||
$sub_req->({command=>['runendpre'],
|
||||
node=>\@rnodes,
|
||||
arg=>[$args[0]]},\&pass_along);
|
||||
}
|
||||
if ($errored) {
|
||||
my $rsp;
|
||||
$rsp->{errorcode}->[0]=1;
|
||||
$rsp->{error}->[0]="Failed in running end prescripts\n";
|
||||
$callback->($rsp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
42
xCAT-server/share/xcat/install/pkvm/compute.pkvm2.ppc64.tmpl
Normal file
42
xCAT-server/share/xcat/install/pkvm/compute.pkvm2.ppc64.tmpl
Normal file
@ -0,0 +1,42 @@
|
||||
#
|
||||
# Select a zone
|
||||
# Add the --utc switch if your hardware clock is set to GMT
|
||||
#
|
||||
#timezone US/Hawaii
|
||||
#timezone US/Pacific
|
||||
#timezone US/Mountain
|
||||
#timezone US/Central
|
||||
#timezone US/Eastern
|
||||
timezone --utc "#TABLE:site:key=timezone:value#"
|
||||
|
||||
#
|
||||
# Don't do X
|
||||
#
|
||||
#skipx
|
||||
|
||||
|
||||
#
|
||||
# To generate an encrypted root password use:
|
||||
#
|
||||
# perl -e 'print crypt("blah","Xa") . "\n";'p
|
||||
# openssl passwd -apr1 -salt xxxxxxxx password
|
||||
#
|
||||
# where "blah" is your root password.
|
||||
#
|
||||
rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
|
||||
|
||||
#partition / --ondisk=/dev/mapper/ibmpkvm_vg_root-ibmpkvm_lv_root
|
||||
partition / --ondisk=/dev/sda
|
||||
network --device eth0 --bootproto dhcp
|
||||
|
||||
%post
|
||||
touch "/startpost"
|
||||
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat#
|
||||
touch "/inpost"
|
||||
|
||||
#sleep 1000000
|
||||
|
||||
|
||||
%end
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/awk -f
|
||||
BEGIN {
|
||||
if ((ENVIRON["USEOPENSSLFORXCAT"]) || (ENVIRON["AIX"])) {
|
||||
server = "openssl s_client -quiet -connect " ENVIRON["XCATSERVER"] " 2> /dev/null"
|
||||
server = "openssl s_client -quiet -connect " ENVIRON["XCATSERVER"] " -rand /bin/nice 2> /dev/null"
|
||||
} else {
|
||||
server = "/inet/tcp/0/127.0.0.1/400"
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/awk -f
|
||||
BEGIN {
|
||||
if (ENVIRON["USEOPENSSLFORXCAT"]) {
|
||||
server = "openssl s_client -connect " ENVIRON["XCATSERVER"] " 2> /dev/null"
|
||||
server = "openssl s_client -connect " ENVIRON["XCATSERVER"] " -rand /bin/nice 2> /dev/null"
|
||||
} else {
|
||||
server = "/inet/tcp/0/127.0.0.1/400"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user