mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-03-27 04:13:31 +00:00
Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
This commit is contained in:
@@ -52,7 +52,27 @@ if [ -n "$2" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "/usr/bin/console" ] || [ -f "/bin/console" ]; then
|
||||
if [ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ]; then
|
||||
#use confluent
|
||||
CONFETTY="confetty"
|
||||
if [ -x "/opt/confluent/bin/confetty" ]; then
|
||||
CONFETTY="/opt/confluent/bin/confetty"
|
||||
fi
|
||||
if [ ! -z "$CONSCONTROLPATH" ]; then
|
||||
CONSCONTROLPATH="-c $CONSCONTROLPATH"
|
||||
fi
|
||||
if [ -z "$CONSERVER" ]; then
|
||||
CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '`
|
||||
fi
|
||||
|
||||
if [ -z "$CONSERVER" ]; then
|
||||
CONSERVER=$XCATHOST
|
||||
fi
|
||||
if [ ! -z "$CONSERVER" ]; then
|
||||
CONSERVER="-s $CONSERVER"
|
||||
fi
|
||||
$CONFETTY $CONSCONTROLPATH $CONSERVER $1
|
||||
elif [ -f "/usr/bin/console" ] || [ -f "/bin/console" ]; then
|
||||
#use conserver
|
||||
if [ -z "$CONSERVER" ]; then
|
||||
CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '`
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
use Getopt::Long qw(:config getopt_compat pass_through);
|
||||
use File::Basename;
|
||||
BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; }
|
||||
use IO::Socket::UNIX;
|
||||
use Time::HiRes qw/sleep/;
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use xCAT::Client;
|
||||
#use Data::Dumper;
|
||||
@@ -54,7 +56,6 @@ foreach (@nodes) {
|
||||
$conservers{$_} =~ s/:.*//;
|
||||
next;
|
||||
}
|
||||
$conservers{$_} = 'localhost';
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +83,7 @@ if (defined($tilefact)) {
|
||||
$screenheight=$1;
|
||||
}
|
||||
}
|
||||
$rootinf = `xwininfo -name "Top Panel"`;
|
||||
$rootinf = `xwininfo -name "Top Panel" 2> /dev/null`;
|
||||
foreach (split /\n/,$rootinf) {
|
||||
if (/-geometry\s+([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+)/) {
|
||||
if ($1 > 640 and $2 < 480 and $3 == 0 and $4 == 0) {
|
||||
@@ -91,7 +92,7 @@ if (defined($tilefact)) {
|
||||
}
|
||||
}
|
||||
if ($panel_pad == 0) {
|
||||
$rootinf = `xwininfo -name "Top Expanded Edge Panel"`;
|
||||
$rootinf = `xwininfo -name "Top Expanded Edge Panel" 2> /dev/null`;
|
||||
foreach (split /\n/,$rootinf) {
|
||||
if (/-geometry\s+([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+)/) {
|
||||
if ($1 > 640 and $2 < 480 and $3 == 0 and $4 == 0) {
|
||||
@@ -102,9 +103,24 @@ if (defined($tilefact)) {
|
||||
}
|
||||
|
||||
|
||||
$ENV{CONSCONTROLPATH} = "/tmp/wconscontrol.$firstnode.$$";
|
||||
system("xterm $xrm -bg black -fg white -title $firstnode -n $firstnode -geometry +0+0 ".join(" ",@ARGV)." -e /bin/bash -c \"$mydir/xtcd.pl ".$ENV{DISPLAY}." $firstnode $firstnode & let SDATE=`date +%s`+5; $mydir/rcons $firstnode ".$conservers{$firstnode}."; if [ \\\$SDATE -gt \\`date +%s\\` ]; then echo Press enter to close; read SDATE; fi \" &");
|
||||
sleep(2); #Give time for window manager to figure out everything
|
||||
my $xinfo = `xwininfo -name $firstnode`;
|
||||
my $remainwait = 2;
|
||||
while (not -S "/tmp/wconscontrol.$firstnode.$$" and $remainwait > 0) {
|
||||
sleep(0.1);
|
||||
$remainwait -= 0.1;
|
||||
}
|
||||
my $xinfo;
|
||||
if (-S "/tmp/wconscontrol.$firstnode.$$") { # confluent mode
|
||||
my $controlchannel = IO::Socket::UNIX->new(Type=>SOCK_STREAM(), Peer => "/tmp/wconscontrol.$firstnode.$$");
|
||||
print $controlchannel "GETWINID\n";
|
||||
my $winid = <$controlchannel>;
|
||||
$winid = <$controlchannel>;
|
||||
$xinfo = `xwininfo -id $winid`;
|
||||
} else {
|
||||
$xinfo = `xwininfo -name $firstnode`;
|
||||
}
|
||||
|
||||
my @xinfl = split(/\n/,$xinfo);
|
||||
my $side_pad;
|
||||
my $wmxo;
|
||||
|
||||
@@ -6,9 +6,9 @@ B<makedns> - sets up domain name services (DNS).
|
||||
|
||||
B<makedns> [I<-h>|I<--help>]
|
||||
|
||||
B<makedns> [-e|--external] [I<-n>|I<--new>] [I<noderange>]
|
||||
B<makedns> [-V|--verbose] [-e|--external] [I<-n>|I<--new>] [I<noderange>]
|
||||
|
||||
B<makedns> [-e|--external] [I<-d>|I<--delete> I<noderange>]
|
||||
B<makedns> [-V|--verbose] [-e|--external] [I<-d>|I<--delete> I<noderange>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -37,6 +37,10 @@ Cluster_Name_Resolution
|
||||
|
||||
=over 6
|
||||
|
||||
=item B<-V>|B<--verbose>
|
||||
|
||||
Verbose mode.
|
||||
|
||||
=item B<-n>|B<--new>
|
||||
|
||||
Use this flag to create new named configuration and db files.
|
||||
|
||||
@@ -13,6 +13,7 @@ use MIME::Base64;
|
||||
use xCAT::SvrUtils;
|
||||
use Socket;
|
||||
use Fcntl qw/:flock/;
|
||||
use Data::Dumper;
|
||||
|
||||
# This is a rewrite of DNS management using nsupdate rather than
|
||||
# direct zone mangling
|
||||
@@ -52,7 +53,7 @@ sub getzonesfornet {
|
||||
die "Not supporting having a mask like $mask on an ipv6 network like $net";
|
||||
}
|
||||
my $netnum= getipaddr($net,GetNumber=>1);
|
||||
unless ($netnum) { return (); }
|
||||
unless ($netnum) { return (); }
|
||||
$netnum->brsft(128-$maskbits);
|
||||
my $prefix=$netnum->as_hex();
|
||||
my $nibbs=$maskbits/4;
|
||||
@@ -209,6 +210,7 @@ sub process_request {
|
||||
my $deletemode=0;
|
||||
my $external=0;
|
||||
my $slave=0;
|
||||
my $VERBOSE;
|
||||
|
||||
# Since the mandatory rpm perl-Net-DNS for makedns on sles12 (perl-Net-DNS-0.73-1.28) has a bug,
|
||||
# user has to update it to a newer version
|
||||
@@ -238,6 +240,7 @@ sub process_request {
|
||||
'd|delete' => \$deletemode,
|
||||
'e|external' => \$external,
|
||||
's|slave' => \$slave,
|
||||
'V|verbose' => \$VERBOSE,
|
||||
'h|help' => \$help,
|
||||
)) {
|
||||
#xCAT::SvrUtils::sendmsg([1,"TODO: makedns Usage message"], $callback);
|
||||
@@ -246,6 +249,12 @@ sub process_request {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (defined($VERBOSE)) {
|
||||
$::VERBOSE=$VERBOSE;
|
||||
} else {
|
||||
undef $::VERBOSE;
|
||||
}
|
||||
|
||||
if ($::XCATSITEVALS{externaldns}) {
|
||||
$external=1;
|
||||
}
|
||||
@@ -275,6 +284,13 @@ sub process_request {
|
||||
return;
|
||||
}
|
||||
$ctx->{domain} = $site_entry;
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}},
|
||||
"domain name = $site_entry";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
if($external) #need to check if /etc/resolv.conf existing
|
||||
{
|
||||
@@ -287,7 +303,17 @@ sub process_request {
|
||||
$cmd = $acmd;
|
||||
}
|
||||
|
||||
|
||||
my @output=xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp;
|
||||
my $outp = join(', ', @output);
|
||||
push @{$rsp->{data}},
|
||||
"output from /etc/resolv.conf: $outp";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::SvrUtils::sendmsg([1,"You are using -e flag to update DNS records to an external DNS server, please ensure /etc/resolv.conf existing and pointed to this external DNS server."], $callback);
|
||||
@@ -310,6 +336,14 @@ sub process_request {
|
||||
umask($oldmask);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}},
|
||||
"nameservers = $sitens";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
my $networkstab = xCAT::Table->new('networks',-create=>0);
|
||||
unless ($networkstab) { xCAT::SvrUtils::sendmsg([1,'Unable to enumerate networks, try to run makenetworks'], $callback); }
|
||||
@@ -499,6 +533,13 @@ sub process_request {
|
||||
my $currzone;
|
||||
foreach $currzone (getzonesfornet($_)) {
|
||||
$ctx->{zonestotouch}->{$currzone} = 1;
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}},
|
||||
"zone info for this $net: $currzone";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
my $passtab = xCAT::Table->new('passwd');
|
||||
@@ -592,7 +633,17 @@ sub process_request {
|
||||
|
||||
foreach (@nodes) {
|
||||
my @revzones = get_reverse_zones_for_entity($ctx,$_);;
|
||||
unless (@revzones) { next; }
|
||||
unless (@revzones)
|
||||
{
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}},
|
||||
"No reverse zones for $_ ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
next;
|
||||
}
|
||||
$ctx->{revzones}->{$_} = \@revzones;
|
||||
foreach (@revzones) {
|
||||
$ctx->{zonestotouch}->{$_}=1;
|
||||
@@ -638,6 +689,14 @@ sub process_request {
|
||||
}
|
||||
unless ($external) { # only generate the named.conf and zone files for xCAT dns when NOT using external dns
|
||||
if ($zapfiles || $slave) { #here, we unlink all the existing files to start fresh
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}},
|
||||
"Stop named service";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
if (xCAT::Utils->isAIX())
|
||||
{
|
||||
system("/usr/bin/stopsrc -s $service");
|
||||
@@ -650,6 +709,14 @@ sub process_request {
|
||||
my $conf = get_conf();
|
||||
unlink $conf;
|
||||
my $DBDir = get_dbdir();
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}},
|
||||
"get_dbdir: $DBDir";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
foreach (<$DBDir/db.*>) {
|
||||
unlink $_;
|
||||
}
|
||||
@@ -658,7 +725,14 @@ sub process_request {
|
||||
$ctx->{dbdir} = get_dbdir();
|
||||
$ctx->{zonesdir} = get_zonesdir();
|
||||
chmod 0775, $ctx->{dbdir}; # assure dynamic dns can actually execute against the directory
|
||||
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}},
|
||||
"Update Named Conf dir $ctx->{dbdir} $ctx->{zonesdir}";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
update_namedconf($ctx, $slave);
|
||||
|
||||
unless ($slave)
|
||||
@@ -1497,8 +1571,9 @@ sub makedns_usage
|
||||
"\n makedns - sets up domain name services (DNS).";
|
||||
push @{$rsp->{data}}, " Usage: ";
|
||||
push @{$rsp->{data}}, "\tmakedns [-h|--help ]";
|
||||
push @{$rsp->{data}}, "\tmakedns [-e|--external] [-n|--new ] [noderange]";
|
||||
push @{$rsp->{data}}, "\tmakedns [-e|--external] [-d|--delete noderange]";
|
||||
push @{$rsp->{data}}, "\tmakedns [-V|--verbose]";
|
||||
push @{$rsp->{data}}, "\tmakedns [-V|--verbose] [-e|--external] [-n|--new ] [noderange]";
|
||||
push @{$rsp->{data}}, "\tmakedns [-V|--verbose] [-e|--external] [-d|--delete noderange]";
|
||||
push @{$rsp->{data}}, "\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
return 0;
|
||||
|
||||
@@ -691,7 +691,9 @@ sub build_xmldesc {
|
||||
}
|
||||
if ($hypcpumodel eq "ppc64") {
|
||||
my %cpuhash = ();
|
||||
$cpuhash{model} = $hypcputype;
|
||||
if ($hypcputype) {
|
||||
$cpuhash{model} = $hypcputype;
|
||||
}
|
||||
if ($args{cpus}) {
|
||||
$xtree{vcpu}->{content}=$args{cpus} * $hypcputhreads;
|
||||
$cpuhash{topology}->{sockets} = 1;
|
||||
@@ -1888,7 +1890,6 @@ sub chvm {
|
||||
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";
|
||||
@@ -3062,17 +3063,20 @@ sub dohyp {
|
||||
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";
|
||||
my $sysinfo = $hypconn->get_sysinfo();
|
||||
if ($sysinfo) {
|
||||
my $syshash = XMLin($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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2410,6 +2410,7 @@ sub relay_fds { #Relays file descriptors from pipes to children to the SSL socke
|
||||
foreach (keys %plugin_children) {
|
||||
print "Sending INT to $_\n";
|
||||
kill 2, $_;
|
||||
kill 15, $_;
|
||||
}
|
||||
foreach my $cin ($fds->handles) {
|
||||
print $cin "die\n";
|
||||
|
||||
@@ -134,9 +134,9 @@ else
|
||||
echo ' $primary{ } $bootable{ } method{ prep }' >> /tmp/partitioning
|
||||
echo " ." >> /tmp/partitioning
|
||||
|
||||
echo "100 50 100 ext4" >> /tmp/partitioning
|
||||
echo ' $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ /boot }' >> /tmp/partitioning
|
||||
echo " ." >> /tmp/partitioning
|
||||
#echo "100 50 100 ext4" >> /tmp/partitioning
|
||||
#echo ' $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ /boot }' >> /tmp/partitioning
|
||||
#echo " ." >> /tmp/partitioning
|
||||
fi
|
||||
echo "500 10000 1000000000 ext4" >> /tmp/partitioning
|
||||
echo " method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ / }" >> /tmp/partitioning
|
||||
|
||||
@@ -1568,8 +1568,8 @@ sub generic_post { #This function is meant to leave the image in a state approxi
|
||||
print $cfgfile "tmpfs /tmp tmpfs defaults,size=$tmplimit 0 2\n";
|
||||
print $cfgfile "tmpfs /var/tmp tmpfs defaults,size=$tmplimit 0 2\n";
|
||||
} else {
|
||||
print $cfgfile "tmpfs /tmp tmpfs defaults,size=10m 0 2\n";
|
||||
print $cfgfile "tmpfs /var/tmp tmpfs defaults,size=10m 0 2\n";
|
||||
print $cfgfile "tmpfs /tmp tmpfs defaults 0 2\n";
|
||||
print $cfgfile "tmpfs /var/tmp tmpfs defaults 0 2\n";
|
||||
}
|
||||
|
||||
my $rootfs_name=$profile."_".$arch;
|
||||
|
||||
@@ -25,7 +25,7 @@ AutoReqProv: no
|
||||
# also need to fix Requires for AIX
|
||||
%ifos linux
|
||||
BuildArch: noarch
|
||||
Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser
|
||||
Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser perl-Digest-SHA1
|
||||
Obsoletes: atftp-xcat
|
||||
%endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user