2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-24 15:05:36 +00:00

Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core

This commit is contained in:
ligc
2015-07-03 02:02:37 -04:00
20 changed files with 108 additions and 41 deletions

View File

@ -470,7 +470,7 @@ sub message
{
# If they want this msg to also go to syslog, do that now
eval {
openlog("xCAT", "nofatal,pid", "local4");
openlog("xcat", "nofatal,pid", "local4");
if ($sev eq 'SE') {
syslog("err", $rsp);
} else {
@ -516,7 +516,7 @@ sub message
{
print $stdouterrf "Unable to open auditlog\n";
eval {
openlog("xCAT", "nofatal,pid", "local4");
openlog("xcat", "nofatal,pid", "local4");
syslog("err", "Unable to write to auditlog");
closelog();
};
@ -533,7 +533,7 @@ sub message
{ # error
print $stdouterrf "Unable to open auditlog\n";
eval {
openlog("xCAT", "nofatal,pid", "local4");
openlog("xcat", "nofatal,pid", "local4");
syslog("err", "Unable to open auditlog");
closelog();
};

View File

@ -83,7 +83,7 @@ int main(int argc, char *argv[]) {
if (strcmp(argv[i], "-V") == 0) {
verbose = 1;
setlogmask(LOG_UPTO(LOG_DEBUG));
openlog("proxydhcp", LOG_NDELAY, LOG_LOCAL0);
openlog("xcat", LOG_NDELAY, LOG_LOCAL0);
}
}
@ -276,7 +276,3 @@ int main(int argc, char *argv[]) {
if (verbose) { closelog();}
}

View File

@ -81,7 +81,7 @@ function submit_request($req, $skipVerify, $opts_array){
// Open syslog, include the process ID and also send the log to standard error,
// and use a user defined logging mechanism
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
openlog("xcat", LOG_PID | LOG_PERROR, LOG_LOCAL0);
// Open a socket to xcatd
syslog(LOG_INFO, "Opening socket to xcatd...");

View File

@ -79,7 +79,7 @@ function submit_request($req, $skipVerify, $opts_array){
// Open syslog, include the process ID and also send
// the log to standard error, and use a user defined
// logging mechanism
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
openlog("xcat", LOG_PID | LOG_PERROR, LOG_LOCAL0);
// Open a socket to xcatd
syslog(LOG_INFO, "Opening socket to xcatd...");

View File

@ -420,8 +420,16 @@ sub testVersion_deb
if ($::VERBOSE) {
print "dpkg --compare-versions $version1 $operator $version2 \n";
}
my $result =`dpkg --compare-versions $version1 $operator $version2`;
my $cmd ="dpkg --compare-versions $version1 $operator $version2";
my $outref = [];
my $result = 0;
@$outref = `$cmd 2>&1`;
$result = $? ;
if ($result)
{
$result = $result >> 8;
}
return $result;
}

View File

@ -65,7 +65,12 @@ if [ "$CONSOLE_SERVICE_KEYWORD" == "consoleservice" ]; then
fi
if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ] || [ -x "/usr/local/bin/confetty" ]); then
#use confluent
# use confluent, make sure conserver is not also running
CONSERVER_RC=`service conserver status >> /dev/null; echo $?`
if [[ ${CONSERVER_RC} == 0 ]]; then
echo "Error: consoleservice is set to 'confluent' but conserver is running. Stop conserver, run makeconfluentcfg, and retry..."
exit 1
fi
CONFETTY="confetty"
if [ -x "/opt/confluent/bin/confetty" ]; then
CONFETTY="/opt/confluent/bin/confetty"
@ -75,8 +80,15 @@ if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/
fi
if [ -z "$CONSERVER" ]; then
CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '`
declare -a ipaddrs=`ip addr | grep 'inet' | awk {'print $2'} | cut -d/ -f1 | grep -v : | tr '\n' ' '`
for IP in ${ipaddrs[*]}; do
if [[ "${CONSERVER}" == "${IP}" ]]; then
# conserver is the same node, do not connect using -s
CONSERVER=""
break
fi
done
fi
if [ -z "$CONSERVER" ]; then
CONSERVER=$XCATHOST
fi
@ -85,7 +97,13 @@ if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/
fi
$CONFETTY $CONSCONTROLPATH $CONSERVER $1
elif [ -f "/usr/bin/console" ] || [ -f "/bin/console" ]; then
#use conserver
# use conserver, make sure confluent is not also running
CONFLUENT_RC=`service confluent status >> /dev/null; echo $?`
if [[ ${CONFLUENT_RC} == 0 ]]; then
echo "Error: consoleservice is set to 'conserver' but confluent is running. Stop confluent, run makeconservercf, and retry..."
exit 1
fi
if [ -z "$CONSERVER" ]; then
CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '`
fi

View File

@ -6,12 +6,12 @@ B<makentp> - Setup NTP server on the management node and the service node.
=head1 SYNOPSIS
I<switchdiscover [-h|--help]>
I<makentp [-h|--help]>
I<switchdiscover [-v|--version]>
I<makentp [-v|--version]>
I<switchdiscover [-a|--all] [-V|--verbose]>
I<makentp [-a|--all] [-V|--verbose]>

View File

@ -1,2 +1,9 @@
#!/bin/bash
# export XCATSSLVER for SLES 11. Other OS can work without this setting.
if [ -r /etc/SuSE-release ]; then
ver=`grep 'VERSION' /etc/SuSE-release | awk -F= '{print $2}' | sed 's/ //g'`
if [ "$ver" = "11" ]; then
export XCATSSLVER=TLSv1
fi
fi
exec /opt/xcat/share/xcat/cons/hmc $CONFLUENT_NODE

View File

@ -14,7 +14,6 @@ require xCAT::TableUtils;
require xCAT::NetworkUtils;
use File::Basename;
use File::Path;
use strict;
use Exporter;
our @ISA = qw/Exporter/;
@ -640,7 +639,7 @@ sub update_tables_with_templates
#now get all the profile names for full installation
my %profiles=();
my @tmplfiles=glob($cuspath."/*.tmpl");
my @tmplfiles=glob($cuspath."/{compute,service}.*tmpl");
foreach (@tmplfiles) {
my $tmpf=basename($_);
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'
@ -654,7 +653,7 @@ sub update_tables_with_templates
#print "$tmpf\n";
$profiles{$tmpf}=1;
}
@tmplfiles=glob($defpath."/*.tmpl");
@tmplfiles=glob($defpath."/{compute,service}.*tmpl");
foreach (@tmplfiles) {
my $tmpf=basename($_);
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'
@ -845,7 +844,7 @@ sub update_tables_with_mgt_image
#now get all the profile names for full installation
my %profiles=();
my @tmplfiles=glob($cuspath."/*.tmpl");
my @tmplfiles=glob($cuspath."/{compute,service}.*tmpl");
foreach (@tmplfiles) {
my $tmpf=basename($_);
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'
@ -854,7 +853,7 @@ sub update_tables_with_mgt_image
#print "$tmpf\n";
$profiles{$tmpf}=1;
}
@tmplfiles=glob($defpath."/*.tmpl");
@tmplfiles=glob($defpath."/{compute,service}.*tmpl");
foreach (@tmplfiles) {
my $tmpf=basename($_);
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'
@ -1049,7 +1048,7 @@ sub update_tables_with_diskless_image
if ($profile) {
$profiles{$profile} = 1;
} else {
my @tmplfiles=glob($cuspath."/*.pkglist");
my @tmplfiles=glob($cuspath."/compute.*pkglist");
foreach (@tmplfiles) {
my $tmpf=basename($_);
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'
@ -1057,7 +1056,7 @@ sub update_tables_with_diskless_image
$tmpf = $1;
$profiles{$tmpf}=1;
}
@tmplfiles=glob($defpath."/*.pkglist");
@tmplfiles=glob($defpath."/compute.*pkglist");
foreach (@tmplfiles) {
my $tmpf=basename($_);
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'

View File

@ -324,9 +324,9 @@ sub process_request {
my $cmd;
if ($os =~ /sles/) {
if (-f "/usr/sbin/rcntpd") {
$cmd = "rcntpd ntptimeset";
$cmd = "/usr/sbin/rcntpd ntptimeset";
} elsif (-f "/usr/sbin/rcntp") {
$cmd = "rcntp ntptimeset";
$cmd = "/usr/sbin/rcntp ntptimeset";
} else {
$cmd = "sntp -P no -r $ntp_master";
}

View File

@ -19,6 +19,7 @@ sub process_request {
my $serialport;
my $serialspeed;
my $serialflow;
my $initrd_file = undef;
my $xcatdport = 3001;
#if ($sitetab) {
#my $portent = $sitetab->getAttribs({key=>'defserialport'},'value');
@ -130,7 +131,6 @@ sub process_request {
system("ssh-keygen -t rsa -f $tempdir/etc/ssh_host_rsa_key -C '' -N ''");
system("ssh-keygen -t dsa -f $tempdir/etc/ssh_host_dsa_key -C '' -N ''");
}
my $initrd_file = undef;
my $lzma_exit_value=1;
if ($invisibletouch) {
my $done=0;
@ -164,6 +164,22 @@ sub process_request {
}
CREAT_CONF_FILE:
if ($configfileonly) {
unless (-e "$tftpdir/xcat/genesis.kernel.$arch") {
$callback->({error=>["No kernel file found in $tftpdir/xcat, pls run \"mknb $arch\" instead."],errorcode=>[1]});
return;
}
if (-e "$tftpdir/xcat/genesis.fs.$arch.lzma") {
$initrd_file = "$tftpdir/xcat/genesis.fs.$arch.lzma";
} elsif (-e "$tftpdir/xcat/genesis.fs.$arch.gz") {
$initrd_file = "$tftpdir/xcat/genesis.fs.$arch.gz";
} elsif (-e "$tftpdir/xcat/nbfs.$arch.gz") {
$initrd_file = "$tftpdir/xcat/nbfs.$arch.gz";
} else {
$callback->({error=>["No filesystem file found in $tftpdir/xcat, pls run \"mknb $arch\" instead."],errorcode=>[1]});
return;
}
}
my $hexnets = xCAT::NetworkUtils->my_hexnets();
my $normnets = xCAT::NetworkUtils->my_nets();
my $consolecmdline;
@ -305,7 +321,6 @@ CREAT_CONF_FILE:
close($cfgfile);
}
}
if ($configfileonly) {
$callback->({data=>["Write netboot config file done"]});
}

View File

@ -137,7 +137,7 @@ sub process_request {
my $doreq = shift;
my $node = $request->{node}->[0];
my $clientip = $request->{'_xcat_clientip'};
openlog("xCAT node discovery",'','local0');
openlog("xcat",'','local0');
#First, fill in tables with data fields..

View File

@ -34,7 +34,7 @@ if ($tobedaemon) {
}
# open syslog
openlog("proxydhcp", "nofatal", "local4");
openlog("xcat", "nofatal", "local4");
my $socket;
my $retry = 5;

View File

@ -306,7 +306,7 @@ if ($LOG || (keys(%hashL)==0)) {
if ($briefmsg) { $body=$briefmsg;}
else { $body=$message; }
openlog("xCATMon Event","","local4");
openlog("xcat","","local4");
if ($severity_type eq "Informational") {
syslog("local4|info", "$head\n$body\n");
} else {

View File

@ -110,7 +110,7 @@ use xCAT::ExtTab;
use Data::Dumper;
use Getopt::Long;
use Sys::Syslog qw(:DEFAULT setlogsock);
openlog("xcatd",,"local4");
openlog("xcat",,"local4");
# turn off warnings for call to setlogsock. puts out warning message if
# syslog tcp port not defined in /etc/services. this can safely be ignored.
no warnings;
@ -671,7 +671,7 @@ sub do_udp_service { #This function opens up a UDP port
sleep 0.05;
}
openlog("xCAT UDP",'','local4');
openlog("xcat",'','local4');
unless ($socket) {
xCAT::MsgUtils->message("S","xCAT UDP service unable to open port $port: $!");
closelog();
@ -1050,7 +1050,7 @@ $chrselect->add($chreadpipe);
my $peername;
my $ssltimeout;
my $retry=1;
openlog("xCAT SSL","","local4");
openlog("xcat","","local4");
my $listener;
my $mainpidfile;
$SIG{USR2} = sub {

View File

@ -124,7 +124,7 @@ sub logger {
my $msg = shift;
setlogsock('unix');
openlog('autogpfsc','','local0');
openlog('xcat','','local0');
syslog($type,$msg);
closelog();
}

View File

@ -369,7 +369,7 @@ sub logger {
my $msg = shift;
setlogsock('unix');
openlog('autogpfsd','','local0');
openlog('xcat','','local0');
syslog($type,$msg);
closelog();

View File

@ -757,6 +757,18 @@ my %URIdef = (
fhandler => \&common,
},
},
#### definition for mknb <ppc64|x86_64> [-c]
nbimage => {
desc => "[URI:/nbimage] - Create netboot root image for specified arch.",
matcher => '^/services/nbimage/arch/[ppc64|x86_64]',
POST => {
desc => "creates a network boot root image",
usage => "|$usagemsg{objchparam} DataBody: {\"onlyconfigfile\":\"[true|yes|Y|1]|[false|no|N|0]\"}.|$usagemsg{non_getreturn}|",
example => "|Create a network boot root iamge for the specified arch|",
cmd => "mknb",
fhandler => \&actionhdl,
},
},
},
#### definition for network resources
@ -2064,6 +2076,20 @@ sub actionhdl {
push @args, ('-n', $paramhash->{'newNode'});
}
}
} elsif ($params->{'resourcename'} eq "nbimage") {
delete $request->{noderange};
push @args, $urilayers[3];
if (isPost()) {
if (defined($paramhash->{'onlyconfigfile'})) {
my $tmp_value = $paramhash->{'onlyconfigfile'};
if ($tmp_value =~ /true|yes|Y|1/i) {
push @args, "-c";
} elsif ($tmp_value !~ /false|no|N|0/i) {
error ("Option value \"$tmp_value\" invalid.", $STATUS_BAD_REQUEST, 3);
}
}
}
}
push @{$request->{arg}}, @args;

View File

@ -116,13 +116,11 @@ fi
if [ ! -f $gmond_conf ]; then
# echo "file not found"
logger -t gmonfail "gmond configuration file not found"
logger -t xcat -p local4.warning "gmond configuration file not found"
fi
if [ ! -f $gmond_conf_old ]; then
# echo "file not found"
logger -t gmonfail "gmond configuration file not found"
logger -t xcat -p local4.warning "gmond configuration file not found"
fi

View File

@ -111,9 +111,9 @@ restrict 127.0.0.1" >>$conf_file
#ntpdate program is deprecated on SuSE
if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ]; then
if [ -f /usr/sbin/rcntpd ]; then
cmd="rcntpd ntptimeset"
cmd="/usr/sbin/rcntpd ntptimeset"
elif [ -f /usr/sbin/rcntp ]; then
cmd="rcntp ntptimeset"
cmd="/usr/sbin/rcntp ntptimeset"
else
cmd="sntp -P no -r $ntp_master"
fi