mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 09:36:41 +00:00
Merge branch 'master' of ssh://daniceexi@git.code.sf.net/p/xcat/xcat-core
This commit is contained in:
commit
a6b4056b2e
@ -924,7 +924,8 @@ site => {
|
||||
" -----------------\n".
|
||||
"DATABASE ATTRIBUTES\n".
|
||||
" -----------------\n".
|
||||
" auditnosyslog: If set to 1, then commands will only be written to the auditlog table".
|
||||
" auditnosyslog: If set to 1, then commands will only be written to the auditlog table.\n".
|
||||
" This attribute set to 1 and auditskipcmds=ALL means no logging of commands.\n".
|
||||
" Default is to write to both the auditlog table and syslog.\n".
|
||||
" auditskipcmds: List of commands and/or client types that will not be\n".
|
||||
" written to the auditlog table and syslog. See auditnosyslog.\n".
|
||||
@ -945,6 +946,7 @@ site => {
|
||||
" nodestatus: If set to 'n', the nodelist.status column will not be updated during\n".
|
||||
" the node deployment, node discovery and power operations. The default is to update.\n\n".
|
||||
" skiptables: Comma separated list of tables to be skipped by dumpxCATdb\n\n".
|
||||
" skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not be logged in syslog.\n\n".
|
||||
" -------------\n".
|
||||
"DHCP ATTRIBUTES\n".
|
||||
" -------------\n".
|
||||
|
@ -63,26 +63,50 @@ sub addKernelParms {
|
||||
# get node ip and add it to the kernel parms
|
||||
my ($nic, $ip, $netmask, $network, $broadcast, $gateway, $mac) = getNodeIpInfo($args);
|
||||
if (!$ip) { die "Error: could not find the NIC that would connect to the xCAT mgmt node's IP (".$args->{mnip}.").\n"; }
|
||||
# if we are booting genesis, need to add the BOOTIF parm
|
||||
my $bootif;
|
||||
|
||||
#if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') {
|
||||
if ($args->{kernelpath} =~ m/genesis\.kernel\.x86_64/) {
|
||||
$bootif = $mac;
|
||||
# genesis case, add additional parms for sysclone or nodeset shell
|
||||
my $bootif = $mac;
|
||||
$bootif =~ s/:/-/g;
|
||||
$bootif = "BOOTIF=01-$bootif";
|
||||
}
|
||||
|
||||
#todo: if you are running genesis shell (nodeset <node> shell), this if-else will depend on the nodeset done before that.
|
||||
# really should check for currstate=shell, or something like that
|
||||
if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') {
|
||||
# add additional parms for sysclone
|
||||
# DEVICE=eth0 IPADDR=10.0.0.99 NETMASK=255.255.255.0 NETWORK=10.0.0.0 BROADCAST=10.0.0.255 GATEWAY=10.0.0.1 GATEWAYDEV=eth0
|
||||
#todo: should we also add ETHER_SLEEP=$WAITTIME textmode=1 dns=$mnip ?
|
||||
$args->{kernelparms} .= " $bootif IPADDR=$ip NETMASK=$netmask NETWORK=$network BROADCAST=$broadcast GATEWAY=$gateway HOSTNAME=$nodename DEVICE=$nic GATEWAYDEV=$nic";
|
||||
}
|
||||
else { # scripted install
|
||||
#todo: the parameters for kickstart are likely different
|
||||
$args->{kernelparms} .= " $bootif hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
|
||||
# print Dumper($args->{kernelparms})
|
||||
else { # scripted install (kickstart or autoyast)
|
||||
if ($args->{kernelparms} =~ m/autoyast=/) { # sles
|
||||
# if site.managedaddressmode=static is set, it will put several of these kernel parms on there for us. Do not duplicate in that case.
|
||||
if ($args->{kernelparms} !~ m/ hostip=/) { $args->{kernelparms} .= " hostip=$ip"; }
|
||||
if ($args->{kernelparms} !~ m/ netmask=/) { $args->{kernelparms} .= " netmask=$netmask"; }
|
||||
if ($args->{kernelparms} !~ m/ gateway=/) { $args->{kernelparms} .= " gateway=$gateway"; }
|
||||
if ($args->{kernelparms} !~ m/ hostname=/) { $args->{kernelparms} .= " hostname=$nodename"; }
|
||||
if ($args->{kernelparms} !~ m/ dns=/) { $args->{kernelparms} .= " dns=$mnip"; }
|
||||
# If they set installnic=mac (recommended), the netdevice will already be set to the mac.
|
||||
# If they explicitly set installnic=<nic>, then ksdevice will be set to that and we will not disturb it here.
|
||||
# Otherwise add netdevice set to the nic we calculated it should be.
|
||||
if ($args->{kernelparms} !~ m/ netdevice=/) { $args->{kernelparms} .= " netdevice=$nic"; }
|
||||
$args->{kernelparms} .= " netwait=$WAITTIME textmode=1";
|
||||
# print Dumper($args->{kernelparms})
|
||||
}
|
||||
elsif ($args->{kernelparms} =~ m/ks=/) { # rhel/centos
|
||||
# See https://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-kickstart2-startinginstall.html
|
||||
# and http://fedoraproject.org/wiki/Anaconda/NetworkIssues for description of kickstart kernel parms
|
||||
# if site.managedaddressmode=static is set, it will put several of these kernel parms on there for us. Do not duplicate in that case.
|
||||
if ($args->{kernelparms} !~ m/ ip=/) { $args->{kernelparms} .= " ip=$ip"; }
|
||||
if ($args->{kernelparms} !~ m/ netmask=/) { $args->{kernelparms} .= " netmask=$netmask"; }
|
||||
if ($args->{kernelparms} !~ m/ gateway=/) { $args->{kernelparms} .= " gateway=$gateway"; }
|
||||
if ($args->{kernelparms} !~ m/ hostname=/) { $args->{kernelparms} .= " hostname=$nodename"; }
|
||||
if ($args->{kernelparms} !~ m/ dns=/) { $args->{kernelparms} .= " dns=$mnip"; }
|
||||
# If they set installnic=mac (recommended), the ksdevice will already be set to the mac.
|
||||
# If they explicitly set installnic=<nic>, then ksdevice will be set to that and we will not disturb it here.
|
||||
# Otherwise ksdevice will be set to bootif, and we change it to the nic we calculated it should be.
|
||||
if ($args->{kernelparms} =~ m/ ksdevice=bootif/) { $args->{kernelparms} =~ s/ ksdevice=bootif/ ksdevice=$nic/; }
|
||||
elsif ($args->{kernelparms} !~ m/ ksdevice=/) { $args->{kernelparms} .= " ksdevice=$nic"; }
|
||||
$args->{kernelparms} .= " nicdelay=$WAITTIME linksleep=$WAITTIME textmode=1";
|
||||
# print Dumper($args->{kernelparms})
|
||||
}
|
||||
else { die "Error: for scripted installs, only support SLES or RHEL/CentOS as the target OS.\n"; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,8 +158,10 @@ sub getNodeIpInfo {
|
||||
# so if we are on centos right now, we need to count down to determine the number that sles
|
||||
# will give the nic that we have selected, because it is the sles naming that we care about,
|
||||
# because that is the initrd that will be running in the scripted install case.
|
||||
# For the sysclone case, genesis doxcat should be changed to use the mac to find the nic.
|
||||
if (isRedhat()) {
|
||||
# This works similarly (at least in some case) when rhel is the target OS.
|
||||
# The preferred way is for the user to set installnic=mac, then we do not need to run this code.
|
||||
# For the sysclone case, genesis doxcat uses the mac to find the nic.
|
||||
if (isRedhat() && $args->{kernelparms} !~ m/ ksdevice=\S*:/ && $args->{kernelparms} !~ m/ netdevice=\S*:/) {
|
||||
my @nics = grep(m/^\d+:\s+eth/, @output);
|
||||
my $i = 0;
|
||||
foreach my $line (@nics) {
|
||||
@ -143,8 +169,8 @@ sub getNodeIpInfo {
|
||||
if (defined($nictmp) && $nictmp eq $realnic) { $realnic = "eth$i"; last; } # got ip, we are done
|
||||
$i++;
|
||||
}
|
||||
print "Determined that SLES/RHEL will call the install NIC $realnic (it has mac $mac)\n";
|
||||
}
|
||||
print "Determined that SLES will call the install NIC $realnic (it has mac $mac)\n";
|
||||
|
||||
# finally, find the gateway
|
||||
my $gateway;
|
||||
|
@ -4,7 +4,7 @@
|
||||
# even across vlans (w/o setting up pxe/dhcp broadcast relay). This assumes a working
|
||||
# OS is on the node. This script is primarily meant to be used in the softlayer environment.
|
||||
|
||||
#todo: site attr for using static ip?
|
||||
#todo: work with site.managedaddressmode=static for sles
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
@ -19,12 +19,12 @@ my $NOAUTOINST;
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [--dryrun] [-w <waittime>] <noderange>\n\n";
|
||||
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [--dryrun] [-w <waittime>] [--noautoinst] <noderange>\n\n";
|
||||
if (!$exitcode) {
|
||||
print "Copy the initrd, kernel, params, and static IP info to nodes, so they can net install\n";
|
||||
print "even across vlans (w/o setting up pxe/dhcp broadcast relay). This assumes a working\n";
|
||||
print "OS is on the node, that you've run nodeset for these nodes, and that all of the nodes\n";
|
||||
print "are using the same osimage.\n";
|
||||
print "in this noderange are using the same osimage.\n";
|
||||
}
|
||||
exit $exitcode;
|
||||
};
|
||||
@ -48,7 +48,7 @@ updateGrubOnNodes($noderange, \%bootparms);
|
||||
|
||||
if ($DRYRUN) { exit(0); }
|
||||
|
||||
if ($bootparms{osimageprovmethod} eq 'install' && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
|
||||
if ($bootparms{osimageprovmethod} eq 'install' && $bootparms{osimageosvers}=~ m/^sles/ && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
|
||||
|
||||
if ($bootparms{osimageprovmethod} eq 'sysclone') { copySyscloneFiles(); }
|
||||
|
||||
@ -77,11 +77,20 @@ sub getBootParms {
|
||||
$bootparms{kcmdline} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|;
|
||||
|
||||
# from the nodes provmethod, get the osimage provmethod, so we know the type of install
|
||||
@output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod");
|
||||
chomp($output[0]);
|
||||
if ($output[0] =~ m/^Could not find/) { die "Error: provmethod $bootparms{provmethod} is set for the node, but there is no osimage definition by that name."; }
|
||||
my ($junk, $provmethod) = split(/=/, $output[0]);
|
||||
$bootparms{osimageprovmethod} = $provmethod;
|
||||
@output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod,osvers");
|
||||
foreach my $line (@output) {
|
||||
chomp($line);
|
||||
if ($line =~ m/^Could not find/) { die "Error: provmethod $bootparms{provmethod} is set for the node, but there is no osimage definition by that name."; }
|
||||
if ($line =~ m/ provmethod=/) {
|
||||
my ($junk, $provmethod) = split(/=/, $line);
|
||||
$bootparms{osimageprovmethod} = $provmethod;
|
||||
}
|
||||
if ($line =~ m/ osvers=/) {
|
||||
my ($junk, $osvers) = split(/=/, $line);
|
||||
$bootparms{osimageosvers} = $osvers;
|
||||
}
|
||||
}
|
||||
#print "provmethod=$bootparms{osimageprovmethod}, osvers=$bootparms{osimageosvers}\n"; exit;
|
||||
|
||||
# get the mgmt node cluster-facing ip addr
|
||||
@output = runcmd('lsdef -t site -ci master');
|
||||
|
@ -1,248 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# xCAT postscript for configuring bonding of nics.
|
||||
# Usage: configbond bond1 eth1 [eth3]
|
||||
#
|
||||
# Note: this postscript currently has some assumptions that are specific to the softlayer environment.
|
||||
# We only use this to configure bond1, because bond0 gets configured by the node provisioning process.
|
||||
# (altho this script would work for bond0)
|
||||
|
||||
use strict;
|
||||
# Check number of args
|
||||
|
||||
my $nargs = $#ARGV + 1;
|
||||
if (scalar(@ARGV) < 2 || scalar(@ARGV) > 3) {
|
||||
system("logger -t xcat -p local4.err 'Usage: configbond <bond> <dev0> [<dev1>]'");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $bond = shift(@ARGV);
|
||||
my $nic = $ARGV[0];
|
||||
my @devs;
|
||||
foreach my $a (@ARGV) { push(@devs,split('@',$a)); } # support the new syntax in the xcat configbond postscript
|
||||
my $nicips = $ENV{NICIPS};
|
||||
my $nicnetworks = $ENV{NICNETWORKS};
|
||||
my $net_cnt = $ENV{NETWORKS_LINES};
|
||||
|
||||
#todo: change this script so they dont need to specify nicnetworks
|
||||
if (!$nicips || !$nicnetworks) { system("logger -t xcat -p local4.err 'configbond: must specify attributes nicips and nicnetworks in the xcat db for this node.'"); exit 1; }
|
||||
|
||||
#todo: these are specific to softlayer. They should be another attribute or argument
|
||||
my $bondingopts = 'mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1';
|
||||
|
||||
my $netmask ='';
|
||||
my $ipaddr = '';
|
||||
my $nic_num = '';
|
||||
my $subnet = '';
|
||||
my $nic_net = '';
|
||||
my $net_name = '';
|
||||
my @nic_nets = (); # array of networks for this nic
|
||||
my @nic_ips =(); # array of ipaddresses for this nic
|
||||
my @networks = (); # array of all networks from networks table.
|
||||
# { network_name, subnet, netmask }
|
||||
|
||||
system("logger -t xcat -p local4.err 'configbond: Master: $bond'");
|
||||
system("logger -t xcat -p local4.err 'configbond: Slaves: @devs'");
|
||||
#system("logger -t xcat -p local4.err 'configbond: NIC: $nic'");
|
||||
system("logger -t xcat -p local4.err 'configbond: NICNETWORKS: $nicnetworks'");
|
||||
system("logger -t xcat -p local4.err 'configbond: NICIPS: $nicips'");
|
||||
|
||||
# Update modprobe
|
||||
my $file = "/etc/modprobe.d/$bond.conf";
|
||||
if (!open(FILE, ">$file")) { system("logger -t xcat -p local4.err 'configbond: cannot open $file.'"); exit 1; }
|
||||
|
||||
print FILE "alias $bond bonding\n";
|
||||
# the bonding options are put in the ifcfg file instead
|
||||
#print FILE "options $bond mode=balance-rr miimon=100\n";
|
||||
close FILE;
|
||||
|
||||
# create array of network info. Needed in case where there are
|
||||
# more than one ip address per nic and shouldn't be many networks.
|
||||
my $net_info;
|
||||
my $cnt = 1;
|
||||
|
||||
while ( $cnt <= $net_cnt ) {
|
||||
$net_info = $ENV{"NETWORKS_LINE$cnt"};
|
||||
$net_info =~ /^netname=([^\|]*)\|\|/;
|
||||
$net_name = $1;
|
||||
$net_info =~ /net=([^\|]*)\|\|/;
|
||||
$subnet = $1;
|
||||
$net_info =~ /mask=([^\|]*)\|\|/;
|
||||
$netmask = $1;
|
||||
push @{ $networks[$cnt-1] }, ($net_name, $subnet, $netmask);
|
||||
$cnt +=1;
|
||||
}
|
||||
|
||||
# get network or networks for this nic from NICNETWORKS:
|
||||
# eth0:1_0_0_0-255_255_0_0|network2,eth1:1_1_0_0
|
||||
# create array of networks for this nic
|
||||
foreach my $nic_networks (split(/,/,$nicnetworks)) {
|
||||
my @net = ();
|
||||
if ( $nic_networks =~ /!/ ) {
|
||||
@net = split(/!/,$nic_networks);
|
||||
} else {
|
||||
@net = split(/:/,$nic_networks);
|
||||
}
|
||||
if ($net[0] eq $nic) {
|
||||
@nic_nets = split(/\|/,$net[1]);
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# get all nic ipaddress from $nicips: i.e. eth0:1.0.0.1|2.0.0.1,eth1:1.1.1.1
|
||||
# Then get all ips for this specific nic, i.e. eth0.
|
||||
foreach my $ips (split(/,/,$nicips)) {
|
||||
my @ip = ();
|
||||
if ( $ips =~ /!/ ) {
|
||||
@ip = split(/!/,$ips);
|
||||
} else {
|
||||
@ip = split(/:/,$ips);
|
||||
}
|
||||
if ($ip[0] eq $nic ) {
|
||||
@nic_ips = split(/\|/,$ip[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $i;
|
||||
for ($i=0; $i < (scalar @nic_ips) ; $i++ ) {
|
||||
|
||||
# Time to create the interfaces.
|
||||
# loop through the nic networks, find the matching networks to get the
|
||||
# subnet and netmask and then create the appropriate ifcfg file for linux
|
||||
my $specific_nic = $nic;
|
||||
if ($i > 0) {
|
||||
$specific_nic = $nic . ":" . ($i);
|
||||
}
|
||||
|
||||
#todo: support case in which nicnetworks is not specified, find the correct network by calculation
|
||||
$cnt = 0;
|
||||
$subnet = "";
|
||||
$netmask = "";
|
||||
$net_name = "";
|
||||
while ( $cnt < $net_cnt ) {
|
||||
if ( $networks[$cnt][0] eq $nic_nets[$i] ) {
|
||||
|
||||
$subnet = $networks[$cnt][1];
|
||||
$netmask = $networks[$cnt][2];
|
||||
$cnt = $net_cnt; # found match - get out.
|
||||
}
|
||||
else {
|
||||
$cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
# check that there is a subnet and netmask set
|
||||
if ( !(length($subnet) > 0) || !(length($netmask) > 0) ) {
|
||||
system("logger -t xcat -p local4.err 'configbond: network subnet or netmask not set.'");
|
||||
exit 1;
|
||||
}
|
||||
system("logger -t xcat -p local4.err 'configbond: network subnet and netmask: $subnet, $netmask'");
|
||||
system("logger -t xcat -p local4.err 'configbond: $specific_nic, $nic_ips[$i]'");
|
||||
|
||||
# Write the master info to the ifcfg file
|
||||
if (-d "/etc/sysconfig/network-scripts") {
|
||||
# rhel/centos/fedora
|
||||
my $dir = "/etc/sysconfig/network-scripts";
|
||||
if (!open(FILE, ">$dir/ifcfg-$bond")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$bond.'"); exit 1; }
|
||||
|
||||
print FILE "DEVICE=$bond\n";
|
||||
print FILE "BOOTPROTO=none\n";
|
||||
print FILE "IPADDR=$nic_ips[$i]\n";
|
||||
print FILE "NETMASK=$netmask\n";
|
||||
print FILE "ONBOOT=yes\n";
|
||||
print FILE "USERCTL=no\n";
|
||||
print FILE qq(BONDING_OPTS="$bondingopts"\n);
|
||||
close FILE;
|
||||
|
||||
# Configure slaves
|
||||
my @output = `ip addr show 2>&1`; # to check for existance of the device later
|
||||
foreach my $dev (@devs) {
|
||||
# as a convenience, make sure the device exists before adding it to the bond
|
||||
if (!grep(m/^\d+:\s+$dev:/, @output)) {
|
||||
system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'");
|
||||
unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning
|
||||
next;
|
||||
}
|
||||
|
||||
system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'");
|
||||
if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; }
|
||||
print FILE "DEVICE=$dev\n";
|
||||
print FILE "BOOTPROTO=none\n";
|
||||
print FILE "MASTER=$bond\n";
|
||||
print FILE "ONBOOT=yes\n";
|
||||
print FILE "SLAVE=yes\n";
|
||||
print FILE "USERCTL=no\n";
|
||||
close FILE;
|
||||
}
|
||||
}
|
||||
elsif (-d "/etc/sysconfig/network") {
|
||||
# sles
|
||||
my $dir = "/etc/sysconfig/network";
|
||||
if (!open(FILE, ">$dir/ifcfg-$bond")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$bond.'"); exit 1; }
|
||||
|
||||
print FILE "BOOTPROTO=static\n";
|
||||
print FILE "BONDING_MASTER=yes\n";
|
||||
print FILE "BONDING_MODULE_OPTS='$bondingopts'\n";
|
||||
print FILE "NAME='Bonded Interface'\n";
|
||||
print FILE "IPADDR=$nic_ips[$i]\n";
|
||||
print FILE "NETMASK=$netmask\n";
|
||||
print FILE "STARTMODE=onboot\n";
|
||||
print FILE "USERCONTROL=no\n";
|
||||
my $devnum = 0;
|
||||
my @output = `ip addr show 2>&1`; # to check for existance of the device later
|
||||
foreach my $dev (@devs) {
|
||||
if (!grep(m/^\d+:\s+$dev:/, @output)) { next; }
|
||||
print FILE "BONDING_SLAVE_$devnum=$dev\n";
|
||||
$devnum++;
|
||||
}
|
||||
close FILE;
|
||||
|
||||
# Configure slaves
|
||||
foreach my $dev (@devs) {
|
||||
# as a convenience, make sure the device exists before adding it to the bond
|
||||
if (!grep(m/^\d+:\s+$dev:/, @output)) {
|
||||
system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'");
|
||||
unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning
|
||||
next;
|
||||
}
|
||||
|
||||
system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'");
|
||||
if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; }
|
||||
print FILE "BOOTPROTO=none\n";
|
||||
print FILE "STARTMODE=hotplug\n";
|
||||
close FILE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
# do not recognize this distro
|
||||
system("logger -t xcat -p local4.err 'configbond: network directory is not either the Red Hat or SuSE format.'");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Apply the changes. Since we are only doing bond1 right now, lets not restart the whole network
|
||||
# so we dont disrupt the installnic connection. Instead we just need to bring down the slave nics,
|
||||
# and then bring up the bond nic.
|
||||
#runcmd("service network restart");
|
||||
foreach my $dev (@devs) {
|
||||
runcmd("ifdown $dev");
|
||||
}
|
||||
runcmd("ifdown $bond"); # in case it was already up
|
||||
runcmd("ifup $bond"); # note: this wont reload the bonding kernel module, so we are depending on the provisioning process to already have set the correct bonding options
|
||||
system("logger -t xcat -p local4.info 'configbond: successfully configured $specific_nic.'");
|
||||
|
||||
}
|
||||
exit 0;
|
||||
|
||||
sub runcmd {
|
||||
my $cmd = shift @_;
|
||||
$cmd .= ' 2>&1';
|
||||
my @output = `$cmd`;
|
||||
my $rc = $? >> 8;
|
||||
if ($rc) {
|
||||
system("logger -t xcat -p local4.err 'configeth: command $cmd failed with rc $rc: " . join('',@output) . "'");
|
||||
my $errout= "configeth: command $cmd failed with rc $rc.";
|
||||
`echo $errout`;
|
||||
exit $rc;
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set the default route of the node to the ip address and nic passed in
|
||||
# this should be added to the postbootscripts, NOT postscripts
|
||||
|
||||
gateway="$1"
|
||||
nic="$2"
|
||||
|
||||
# set it temporarily
|
||||
echo "ip route replace to default via $gateway dev $nic"
|
||||
ip route replace to default via $gateway dev $nic
|
||||
|
||||
# set it permanently
|
||||
#todo: this is only for sles right now
|
||||
file=/etc/sysconfig/network/routes
|
||||
if grep -q -E '^default ' $file; then
|
||||
# replace the default route that is already in there
|
||||
sed -i 's/^default .*$/default '$gateway' - -/' $file
|
||||
else
|
||||
# no default route yet, append to file
|
||||
echo "default $gateway - -" >>$file
|
||||
fi
|
||||
|
||||
# While we are here, clean up the network wait hack, if it is still there.
|
||||
# (It was added during scripted install, because autoyast will not use the bond
|
||||
# configuration for 1 part of the process.) Do not know a better place to clean
|
||||
# this up.
|
||||
sed -i '/Waiting to reach xCAT mgmt node/d' /etc/init.d/network
|
@ -48,7 +48,7 @@ xCAT-SoftLayer provides Utilities to make xCAT work in a SoftLayer environment.
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/install
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
|
||||
#mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
|
||||
@ -59,8 +59,8 @@ cp -p -R share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
|
||||
cp -d bin/* $RPM_BUILD_ROOT/%{prefix}/bin
|
||||
chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
|
||||
|
||||
cp -d postscripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
|
||||
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts/*
|
||||
#cp -d postscripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
|
||||
#chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts/*
|
||||
|
||||
cp -d si-post-install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install
|
||||
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install/*
|
||||
@ -84,9 +84,3 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%post
|
||||
# We are shipping the postscripts in a sysclone dir and then copying them to /install/postscripts here,
|
||||
# because we want to allow base xcat to eventually ship them and not conflict on the file name/path
|
||||
# But base xcat now has a newer/better configbond written in bash, so if that is there do not overwrite it.
|
||||
head /install/postscripts/configbond | grep -q -E '^#! */bin/bash'
|
||||
if [[ $? != 0 ]]; then
|
||||
# the new configbond from xcat 2.8.5 is not there, so copy ours
|
||||
cp -f /%{prefix}/share/xcat/sysclone/postscripts/* /install/postscripts
|
||||
fi
|
||||
|
@ -101,15 +101,13 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/webportal
|
||||
# Inspect whether PHP related RPM packages are installed
|
||||
%ifos linux
|
||||
if [ -e "/etc/redhat-release" ]; then
|
||||
rpm -q php >/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
if [ ! -e "/etc/httpd/conf.d/php.conf" ]; then
|
||||
echo ""
|
||||
echo "Error! php has not been installed. Please run 'yum install php' before installing xCAT-UI.";
|
||||
exit -1;
|
||||
fi
|
||||
else # SUSE
|
||||
rpm -q apache2-mod_php5 php5 >/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
if [ ! -e "/etc/apache2/conf.d/php5.conf" ]; then
|
||||
echo ""
|
||||
echo "Error! apache2-mod_php5 and php5 have not been installed. Please run 'zypper install apache2-mod_php5 php5' before installing xCAT-UI."
|
||||
exit -1;
|
||||
|
@ -1147,6 +1147,13 @@ sub edit_bldkitconf
|
||||
my $osarch=`uname -p`;
|
||||
my $kitcomponent_basename = $kitname."_compute";
|
||||
|
||||
if ($debianflag==1) {
|
||||
if($osarch == "ppc64le"){
|
||||
$osarch="ppc64el";
|
||||
}
|
||||
$kitcomponent_basename = $kitname."-compute";
|
||||
}
|
||||
|
||||
for (@lines) {
|
||||
s/<<<INSERT_kitbasename_HERE>>>/$kitname/;
|
||||
s/<<<INSERT_kitrepoid_HERE>>>/$kitrepoid/;
|
||||
|
@ -88,4 +88,12 @@ opt/xcat/bin/xcatclient opt/xcat/bin/lshwconn
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/sbin/makeroutes
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/sbin/snmove
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lsxcatd
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskit
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/addkit
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmkit
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskitcomp
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/addkitcomp
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmkitcomp
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/chkkitcomp
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskitdeployparam
|
||||
opt/xcat/bin/xcatclient opt/xcat/bin/postage
|
||||
|
@ -7,6 +7,6 @@ Standards-Version: 3.7.2
|
||||
|
||||
Package: xcat-server
|
||||
Architecture: all
|
||||
Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl
|
||||
Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl,libjson-perl
|
||||
Description: Server and configuration utilities of the xCAT management project
|
||||
xCAT-server provides the core server and configuration management components of xCAT. This package should be installed on your management server
|
||||
|
@ -22,6 +22,7 @@ opt/xcat/share/xcat/ib/netboot/sles
|
||||
opt/xcat/share/xcat/ib/netboot/rh
|
||||
opt/xcat/lib
|
||||
opt/xcat/lib/perl
|
||||
opt/xcat/lib/perl/Confluent
|
||||
opt/xcat/lib/perl/xCAT
|
||||
opt/xcat/lib/perl/xCAT_plugin
|
||||
opt/xcat/lib/perl/xCAT_schema
|
||||
|
@ -24,6 +24,7 @@ lib/xcat/plugins/* opt/xcat/lib/perl/xCAT_plugin/
|
||||
lib/xcat/schema/* opt/xcat/lib/perl/xCAT_schema/
|
||||
lib/xcat/monitoring/* opt/xcat/lib/perl/xCAT_monitoring/
|
||||
lib/xcat/dsh/Context/* opt/xcat/xdsh/Context
|
||||
lib/xcat/Confluent/* opt/xcat/lib/perl/Confluent/
|
||||
|
||||
lib/xcat/shfunctions opt/xcat/lib
|
||||
etc/init.d/xcatd etc/init.d
|
||||
|
@ -60,6 +60,7 @@ binary-arch:
|
||||
chmod 644 $(rootdir)/lib/perl/xCAT_monitoring/samples/*
|
||||
chmod 755 $(rootdir)/lib/perl/xCAT_monitoring/pcp
|
||||
chmod 644 $(rootdir)/lib/perl/xCAT_monitoring/pcp/*
|
||||
chmod 644 $(rootdir)/lib/perl/Confluent/*
|
||||
chmod 644 $(rootdir)/lib/perl/xCAT_schema/*
|
||||
chmod 755 $(rootdir)/lib/perl/xCAT_schema/samples
|
||||
chmod 644 $(rootdir)/lib/perl/xCAT_schema/samples/*
|
||||
|
@ -271,7 +271,14 @@ sub validate {
|
||||
@$deferredmsgargs = ("A",$rsp);
|
||||
}
|
||||
} else { # getpostscript or getcredentials, just syslog
|
||||
unless ($::XCATSITEVALS{skipvalidatelog}) { @$deferredmsgargs=("S",$logst); }
|
||||
if (($request->{command}->[0] eq "getpostscript")
|
||||
|| ($request->{command}->[0] eq "getcredentials")) {
|
||||
unless ($::XCATSITEVALS{skipvalidatelog}) { @$deferredmsgargs=("S",$logst); }
|
||||
} else { #other skipped command syslog unless auditnosyslog
|
||||
if ($skipsyslog == 0){ # write to syslog
|
||||
@$deferredmsgargs=("S",$logst);
|
||||
}
|
||||
}
|
||||
}
|
||||
} # end getbladecons,etc check
|
||||
return $rc;
|
||||
|
@ -1149,10 +1149,13 @@ Usage:
|
||||
|
||||
# Add reserve nics
|
||||
foreach my $nicname (@reserveNics){
|
||||
my $oldip = $nodesNicsRef->{$node}->{$nicname}->{"ip"};
|
||||
if ($oldip) {
|
||||
$nicipsAttr{$node}{nicips} .= $nicname."!".$oldip.",";
|
||||
}
|
||||
my $count = index($nicipsAttr{$node}{nicips}, $nicname);
|
||||
if($count < 0) {
|
||||
my $oldip = $nodesNicsRef->{$node}->{$nicname}->{"ip"};
|
||||
if ($oldip) {
|
||||
$nicipsAttr{$node}{nicips} .= $nicname."!".$oldip.",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1299,26 +1302,50 @@ Usage:
|
||||
my $nodelist = $request->{node};
|
||||
my $hostname = $nodelist->[0];
|
||||
|
||||
# Validate MAC address
|
||||
my $recordsref = xCAT::ProfiledNodeUtils->get_allnode_singleattrib_hash('mac', 'mac');
|
||||
%allmacs = %$recordsref;
|
||||
foreach (keys %allmacs){
|
||||
my @hostentries = split(/\|/, $_);
|
||||
foreach my $hostandmac ( @hostentries){
|
||||
my ($macstr, $machostname) = split("!", $hostandmac);
|
||||
$allmacs{$macstr} = 0;
|
||||
if("__NOMAC__" eq $args_dict{"mac"}) {
|
||||
# Validate if node is bind on a switch
|
||||
my $switch_table = xCAT::Table->new("switch");
|
||||
my @item = $switch_table->getAttribs({'node' => $hostname}, 'switch', 'port');
|
||||
my $item_num = @item;
|
||||
my $switch_valid = 0;
|
||||
unless($item[0])
|
||||
{
|
||||
setrsp_errormsg("Failed to replace node <$hostname>. Switch information cannot be retrieved. Ensure that the switch is configured correctly.");
|
||||
return;
|
||||
} else {
|
||||
foreach my $switch_item (@item){
|
||||
if($switch_item->{'switch'} && $switch_item->{'port'}){
|
||||
$switch_valid = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
unless ($switch_valid)
|
||||
{
|
||||
setrsp_errormsg("Failed to replace node <$hostname>. Switch information cannot be retrieved. Ensure that the switch is configured correctly.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
#Validate MAC address
|
||||
my $recordsref = xCAT::ProfiledNodeUtils->get_allnode_singleattrib_hash('mac', 'mac');
|
||||
%allmacs = %$recordsref;
|
||||
foreach (keys %allmacs){
|
||||
my @hostentries = split(/\|/, $_);
|
||||
foreach my $hostandmac ( @hostentries){
|
||||
my ($macstr, $machostname) = split("!", $hostandmac);
|
||||
$allmacs{$macstr} = 0;
|
||||
}
|
||||
}
|
||||
%allmacsupper = ();
|
||||
foreach (keys %allmacs){
|
||||
$allmacsupper{uc($_)} = 0;
|
||||
}
|
||||
if (exists $allmacsupper{uc($args_dict{"mac"})}){
|
||||
setrsp_errormsg("The specified MAC address $args_dict{'mac'} already exists. You must use a different MAC address.");
|
||||
return;
|
||||
} elsif(! xCAT::NetworkUtils->isValidMAC($args_dict{'mac'})) {
|
||||
setrsp_errormsg("The specified MAC address $args_dict{'mac'} is invalid. You must use a valid MAC address.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
%allmacsupper = ();
|
||||
foreach (keys %allmacs){
|
||||
$allmacsupper{uc($_)} = 0;
|
||||
}
|
||||
if (exists $allmacsupper{uc($args_dict{"mac"})}){
|
||||
setrsp_errormsg("The specified MAC address $args_dict{'mac'} already exists. You must use a different MAC address.");
|
||||
return;
|
||||
} elsif(! xCAT::NetworkUtils->isValidMAC($args_dict{'mac'})){
|
||||
setrsp_errormsg("The specified MAC address $args_dict{'mac'} is invalid. You must use a valid MAC address.");
|
||||
return;
|
||||
}
|
||||
|
||||
# re-create the chain record as updating mac may means for replacing a new brand hardware...
|
||||
@ -1338,9 +1365,19 @@ Usage:
|
||||
# Update database records.
|
||||
setrsp_progress("Updating database...");
|
||||
# MAC table
|
||||
my $mactab = xCAT::Table->new('mac',-create=>1);
|
||||
$mactab->setNodeAttribs($hostname, {mac=>$args_dict{'mac'}});
|
||||
$mactab->close();
|
||||
if("__NOMAC__" eq $args_dict{"mac"})
|
||||
{
|
||||
my $mactab = xCAT::Table->new('mac',-create=>1);
|
||||
my %keyhash;
|
||||
$keyhash{'node'} = $hostname;
|
||||
$mactab->delEntries(\%keyhash);
|
||||
$mactab->commit();
|
||||
$mactab->close();
|
||||
} else {
|
||||
my $mactab = xCAT::Table->new('mac',-create=>1);
|
||||
$mactab->setNodeAttribs($hostname, {mac=>$args_dict{'mac'}});
|
||||
$mactab->close();
|
||||
}
|
||||
|
||||
# DB update: chain table.
|
||||
my $chaintab = xCAT::Table->new('chain', -create=>1);
|
||||
@ -1367,6 +1404,17 @@ Usage:
|
||||
setrsp_progress("Warning: failed to call kit commands.");
|
||||
}
|
||||
|
||||
if("__NOMAC__" eq $args_dict{"mac"})
|
||||
{
|
||||
setrsp_progress("Updating DHCP entries");
|
||||
$retref = xCAT::Utils->runxcmd({command=>["makedhcp"], node=>[$hostname], arg=>['-d']}, $request_command, 0, 2);
|
||||
$retref = {};
|
||||
$retstrref = parse_runxcmd_ret($retref);
|
||||
if ($::RUNCMD_RC != 0){
|
||||
setrsp_progress("Warning: failed to call kit commands.");
|
||||
}
|
||||
}
|
||||
|
||||
setrsp_progress("Re-creating nodes...");
|
||||
$retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>[$hostname], macflag=>[1]}, $request_command, 0, 2);
|
||||
$retstrref = parse_runxcmd_ret($retref);
|
||||
|
@ -1063,7 +1063,7 @@ sub is_redhat6sp4
|
||||
=head3 initDB
|
||||
|
||||
Will initialize the DB if it does not already exist, also updates with
|
||||
new data needed or database changes during xCAT update install.
|
||||
new data needed or database changes during xCAT install.
|
||||
|
||||
=cut
|
||||
|
||||
@ -1210,6 +1210,7 @@ sub initDB
|
||||
$chtabcmds .= "$::XCATROOT/sbin/chtab key=vsftp site.value=n;";
|
||||
$chtabcmds .= "$::XCATROOT/sbin/chtab key=cleanupxcatpost site.value=no;";
|
||||
$chtabcmds .= "$::XCATROOT/sbin/chtab key=dhcplease site.value=43200;";
|
||||
$chtabcmds .= "$::XCATROOT/sbin/chtab key=auditnosyslog site.value=0;";
|
||||
#$chtabcmds .= "$::XCATROOT/sbin/chtab key=useflowcontrol site.value=yes;"; # need to fix 4031
|
||||
|
||||
if ($::osname eq 'AIX')
|
||||
|
Loading…
x
Reference in New Issue
Block a user