mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-10-15 08:12:02 +00:00
Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
=head1 NAME
|
||||
|
||||
B<restartxcatd> - Restart the xCAT daemon (xcatd) on AIX.
|
||||
B<restartxcatd> - Restart the xCAT daemon (xcatd).
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
@@ -9,9 +9,32 @@ B<restartxcatd> [[B<-h>|B<--help>] | [B<-v>|B<--version>] | [B<-r>|B<--reload>]]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<restartxcatd> command restarts the xCAT daemon (xcatd) on AIX.
|
||||
It uses the startsrc and stopsrc commands to do the restart work. If the xcatd subsystem was not created, B<restartxcatd> will create it automatically.
|
||||
The B<restartxcatd> command restarts the xCAT daemon (xcatd).
|
||||
|
||||
B<Linux Specific>
|
||||
|
||||
=over 2
|
||||
|
||||
It will perform the xcatd I<fast restart>. The xcatd I<fast restart> is a specific restart which has two advantages compares to the I<stop> and then I<start>.
|
||||
1. The interval of xcatd out of service is very short.
|
||||
2. The in processing request which initiated by old xcatd will not be stopped by force. The old xcatd will hand over the sockets to new xcatd, but old xcat will still be waiting for the in processing request to finish before the exit.
|
||||
|
||||
It does the same thing as 'service xcatd restart' on NON-systemd enabled Operating System like rh6.x and sles11.x. But for the systemd enabled Operating System like rh7 and sles12, the 'service xcatd restart' just do the I<stop> and I<start> instead of xcatd I<fast restart>.
|
||||
|
||||
It's recommended to use B<restartxcatd> command to restart xcatd on systemd enable system like rh7 and sles12 instead of 'service xcatd restart' or 'systemctl restart xcatd'.
|
||||
|
||||
=back
|
||||
|
||||
B<AIX Specific>
|
||||
|
||||
=over 2
|
||||
|
||||
It runs 'stopsrc -s xcatd' to stop xcatd first if xcatd is active, then runs 'startsrc -s xcatd' to start xcatd.
|
||||
|
||||
If the xcatd subsystem was not created, B<restartxcatd> will create it automatically.
|
||||
|
||||
=back
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ sub getNodesetStates
|
||||
my @yabootnodes = ();
|
||||
my @xnbanodes= ();
|
||||
my @grub2nodes = ();
|
||||
my @petitbootnodes = ();
|
||||
my $tabdata = $tab->getNodesAttribs(\@nodes, ['node', 'netboot']);
|
||||
foreach my $node (@nodes)
|
||||
{
|
||||
@@ -80,6 +81,10 @@ sub getNodesetStates
|
||||
{
|
||||
push(@grub2nodes, $node);
|
||||
}
|
||||
elsif ($nb eq "petitboot")
|
||||
{
|
||||
push(@petitbootnodes, $node);
|
||||
}
|
||||
}
|
||||
|
||||
my @retarray;
|
||||
@@ -148,6 +153,17 @@ sub getNodesetStates
|
||||
xCAT::MsgUtils->message('E', $retarray[1]);
|
||||
}
|
||||
}
|
||||
if (@petitbootnodes > 0)
|
||||
{
|
||||
require xCAT_plugin::petitboot;
|
||||
@retarray = xCAT_plugin::petitboot::getNodesetStates(\@petitbootnodes, $hashref);
|
||||
if ($retarray[0])
|
||||
{
|
||||
$retcode = $retarray[0];
|
||||
$errormsg .= $retarray[1];
|
||||
xCAT::MsgUtils->message('E', $retarray[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (0, "");
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ sub process_request {
|
||||
}
|
||||
}
|
||||
if ($matchedver && $matchedrel) {
|
||||
xCAT::MsgUtils->message("E", {error => ["The necessary rpm perl-Net-DNS-0.73-1.28 needs be updated to a higher version for makedns to function. You can get a workable version perl-Net-DNS-0.80-1.x86_64.rpm from xCAT Dependency Repository. e.g. For sles12: zypper install perl-Net-DNS-0.80-1.x86_64"], errorcode => [1]}, $callback);
|
||||
xCAT::MsgUtils->message("E", {error => ["The necessary rpm perl-Net-DNS-0.73-1.28 needs be updated to a higher version for makedns to function. You can get a workable version perl-Net-DNS-0.80-1.x86_64.rpm from xCAT Dependency Repository. e.g. For sles12: zypper install perl-Net-DNS-0.80-1.<arch>"], errorcode => [1]}, $callback);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3862,7 +3862,7 @@ sub lskitcomp_processargs {
|
||||
# Option -C for kit component attributes
|
||||
if ( defined($::opt_C) ) {
|
||||
$::kitcompattrs = split_comma_delim_str($::opt_C);
|
||||
push ($::kitcompattrs,"kitcompname");
|
||||
push (@{$::kitcompattrs},"kitcompname");
|
||||
ensure_kitname_attr_in_list($::kitcompattrs);
|
||||
if (check_attr_names_exist('kitcomponent', $::kitcompattrs) != 0) {
|
||||
return 3;
|
||||
|
||||
@@ -401,9 +401,9 @@ sub reconfigvm {
|
||||
$_->setData(getUnits($confdata->{vm}->{$node}->[0]->{memory},"M",1024));
|
||||
}
|
||||
}
|
||||
if (defined $confdata->{vm}->{$node}->[0]->{cpus}) {
|
||||
if (defined $confdata->{vm}->{$node}->[0]->{vcpus}) {
|
||||
$needfixin=1;
|
||||
$domdesc->findnodes("/domain/vcpu/text()")->[0]->setData($confdata->{vm}->{$node}->[0]->{cpus});
|
||||
$domdesc->findnodes("/domain/vcpu/text()")->[0]->setData($confdata->{vm}->{$node}->[0]->{vcpus});
|
||||
}
|
||||
if (defined $confdata->{vm}->{$node}->[0]->{bootorder}) {
|
||||
my @expectedorder = split(/[:,]/,$confdata->{vm}->{$node}->[0]->{bootorder});
|
||||
@@ -664,6 +664,12 @@ sub build_xmldesc {
|
||||
my $cdloc=$args{cd};
|
||||
my %xtree=();
|
||||
my $hypcpumodel = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cpumodel};
|
||||
my $hypcputype = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cputype};
|
||||
my $hypcputhreads = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cpu_thread};
|
||||
unless ($hypcputhreads) {
|
||||
$hypcputhreads = "1";
|
||||
}
|
||||
|
||||
$xtree{type}='kvm';
|
||||
$xtree{name}->{content}=$node;
|
||||
$xtree{uuid}->{content}=getNodeUUID($node);
|
||||
@@ -683,15 +689,38 @@ sub build_xmldesc {
|
||||
} else {
|
||||
$xtree{memory}->{content}=524288;
|
||||
}
|
||||
if ($args{cpus}) {
|
||||
$xtree{vcpu}->{content}=$args{cpus};
|
||||
if ($confdata->{vm}->{$node}->[0]->{cpus}) {
|
||||
if ($hypcpumodel eq "ppc64") {
|
||||
my %cpuhash = ();
|
||||
$cpuhash{model} = $hypcputype;
|
||||
if ($args{cpus}) {
|
||||
$xtree{vcpu}->{content}=$args{cpus} * $hypcputhreads;
|
||||
$cpuhash{topology}->{sockets} = 1;
|
||||
$cpuhash{topology}->{cores} = $args{cpus};
|
||||
$cpuhash{topology}->{threads} = $hypcputhreads;
|
||||
$updatetable->{vm}->{$node}->{cpus}=$args{cpus};
|
||||
} elsif (defined $confdata->{vm}->{$node}->[0]->{cpus}) {
|
||||
$xtree{vcpu}->{content}=$confdata->{vm}->{$node}->[0]->{cpus} * $hypcputhreads;
|
||||
$cpuhash{topology}->{sockets} = 1;
|
||||
$cpuhash{topology}->{cores} = $confdata->{vm}->{$node}->[0]->{cpus};
|
||||
$cpuhash{topology}->{threads} = $hypcputhreads;
|
||||
} else {
|
||||
$xtree{vcpu}->{content}=1 * $hypcputhreads;
|
||||
$cpuhash{topology}->{sockets} = 1;
|
||||
$cpuhash{topology}->{cores} = 1;
|
||||
$cpuhash{topology}->{threads} = $hypcputhreads;
|
||||
}
|
||||
} elsif (defined $confdata->{vm}->{$node}->[0]->{cpus}) {
|
||||
$xtree{vcpu}->{content}=$confdata->{vm}->{$node}->[0]->{cpus};
|
||||
$xtree{cpu} = \%cpuhash;
|
||||
} else {
|
||||
$xtree{vcpu}->{content}=1;
|
||||
if ($args{cpus}) {
|
||||
$xtree{vcpu}->{content}=$args{cpus};
|
||||
if ($confdata->{vm}->{$node}->[0]->{cpus}) {
|
||||
$updatetable->{vm}->{$node}->{cpus}=$args{cpus};
|
||||
}
|
||||
} elsif (defined $confdata->{vm}->{$node}->[0]->{cpus}) {
|
||||
$xtree{vcpu}->{content}=$confdata->{vm}->{$node}->[0]->{cpus};
|
||||
} else {
|
||||
$xtree{vcpu}->{content}=1;
|
||||
}
|
||||
}
|
||||
if (defined ($confdata->{vm}->{$node}->[0]->{clockoffset})) {
|
||||
#If user requested a specific behavior, give it
|
||||
@@ -1416,7 +1445,7 @@ sub rinv {
|
||||
xCAT::SvrUtils::sendmsg("Maximum Memory: $maxmem MB", $callback,$node);
|
||||
|
||||
}
|
||||
invstorage($domain);
|
||||
invstorage($domain, $dom);
|
||||
invnics($domain);
|
||||
}
|
||||
sub get_storage_pool_by_volume {
|
||||
@@ -1444,7 +1473,8 @@ sub get_storage_pool_by_path {
|
||||
}
|
||||
|
||||
sub invstorage {
|
||||
my $domain = shift;
|
||||
my $domain = shift; # the dom obj of XML
|
||||
my $dom = shift; # the real domain obj
|
||||
my @disks = $domain->findnodes('/domain/devices/disk');
|
||||
my $disk;
|
||||
foreach $disk (@disks) {
|
||||
@@ -1465,29 +1495,39 @@ sub invstorage {
|
||||
next;
|
||||
}
|
||||
my $file = $candidatenodes[0]->getAttribute('file');
|
||||
#we'll attempt to map file path to pool name and volume name
|
||||
#fallback to just reporting filename if not feasible
|
||||
#libvirt lacks a way to lookup a storage pool by path, so we'll only do so if using the 'default' xCAT scheme with uuid in the path
|
||||
$file =~ m!/([^/]*)/($node\..*)\z!;
|
||||
my $volname=$2;
|
||||
my $vollocation=$file;
|
||||
eval {
|
||||
my $pool = get_storage_pool_by_path($file);
|
||||
my $poolname = $pool->get_name();
|
||||
$vollocation = "[$poolname] $volname";
|
||||
};
|
||||
#at least I get to skip the whole pool mess here
|
||||
my $vol = $hypconn->get_storage_volume_by_path($file);
|
||||
my $dev = $candidatenodes[0]->getAttribute('dev');
|
||||
my $vollocation;
|
||||
my $size;
|
||||
if ($vol) {
|
||||
my %info = %{$vol->get_info()};
|
||||
if ($info{allocation} and $info{capacity}) {
|
||||
$size = $info{allocation};
|
||||
$size = $size/1048576; #convert to MB
|
||||
$size = sprintf("%.3f",$size);
|
||||
$size .= "/".($info{capacity}/1048576);
|
||||
my %info;
|
||||
if ($file) { # for the volumn is a file in storage poll
|
||||
#we'll attempt to map file path to pool name and volume name
|
||||
#fallback to just reporting filename if not feasible
|
||||
#libvirt lacks a way to lookup a storage pool by path, so we'll only do so if using the 'default' xCAT scheme with uuid in the path
|
||||
$file =~ m!/([^/]*)/($node\..*)\z!;
|
||||
my $volname=$2;
|
||||
$vollocation=$file;
|
||||
eval {
|
||||
my $pool = get_storage_pool_by_path($file);
|
||||
my $poolname = $pool->get_name();
|
||||
$vollocation = "[$poolname] $volname";
|
||||
};
|
||||
#at least I get to skip the whole pool mess here
|
||||
my $vol = $hypconn->get_storage_volume_by_path($file);
|
||||
if ($vol) {
|
||||
%info = %{$vol->get_info()};
|
||||
}
|
||||
} elsif ($dev) { # for the volumn is a block device
|
||||
$vollocation = $dev;
|
||||
%info = %{$dom->get_block_info($dev)};
|
||||
}
|
||||
|
||||
if ($info{allocation} and $info{capacity}) {
|
||||
$size = $info{allocation};
|
||||
$size = $size/1048576; #convert to MB
|
||||
$size = sprintf("%.3f",$size);
|
||||
$size .= "/".($info{capacity}/1048576);
|
||||
}
|
||||
|
||||
$callback->({
|
||||
node=>{
|
||||
name=>$node,
|
||||
@@ -1846,6 +1886,16 @@ sub chvm {
|
||||
} else { #offline xml edits
|
||||
my $parsed=$parser->parse_string($vmxml); #TODO: should only do this once, oh well
|
||||
if ($cpucount) {
|
||||
my $hypcpumodel = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cpumodel};
|
||||
if ($hypcpumodel eq "ppc64") {
|
||||
my $hypcputype = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cputype};
|
||||
my $cputhreads = $parsed->findnodes("/domain/cpu/topology")->[0]->getAttribute('threads');
|
||||
unless ($cputhreads) {
|
||||
$cputhreads = "1";
|
||||
}
|
||||
$parsed->findnodes("/domain/cpu/topology")->[0]->setAttribute('cores'=>$cpucount);
|
||||
$cpucount *= $cputhreads;
|
||||
}
|
||||
$parsed->findnodes("/domain/vcpu/text()")->[0]->setData($cpucount);
|
||||
}
|
||||
if ($memory) {
|
||||
@@ -3011,6 +3061,20 @@ sub dohyp {
|
||||
my $nodeinfo = $hypconn->get_node_info();
|
||||
if (exists($nodeinfo->{model})) {
|
||||
$confdata->{$hyp}->{cpumodel} = $nodeinfo->{model};
|
||||
if ($nodeinfo->{model} eq "ppc64") {
|
||||
my $syshash = XMLin($hypconn->get_sysinfo());
|
||||
my $processor_content = $syshash->{processor}->[0]->{entry}->{type}->{content};
|
||||
if ($processor_content =~ /POWER8/i) {
|
||||
$confdata->{$hyp}->{cputype} = "power8";
|
||||
$confdata->{$hyp}->{cpu_thread} = "8";
|
||||
} elsif ($processor_content =~ /POWER7/i) {
|
||||
$confdata->{$hyp}->{cputype} = "power7";
|
||||
$confdata->{$hyp}->{cpu_thread} = "4";
|
||||
} elsif ($processor_content =~ /POWER6/i) {
|
||||
$confdata->{$hyp}->{cputype} = "power6";
|
||||
$confdata->{$hyp}->{cpu_thread} = "2";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3018,6 +3082,13 @@ sub dohyp {
|
||||
if ($confdata->{$hyp}->{cpumodel} and $confdata->{$hyp}->{cpumodel} =~ /ppc64/i) {
|
||||
$confdata->{vm}->{$node}->[0]->{storagemodel} = "scsi";
|
||||
}
|
||||
if ($confdata->{$hyp}->{cpu_thread}) {
|
||||
$confdata->{vm}->{$node}->[0]->{cpu_thread} = $confdata->{$hyp}->{cpu_thread};
|
||||
}
|
||||
if ($confdata->{$hyp}->{cputype}) {
|
||||
$confdata->{vm}->{$node}->[0]->{cputype} = $confdata->{$hyp}->{cputype};
|
||||
}
|
||||
|
||||
my ($rc,@output) = guestcmd($hyp,$node,$command,@$args);
|
||||
|
||||
foreach(@output) {
|
||||
|
||||
@@ -508,4 +508,71 @@ sub process_request {
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
=head3 getNodesetStates
|
||||
returns the nodeset state for the given nodes. The possible nodeset
|
||||
states are: netboot, install, boot and discover.
|
||||
Arguments:
|
||||
nodes --- a pointer to an array of nodes
|
||||
states -- a pointer to a hash table. This hash will be filled by this
|
||||
function.The key is the nodeset status and the value is a pointer
|
||||
to an array of nodes.
|
||||
Returns:
|
||||
(return code, error message)
|
||||
=cut
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getNodesetStates {
|
||||
my $noderef=shift;
|
||||
if ($noderef =~ /xCAT_plugin::petitboot/) {
|
||||
$noderef=shift;
|
||||
}
|
||||
my @nodes=@$noderef;
|
||||
my $hashref=shift;
|
||||
my $noderestab = xCAT::Table->new('noderes'); #in order to detect per-node tftp directories
|
||||
my %nrhash = %{$noderestab->getNodesAttribs(\@nodes,[qw(tftpdir)])};
|
||||
|
||||
if (@nodes>0) {
|
||||
foreach my $node (@nodes) {
|
||||
my $tftpdir;
|
||||
if ($nrhash{$node}->[0] and $nrhash{$node}->[0]->{tftpdir}) {
|
||||
$tftpdir = $nrhash{$node}->[0]->{tftpdir};
|
||||
} else {
|
||||
$tftpdir = $globaltftpdir;
|
||||
}
|
||||
my $tmp=getstate($node, $tftpdir);
|
||||
my @a=split(' ', $tmp);
|
||||
my $stat = $a[0];
|
||||
if (exists($hashref->{$stat})) {
|
||||
my $pa=$hashref->{$stat};
|
||||
push(@$pa, $node);
|
||||
}
|
||||
else {
|
||||
$hashref->{$stat}=[$node];
|
||||
}
|
||||
}
|
||||
}
|
||||
return (0, "");
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -2,7 +2,33 @@
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
#(C)IBM Corp
|
||||
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
=head1 restartxcatd
|
||||
|
||||
restartxcatd - this routine is used to restart the xcatd process group.
|
||||
|
||||
Linux: It will perform the xcatd fast restart. The 'xcatd fast restart'
|
||||
has two advantages compares to the 'service stop and then start'.
|
||||
1. The interval of xcatd out of service is very short.
|
||||
2. The in processing request which initiated by old xcatd will
|
||||
not be stopped by force. The old xcatd will hand over the sockets
|
||||
to new xcatd, but old xcat will still be waiting for the in processing
|
||||
request to finish before the exit.
|
||||
|
||||
It does the same thing as 'service xcatd restart' on NON-systemd OS like
|
||||
rh6.x and sles11.x. But for the systemd enabled OS like rh7 and sles12,
|
||||
the 'service xcatd restart' just do the 'stop and start' instead of
|
||||
'xcatd fast restart'.
|
||||
|
||||
SO, it's recommended to use 'restartxcatd' command to restart xcatd on
|
||||
systemd enable system like rh7 and sles12 instead of 'service xcatd restart' or
|
||||
'systemctl restart xcatd'.
|
||||
|
||||
AIX: It runs 'stopsrc -s xcatd' to stop xcatd first if xcatd is active,
|
||||
then runs 'startsrc -s xcatd' to start xcatd.
|
||||
|
||||
=cut
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@@ -17,35 +43,6 @@ use File::Basename;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::Utils;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head1 startstopxcatd
|
||||
|
||||
|
||||
|
||||
restartxcatd - this routine is used to restart the xcatd processes by
|
||||
startsrc and stopsrc commands.
|
||||
It runs on AIX.
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Main
|
||||
|
||||
$::RE_CHECK_NUM = 10; # the times to check the result of command, the checking interval is 1 second
|
||||
|
||||
my $rc;
|
||||
my @output;
|
||||
my $inoperative = 0;
|
||||
my $check_num;
|
||||
|
||||
if (!(xCAT::Utils->isAIX()))
|
||||
{ # only runs on AIX
|
||||
xCAT::MsgUtils->message("E", "Error: This command should only be run on AIX.");
|
||||
exit 1;
|
||||
|
||||
}
|
||||
|
||||
my $cmd = basename($0);
|
||||
# for auditing
|
||||
my $current_userid = getpwuid($>);
|
||||
@@ -63,6 +60,40 @@ $rsp->{command} -> [0] = $cmd;
|
||||
$rsp->{status} -> [0] = "allowed";
|
||||
xCAT::MsgUtils->message("SA",$rsp); # syslog and auditlog
|
||||
|
||||
|
||||
# for Linux specific
|
||||
if (xCAT::Utils->isLinux())
|
||||
{
|
||||
print "Restarting xCATd ";
|
||||
if (-r "/etc/profile.d/xcat.sh") {
|
||||
$cmd = "source /etc/profile.d/xcat.sh;";
|
||||
}
|
||||
|
||||
$cmd .= "xcatd -p /var/run/xcatd.pid";
|
||||
xCAT::Utils->runcmd("$cmd", -1);
|
||||
if ($::RUNCMD_RC == 0) {
|
||||
print "[ OK ]\n";
|
||||
system ("logger -p local4.info -t xCAT Restart xcatd: [ OK ].");
|
||||
exit 0;
|
||||
} else {
|
||||
print "[ FAILED ]\n";
|
||||
system ("logger -p local4.info -t xCAT Restart xcatd: [ FAILED ].");
|
||||
exit 1;
|
||||
}
|
||||
} elsif (!(xCAT::Utils->isAIX())) {
|
||||
xCAT::MsgUtils->message("E", "Error: This command should only be run on Linux or AIX.");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Following code is for AIX only
|
||||
|
||||
$::RE_CHECK_NUM = 10; # the times to check the result of command, the checking interval is 1 second
|
||||
|
||||
my $rc;
|
||||
my @output;
|
||||
my $inoperative = 0;
|
||||
my $check_num;
|
||||
|
||||
# Check whether the xcatd subsystem has been created
|
||||
$cmd = "/usr/bin/lssrc -s xcatd | grep \"xcatd Subsystem is not on file\"";
|
||||
@output = `$cmd`;
|
||||
|
||||
Regular → Executable
+3
-1
@@ -63,7 +63,9 @@ do
|
||||
export XCATSERVER
|
||||
mv $i/postscripts /xcatpost
|
||||
rm -rf $i
|
||||
chmod +x /xcatpost/*
|
||||
# To support the postscripts in the subdirectories under /install/postscripts
|
||||
#chmod +x /xcatpost/*
|
||||
chmod -R +x `find /xcatpost/ -maxdepth 1 -print | grep -E -v '^(/xcatpost/|/xcatpost/_xcat|/xcatpost/_ssh|/xcatpost/ca|/xcatpost/hostkeys)$'`
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
|
||||
@@ -43,7 +43,9 @@ do
|
||||
# If mypostscript doesn't exist, we will get it through getpostscript.awk
|
||||
if [ ! -x /xcatpost/mypostscript ]; then
|
||||
|
||||
chmod +x /xcatpost/*
|
||||
# To support the postscripts in the subdirectories under /install/postscripts
|
||||
# chmod +x /xcatpost/*
|
||||
chmod -R +x `find /xcatpost/ -maxdepth 1 -print | grep -E -v '^(/xcatpost/|/xcatpost/_xcat|/xcatpost/_ssh|/xcatpost/ca|/xcatpost/hostkeys)$'`
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript
|
||||
|
||||
|
||||
|
||||
@@ -38,9 +38,24 @@ d-i partman-md/device_remove_md boolean true
|
||||
#create the /tmp/partitioning based on the uefi or legacy bios
|
||||
d-i partman/early_command string \
|
||||
set -x; \
|
||||
DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*sd[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o 'sd.*$'`; \
|
||||
if [[ $DEV == "" ]]; then DEV="sda"; fi; \
|
||||
echo "/dev/$DEV" > /tmp/boot_disk; \
|
||||
rm /tmp/devs-with-boot 2>/dev/null || true; \
|
||||
for d in $(list-devices partition); do \
|
||||
mkdir -p /tmp/mymount; \
|
||||
rc=0; \
|
||||
mount $d /tmp/mymount || rc=$?; \
|
||||
if [[ $rc -eq 0 ]]; then \
|
||||
[[ -d /tmp/mymount/boot ]] && echo $d >>/tmp/devs-with-boot; \
|
||||
umount /tmp/mymount; \
|
||||
fi \
|
||||
done; \
|
||||
if [[ -e /tmp/devs-with-boot ]]; then \
|
||||
head -n1 /tmp/devs-with-boot | egrep -o '\S+[^0-9]' > /tmp/boot_disk; \
|
||||
rm /tmp/devs-with-boot 2>/dev/null || true; \
|
||||
else \
|
||||
DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*sd[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o 'sd.*$'`; \
|
||||
if [[ $DEV == "" ]]; then DEV="sda"; fi; \
|
||||
echo "/dev/$DEV" > /tmp/boot_disk; \
|
||||
fi; \
|
||||
debconf-set partman-auto/disk "$(cat /tmp/boot_disk)"
|
||||
d-i partman-auto/expert_recipe_file string /tmp/partitioning
|
||||
|
||||
@@ -109,6 +124,9 @@ d-i preseed/early_command string wget http://`cat /tmp/xcatserver`/install/autoi
|
||||
chmod u+x #HOSTNAME#.pre; \
|
||||
./#HOSTNAME#.pre
|
||||
|
||||
# To workaround the "Unmount partitions that are in use?" question
|
||||
d-i preseed/early_command string umount /media || true
|
||||
|
||||
d-i preseed/late_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.post; \
|
||||
chmod u+x #HOSTNAME#.post; \
|
||||
cp ./#HOSTNAME#.post /target/root/post.script; \
|
||||
|
||||
@@ -105,6 +105,9 @@ d-i preseed/early_command string wget http://`cat /tmp/xcatserver`/install/autoi
|
||||
chmod u+x #HOSTNAME#.pre; \
|
||||
./#HOSTNAME#.pre
|
||||
|
||||
# To workaround the "Unmount partitions that are in use?" question
|
||||
d-i preseed/early_command string umount /media || true
|
||||
|
||||
d-i preseed/late_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.post; \
|
||||
chmod u+x #HOSTNAME#.post; \
|
||||
cp ./#HOSTNAME#.post /target/root/post.script; \
|
||||
|
||||
@@ -909,8 +909,8 @@ EOF`
|
||||
|
||||
#Handle the rest with rpm
|
||||
if [ "$plain_pkgs" != "" -a -n "$OTHERPKGDIR" ]; then
|
||||
echo "Warning: the packages $plain_pkgs could not be found in the repository, falling back to rpm command, did you forget to run createrepo?"
|
||||
logger -p local4.info -t xcat "Warning: the packages $plain_pkgs could not be found in the repository, falling back to rpm command, did you forget to run createrepo?"
|
||||
echo "Warning: the packages $plain_pkgs could not be found in the yum repository, falling back to rpm command. If you want your packages to be installed with yum, verify yum is installed and createrepo has been run."
|
||||
logger -p local4.info -t xcat "Warning: the packages $plain_pkgs could not be found in the yum repository, falling back to rpm command. If you want your packages to be installed with yum, verify yum is installed and createrepo has been run."
|
||||
if [ $mounted -eq 0 ]; then
|
||||
dir_no_ftproot=${OTHERPKGDIR#*$INSTALLDIR/}
|
||||
mkdir -p /xcatpost/$dir_no_ftproot
|
||||
|
||||
@@ -478,8 +478,9 @@ if grep 'rw /rw tmpfs ' /proc/mounts >/dev/null 2>&1; then
|
||||
ln -sf /etc/rc6.d/K10xcatmounts /etc/rc0.d/K10xcatmounts
|
||||
fi
|
||||
|
||||
|
||||
chmod +x /$xcatpost/*;
|
||||
# To support the postscripts in the subdirectories under /install/postscripts
|
||||
#chmod +x /$xcatpost/*;
|
||||
chmod -R +x `find $xcatpost/ -maxdepth 1 -print | grep -E -v "^($xcatpost/|$xcatpost/_xcat|$xcatpost/_ssh|$xcatpost/ca|$xcatpost/hostkeys)$"`
|
||||
|
||||
cd /$xcatpost;
|
||||
PATH=/$xcatpost:$PATH
|
||||
|
||||
@@ -33,7 +33,9 @@ done
|
||||
cd /xcatpost;
|
||||
PATH=/xcatpost:$PATH
|
||||
export PATH
|
||||
chmod +x /xcatpost/*;
|
||||
# To support the postscripts in the subdirectories under /install/postscripts
|
||||
#chmod +x /xcatpost/*;
|
||||
chmod -R +x `find /xcatpost/ -maxdepth 1 -print | grep -E -v '^(/xcatpost/|/xcatpost/_xcat|/xcatpost/_ssh|/xcatpost/ca|/xcatpost/hostkeys)$'`
|
||||
|
||||
POST_IN_DIR="/xcatpost"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Standards-Version: 3.7.2
|
||||
|
||||
Package: xcatsn
|
||||
Architecture: all
|
||||
Depends: ${perl:Depends}, xcat-server, perl-xcat, xcat-client, libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, bind9, ipmitool-xcat (>=1.8.9), syslinux-xcat, xnba-undi, xcat-genesis-amd64, elilo-xcat
|
||||
Depends: ${perl:Depends}, xcat-server, perl-xcat, xcat-client, libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, bind9, ipmitool-xcat (>=1.8.9), syslinux-xcat, xnba-undi, xcat-genesis-scripts, elilo-xcat
|
||||
Recommends: yaboot-xcat
|
||||
Description: Metapackage for a common, default xCAT service node setup
|
||||
xCATsn is a service node management package intended for at-scale management, including hardware management and software management.
|
||||
|
||||
@@ -2,3 +2,5 @@ LICENSE.html opt/xcat/share/doc/packages/xCAT
|
||||
xCATSN etc
|
||||
xcat.conf etc/apache2/conf.d
|
||||
xcat.conf.apach24 etc/apache2/conf.d/
|
||||
xcat.conf etc/apache2/conf-available/
|
||||
xcat.conf.apach24 etc/apache2/conf-available/
|
||||
|
||||
+23
-7
@@ -28,13 +28,29 @@ case "$1" in
|
||||
rm /etc/xCATMN
|
||||
fi
|
||||
|
||||
ver=$(cat /etc/issue |awk '{print $2}')
|
||||
num=${ver%.*}
|
||||
file="xcat.conf.apach24"
|
||||
if [ $num -gt 12 ];then
|
||||
mv /etc/apache2/conf.d/xcat.conf.apach24 /etc/apache2/conf-enabled/
|
||||
fi
|
||||
|
||||
#ver=$(cat /etc/issue |awk '{print $2}')
|
||||
#num=${ver%.*}
|
||||
#file="xcat.conf.apach24"
|
||||
#if [ $num -gt 12 ];then
|
||||
# mv /etc/apache2/conf.d/xcat.conf.apach24 /etc/apache2/conf-enabled/
|
||||
#fi
|
||||
if [ -n "$(httpd -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ]
|
||||
then
|
||||
rm -rf /etc/httpd/conf.d/xcat.conf
|
||||
ln -s /etc/xcat/conf.orig/xcat.conf.apach24 /etc/httpd/conf.d/xcat.conf
|
||||
fi
|
||||
|
||||
if [ -n "$(apachectl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ]
|
||||
then
|
||||
rm -rf /etc/apache2/conf-enabled/xcat.conf
|
||||
ln -s /etc/apache2/conf-available/xcat.conf.apach24 /etc/apache2/conf-enabled/xcat.conf
|
||||
fi
|
||||
|
||||
if [ -n "$(apache2ctl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ]
|
||||
then
|
||||
rm -rf /etc/apache2/conf-enabled/xcat.conf
|
||||
ln -s /etc/apache2/conf-available/xcat.conf.apach24 /etc/apache2/conf-enabled/xcat.conf
|
||||
fi
|
||||
|
||||
apachedaemon='apache2'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user