6 Commits

Author SHA1 Message Date
lissav
9db88139d3 Defect 4061 2014-04-30 09:56:53 +01:00
a9068dbd0f Revert "temporary fix for postscripts for EXECUTE and EXECUTEALWAYS"
This reverts commit 06cad71050.
2014-04-30 09:56:21 +01:00
06cad71050 temporary fix for postscripts for EXECUTE and EXECUTEALWAYS 2014-04-29 07:45:15 +01:00
3e52ee0c40 defect #4061: fix DSHCLI.pm for append in hierarchy 2014-04-24 14:44:30 +01:00
lissav
993e2f77a8 defect 4061 2014-04-24 14:44:23 +01:00
da0431e69a defect #4061: fix DSHCLI.pm for merge in hierarchy 2014-04-24 14:44:14 +01:00
17 changed files with 114 additions and 410 deletions

View File

@@ -1 +1 @@
2.8.3ocf
2.8.3

View File

@@ -6040,11 +6040,11 @@ sub run_always_rsync_postscripts
# if on the service node need to add the $syncdir directory
# to the path
if (xCAT::Utils->isServiceNode()) {
my $tmpp=$syncdir . $ps;
$ps=$tmpp;
my $tmps=$syncdir . $ps;
push @args, $tmps;
} else{
push @args, $ps;
}
push @args, $ps;
push (@nodes, @{$$dshparms{'postscripts'}{$ps}});
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],

View File

@@ -265,7 +265,6 @@ sub rackformat_to_numricformat{
values are attributes of a specific nic, like:
type : nic type
hostnamesuffix: hostname suffix
hostnameprefix: hostname prefix
customscript: custom script for this nic
network: network name for this nic
ip: ip address of this nic.
@@ -277,7 +276,7 @@ sub get_nodes_nic_attrs{
my $nodes = shift;
my $nicstab = xCAT::Table->new( 'nics');
my $entry = $nicstab->getNodesAttribs($nodes, ['nictypes', 'nichostnamesuffixes', 'nichostnameprefixes', 'niccustomscripts', 'nicnetworks', 'nicips']);
my $entry = $nicstab->getNodesAttribs($nodes, ['nictypes', 'nichostnamesuffixes', 'niccustomscripts', 'nicnetworks', 'nicips']);
my %nicsattrs;
my @nicattrslist;
@@ -309,20 +308,6 @@ sub get_nodes_nic_attrs{
}
}
if($entry->{$node}->[0]->{'nichostnameprefixes'}){
@nicattrslist = split(",", $entry->{$node}->[0]->{'nichostnameprefixes'});
foreach (@nicattrslist){
my @nicattrs;
if ($_ =~ /!/) {
@nicattrs = split("!", $_);
} else {
@nicattrs = split(":", $_);
}
$nicsattrs{$node}{$nicattrs[0]}{'hostnameprefix'} = $nicattrs[1];
}
}
if($entry->{$node}->[0]->{'niccustomscripts'}){
@nicattrslist = split(",", $entry->{$node}->[0]->{'niccustomscripts'});
foreach (@nicattrslist){

View File

@@ -532,7 +532,7 @@ nodegroup => {
},
},
nodehm => {
cols => [qw(node power mgt cons termserver termport conserver serialport serialspeed serialflow getmac cmdmapping consoleondemand comments disable)],
cols => [qw(node power mgt cons termserver termport conserver serialport serialspeed serialflow getmac cmdmapping comments disable)],
keys => [qw(node)],
tablespace =>'XCATTBS16K',
table_desc => "Settings that control how each node's hardware is managed. Typically, an additional table that is specific to the hardware type of the node contains additional info. E.g. the ipmi, mp, and ppc tables.",
@@ -549,7 +549,6 @@ nodehm => {
serialflow => "The flow control value of the serial port for this node. For SOL this is typically 'hard'.",
getmac => 'The method to use to get MAC address of the node with the getmac command. If not set, the mgt attribute will be used. Valid values: same as values for mgmt attribute.',
cmdmapping => 'The fully qualified name of the file that stores the mapping between PCM hardware management commands and xCAT/third-party hardware management commands for a particular type of hardware device. Only used by PCM.',
consoleondemand => 'This overrides the value from site.consoleondemand; (0=no, 1=yes). Default is the result from site.consoleondemand.',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},
@@ -1280,7 +1279,7 @@ firmware => {
},
nics => {
cols => [qw(node nicips nichostnamesuffixes nichostnameprefixes nictypes niccustomscripts nicnetworks nicaliases comments disable)],
cols => [qw(node nicips nichostnamesuffixes nictypes niccustomscripts nicnetworks nicaliases comments disable)],
keys => [qw(node)],
tablespace =>'XCATTBS16K',
table_desc => 'Stores NIC details.',
@@ -1298,13 +1297,6 @@ nics => {
<nic1>!<ext1>|<ext2>,<nic2>!<ext1>|<ext2>,..., for example, eth0!-eth0|-eth0-ipv6,ib0!-ib0|-ib0-ipv6.
The xCAT object definition commands support to use nichostnamesuffixes.<nicname> as the sub attributes.
Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-),and period (.). When you are specifying "nichostnamesuffixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention',
nichostnameprefixes => 'Comma-separated list of hostname prefixes per NIC.
If only one ip address is associated with each NIC:
<nic1>!<ext1>,<nic2>!<ext2>,..., for example, eth0!eth0-,ib0!ib-
If multiple ip addresses are associcated with each NIC:
<nic1>!<ext1>|<ext2>,<nic2>!<ext1>|<ext2>,..., for example, eth0!eth0-|eth0-ipv6i-,ib0!ib-|ib-ipv6-.
The xCAT object definition commands support to use nichostnameprefixes.<nicname> as the sub attributes.
Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-),and period (.). When you are specifying "nichostnameprefixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention',
nictypes => 'Comma-separated list of NIC types per NIC. <nic1>!<type1>,<nic2>!<type2>, e.g. eth0!Ethernet,ib0!Infiniband. The xCAT object definition commands support to use nictypes.<nicname> as the sub attributes.',
niccustomscripts => 'Comma-separated list of custom scripts per NIC. <nic1>!<script1>,<nic2>!<script2>, e.g. eth0!configeth eth0, ib0!configib ib0. The xCAT object definition commands support to use niccustomscripts.<nicname> as the sub attribute
.',
@@ -1824,10 +1816,6 @@ my @nodeattrs = (
{attr_name => 'serialflow',
tabentry => 'nodehm.serialflow',
access_tabentry => 'nodehm.node=attr:node',
},
{attr_name => 'consoleondemand',
tabentry => 'nodehm.consoleondemand',
access_tabentry => 'nodehm.node=attr:node',
},
##################
# vpd table #
@@ -2189,10 +2177,6 @@ my @nodeattrs = (
tabentry => 'nics.nichostnamesuffixes',
access_tabentry => 'nics.node=attr:node',
},
{attr_name => 'nichostnameprefixes',
tabentry => 'nics.nichostnameprefixes',
access_tabentry => 'nics.node=attr:node',
},
{attr_name => 'nictypes',
tabentry => 'nics.nictypes',
access_tabentry => 'nics.node=attr:node',

View File

@@ -14,7 +14,7 @@
# postscript (stateful install) or with the otherpkgs processing of
# genimage (stateless/statelite install). This script will install any
# gpfs update rpms that exist on the xCAT management node in the
# /install/post/otherpkgs/gpfs_updates directory.
# /install/post/gpfs_updates directory.
# This is necessary because the GPFS updates can ONLY be installed
# after the base rpms have been installed, and the update rpms cannot
# exist in any rpm repositories used by xCAT otherpkgs processing
@@ -41,8 +41,8 @@ if [ $OS != "AIX" ]; then
mkdir -p /tmp/gpfs_updates
rm -f -R /tmp/gpfs_updates/*
cd /tmp/gpfs_updates
# wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=3 ftp://$MASTER/$UPDATES_DIR/*.rpm 2> /tmp/wget.log
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=4 --reject "index.html*" --no-parent http://$MASTER$INSTALL_DIR/$UPDATES_DIR/ 2> /tmp/wget.log
# wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=3 ftp://$SITEMASTER/$UPDATES_DIR/*.rpm 2> /tmp/wget.log
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=4 --reject "index.html*" --no-parent http://$SITEMASTER$INSTALL_DIR/$UPDATES_DIR/ 2> /tmp/wget.log
if [ -n "`ls *.rpm 2> /dev/null`" ] ; then
rpm -Uvh *.rpm
fi

View File

@@ -1192,9 +1192,7 @@ sub collect_all_attribs_for_tables_in_template
$::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib} = $ent->{$node}->[0]->{$attrib};
#for noderes.xcatmaster
if ($tabname =~ /^noderes$/ && $attrib =~ /^xcatmaster$/ &&
( ! exists($::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}) ||
$::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} == "" ) )
if ($tabname =~ /^noderes$/ && $attrib =~ /^xcatmaster$/ && ! exists($::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}))
{
my $value;
$value = xCAT::NetworkUtils->my_ip_facing($node);

View File

@@ -271,7 +271,7 @@ sub subvars {
my $tempstr = "%include /tmp/partitionfile\n";
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$tempstr/;
#modify the content in the file, and write into %pre part
$partcontent = "wget http://$master/$partitionfile -O /tmp/partscript\n";
$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
#replace the #XCA_PARTITION_SCRIPT#
@@ -281,7 +281,7 @@ sub subvars {
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
my $tempstr = "<drive><device>XCATPARTITIONTEMP</device></drive>";
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$tempstr/;
$partcontent = "wget http://$master/$partitionfile -O /tmp/partscript\n";
$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
$partcontent .= "chmod 755 /tmp/partscript\n";
$partcontent .= "/tmp/partscript\n";
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;

View File

@@ -538,7 +538,7 @@ sub processArgs
# --nics is the equivalent of -i nicips,nichostnamesuffixes...
if ($::opt_nics) {
$::opt_i="nicips,nichostnamesuffixes,nihostnameprefixes,nictypes,niccustomscripts,nicnetworks,nicaliases";
$::opt_i="nicips,nichostnamesuffixes,nictypes,niccustomscripts,nicnetworks,nicaliases";
}
# -i and -s cannot be used together

View File

@@ -12,7 +12,6 @@ use strict;
use Data::Dumper;
my @cservers = qw(mrv cyclades);
my %termservers; #list of noted termservers
my $siteondemand; # The site value for consoleondemand
my $usage_string=
" makeconservercf [-d|--delete] noderange
@@ -277,10 +276,6 @@ sub docfheaders {
my $site_entry = $entries[0];
if ( defined($site_entry) and $site_entry eq "yes" ) {
push @newheaders," options ondemand;\n";
$siteondemand=1;
}
else {
$siteondemand=0;
}
push @newheaders,"}\n";
@@ -327,7 +322,7 @@ sub makeconservercf {
my $hmtab = xCAT::Table->new('nodehm');
my @cfgents1;# = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport']);
if (($nodes and @$nodes > 0) or $req->{noderange}->[0]) {
@cfgents1 = $hmtab->getNodesAttribs($nodes,['node','cons','serialport','mgt','conserver','termserver','termport','consoleondemand']);
@cfgents1 = $hmtab->getNodesAttribs($nodes,['node','cons','serialport','mgt','conserver','termserver','termport']);
# Adjust the data structure to make the result consistent with the getAllNodeAttribs() call we make if a noderange was not specified
my @tmpcfgents1;
foreach my $ent (@cfgents1)
@@ -340,7 +335,7 @@ sub makeconservercf {
@cfgents1 = @tmpcfgents1
} else {
@cfgents1 = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport','consoleondemand']);
@cfgents1 = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport']);
}
@@ -543,14 +538,6 @@ foreach my $node (sort keys %$cfgenthash) {
push @$content," exec $locerror".$::XCATROOT."/share/xcat/cons/".$cmeth." ".$node.";\n"
}
}
if (defined($cfgent->{consoleondemand})) {
if ($cfgent->{consoleondemand} && !$siteondemand ) {
push @$content," options ondemand;\n";
}
elsif (!$cfgent->{consoleondemand} && $siteondemand ) {
push @$content," options !ondemand;\n";
}
}
push @$content,"}\n";
push @$content,"#xCAT END $node CONS\n";
}

View File

@@ -122,10 +122,6 @@ sub build_line
my $othernames = shift;
my @o_names = ();
my @n_names = ();
# Trim spaces from the beginning and end from $othernames
$othernames =~ s/^\s+|\s+$//g;
if (defined $othernames)
{
# the "hostnames" attribute can be a list delimited by
@@ -568,7 +564,6 @@ sub donics
$node,
[
'nicips', 'nichostnamesuffixes',
'nichostnameprefixes',
'nicnetworks', 'nicaliases'
]
);
@@ -614,7 +609,6 @@ sub donics
}
my @nicandsufx = split(',', $et->{'nichostnamesuffixes'});
my @nicandprfx = split(',', $et->{'nichostnameprefixes'});
foreach (@nicandsufx)
{
@@ -636,32 +630,12 @@ sub donics
$nich->{$nicname}->{nicsufx}->[0] = $nicsufx;
}
}
foreach (@nicandprfx)
{
my ($nicname, $nicprfx);
if ($_ =~ /!/) {
($nicname, $nicprfx) = split('!', $_);
} else {
($nicname, $nicprfx) = split(':', $_);
}
if ( $nicprfx =~ /\|/) {
my @prfs = split( /\|/, $nicprfx);
my $index=0;
foreach my $prf (@prfs) {
$nich->{$nicname}->{nicprfx}->[$index] = $prf;
$index++;
}
} else {
$nich->{$nicname}->{nicprfx}->[0] = $nicprfx;
}
}
# see if we need to fill in a default suffix
# nich has all the valid nics - ie. that have IPs provided!
foreach my $nic (keys %{$nich}) {
for (my $i = 0; $i < $nicindex{$nic}; $i++ ){
if (!$nich->{$nic}->{nicsufx}->[$i] && !$nich->{$nic}->{nicprfx}->[$i]) {
if (!$nich->{$nic}->{nicsufx}->[$i]) {
# then we have no suffix at all for this
# so set a default
$nich->{$nic}->{nicsufx}->[$i] = "-$nic";
@@ -732,7 +706,6 @@ sub donics
my $nicip = $nich->{$nic}->{nicip}->[$i];
my $nicsuffix = $nich->{$nic}->{nicsufx}->[$i];
my $nicprefix = $nich->{$nic}->{nicprfx}->[$i];
my $nicnetworks = $nich->{$nic}->{netwrk}->[$i];
my $nicaliases = $nich->{$nic}->{nicaliases}->[$i];
@@ -741,7 +714,7 @@ sub donics
}
# construct hostname for nic
my $nichostname = "$nicprefix$shorthost$nicsuffix";
my $nichostname = "$shorthost$nicsuffix";
# get domain from network def provided by nic attr
my $nt = $nettab->getAttribs({ netname => "$nicnetworks"}, 'domain');

View File

@@ -239,7 +239,7 @@ sub add_known_host
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
}
chomp($output[0]);
chop($output[0]);
my ($hostname,$ip_address) = xCAT::NetworkUtils->gethostnameandip($node);
if (!$hostname || !$ip_address)
{

View File

@@ -449,7 +449,7 @@ sub process_makeroutes {
delete_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name, $route_hash->{ifname});
}
else {
set_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name, $route_hash->{ifname});
set_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name,$route_hash->{ifname});
}
}
}
@@ -526,7 +526,6 @@ sub route_exists {
my $mask = shift;
my $gw_ip = shift;
my $gw=shift;
my $ifname = shift;
my $islinux=xCAT::Utils->isLinux();
@@ -558,8 +557,7 @@ sub route_exists {
my $net1=$a[0];
my $mask1=$a[2];
my $gw1=$a[1];
my $ifname1=$a[7];
if (($net1 eq $net) && ($mask1 eq $mask) && (($gw1 eq $gw) || ($gw1 eq $gw_ip) || ($ifname1 eq $ifname))) {
if (($net1 eq $net) && ($mask1 eq $mask) && (($gw1 eq $gw) || ($gw1 eq $gw_ip))) {
return 1;
}
}
@@ -604,27 +602,19 @@ sub set_route {
#print "set_route get called\n";
my $result;
if (!route_exists($net, $mask, $gw_ip, $gw, $ifname)) {
if (!route_exists($net, $mask, $gw_ip, $gw)) {
#set temporay route
my $cmd;
# ipv6 network
if ($net =~ /:/) {
if (xCAT::Utils->isLinux()) {
if ( $gw_ip == "" || $gw_ip == "::" ) {
$cmd="ip -6 route add $net/$mask dev $ifname";
} else {
$cmd="ip -6 route add $net/$mask via $gw_ip";
}
$cmd="ip -6 route add $net/$mask via $gw_ip";
} else {
# AIX TODO
}
} else {
if (xCAT::Utils->isLinux()) {
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$cmd="route add -net $net netmask $mask dev $ifname";
} else {
$cmd="route add -net $net netmask $mask gw $gw_ip";
}
$cmd="route add -net $net netmask $mask gw $gw_ip";
} else {
$cmd="route add -net $net -netmask $mask $gw_ip";
}
@@ -686,26 +676,18 @@ sub delete_route {
#print "delete_route get called\n";
my $result;
if (route_exists($net, $mask, $gw_ip, $gw, $ifname)) {
if (route_exists($net, $mask, $gw_ip, $gw)) {
#delete route temporarily
my $cmd;
if ($net =~ /:/) {
if (xCAT::Utils->isLinux()) {
if ( $gw_ip == "" || $gw_ip == "::" ) {
$cmd = "ip -6 route delete $net/$mask dev $ifname";
} else {
$cmd = "ip -6 route delete $net/$mask via $gw_ip";
}
$cmd = "ip -6 route delete $net/$mask via $gw_ip";
} else {
# AIX TODO
}
} else {
if (xCAT::Utils->isLinux()) {
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$cmd="route delete -net $net netmask $mask dev $ifname";
} else {
$cmd="route delete -net $net netmask $mask gw $gw_ip";
}
$cmd="route delete -net $net netmask $mask gw $gw_ip";
} else {
$cmd="route delete -net $net -netmask $mask $gw_ip";
}
@@ -845,22 +827,14 @@ sub addPersistentRoute_Sles {
#print "old output=" . join("\n", @output) . "\n";
my $hasConfiged=0;
if (@output && (@output > 0)) {
$hasConfiged=checkConfig_Sles($net, $mask, $gw_ip, $gw, $ifname, \@output);
$hasConfiged=checkConfig_Sles($net, $mask, $gw_ip, $gw, \@output);
}
#print "hasConfiged=$hasConfiged\n";
my $new_config;
if ($net =~ /:/) {
if ( $gw_ip == "" || $gw_ip == "::" ) {
$new_config = "$net/$mask :: - $ifname\n";
} else {
$new_config = "$net/$mask $gw_ip - -\n";
}
$new_config = "$net/$mask $gw_ip - -\n";
} else {
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$new_config="$net 0.0.0.0 $mask $ifname\n";
} else {
$new_config="$net $gw_ip $mask $ifname\n";
}
$new_config="$net $gw_ip $mask $ifname\n";
}
if (!$hasConfiged) {
push(@output, $new_config);
@@ -898,7 +872,7 @@ sub deletePersistentRoute_Sles {
my @new_output=();
my $bigfound=0;
foreach my $tmp_conf (@output) {
my $found = checkConfig_Sles($net, $mask, $gw_ip, $gw, $ifname, [$tmp_conf]);
my $found = checkConfig_Sles($net, $mask, $gw_ip, $gw, [$tmp_conf]);
if (!$found) {
push(@new_output, $tmp_conf);
} else {
@@ -935,18 +909,13 @@ sub checkConfig_Sles {
my $mask = shift;
my $gw_ip = shift;
my $gw=shift;
my $ifname=shift;
my $output=shift;
# Format:
# DESTINATION GATEWAY NETMASK INTERFACE
# DESTINATION/PREFIXLEN GATEWAY - INTERFACE
# ipv4 format: 192.168.0.0 207.68.156.51 255.255.0.0 eth1
# ipv6 format: fd59::/64 fd57:faaf:e1ab:336:21a:64ff:fe01:1 - -
foreach my $line (@$output) {
my @a=split(' ', $line);
my ($net1,$mask1,$gw1,$ifname1);
my ($net1,$mask1,$gw1);
if ($net =~ /:/) {
if (@a>0) {
my $ipv6net = $a[0];
@@ -956,10 +925,6 @@ sub checkConfig_Sles {
$gw1=$a[1];
if ($gw1 eq '-') { $gw1=$gw_ip; }
}
if (@a>3) {
$ifname1=$a[3];
if ($ifname1 eq '-') { $ifname1=$ifname;}
}
} else {
if (@a>0) {
@@ -974,14 +939,10 @@ sub checkConfig_Sles {
$mask1=$a[2];
if ($mask1 eq '-') { $mask1=$mask;}
}
if (@a>3) {
$ifname1=$a[3];
if ($ifname1 eq '-') { $ifname1=$ifname;}
}
}
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip ifname=$ifname1\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip) || ($ifname1 && $ifname1 eq $ifname))) {
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip))) {
return 1;
}
}
@@ -1011,7 +972,7 @@ sub addPersistentRoute_RH {
#print "old output=" . join("\n", @output) . "\n";
my $hasConfiged=0;
if (@output && (@output > 0)) {
$hasConfiged=checkConfig_RH($net, $mask, $gw_ip, $gw, $ifname, \@output);
$hasConfiged=checkConfig_RH($net, $mask, $gw_ip, $gw, \@output);
}
#print "hasConfiged=$hasConfiged\n";
my $new_config;
@@ -1026,11 +987,7 @@ sub addPersistentRoute_RH {
$new_config="$ifname $net/$mask $gw_ip";
} else {
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$new_config="any net $net netmask $mask dev $ifname\n";
} else {
$new_config="any net $net netmask $mask gw $gw_ip\n";
}
$new_config="any net $net netmask $mask gw $gw_ip $ifname\n";
}
if (!$hasConfiged) {
push(@output, $new_config);
@@ -1074,7 +1031,7 @@ sub deletePersistentRoute_RH {
my @new_output=();
my $bigfound=0;
foreach my $tmp_conf (@output) {
my $found = checkConfig_RH($net, $mask, $gw_ip, $gw, $ifname, [$tmp_conf]);
my $found = checkConfig_RH($net, $mask, $gw_ip, $gw, [$tmp_conf]);
if (!$found) {
push(@new_output, $tmp_conf);
} else {
@@ -1108,16 +1065,14 @@ sub checkConfig_RH {
my $mask = shift;
my $gw_ip = shift;
my $gw=shift;
my $ifname=shift;
my $output=shift;
foreach my $line (@$output) {
my @a=split(' ', $line);
#The format is: any net 172.16.0.0 netmask 255.240.0.0 gw 192.168.0.1 eth0
# ipv6 format: eth1 fd60::/64 fd57::214:5eff:fe15:1
my ($net1,$mask1,$gw1,$ifname1);
my ($net1,$mask1,$gw1);
if ($net =~ /:/) {
$ifname1 = $a[0];
if (@a>1) {
my $ipv6net = $a[1];
($net1,$mask1) = split("/",$ipv6net);
@@ -1135,18 +1090,13 @@ sub checkConfig_RH {
if ($mask1 eq '-') { $mask1=$mask;}
}
if (@a>6) {
if ( $a[5] eq 'dev' ) {
$ifname1=$a[6];
if ($ifname1 eq '-') { $ifname1=$ifname;}
} else {
$gw1=$a[6];
if ($gw1 eq '-') { $gw1=$gw_ip; }
}
$gw1=$a[6];
if ($gw1 eq '-') { $gw1=$gw_ip; }
}
}
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip ifname=$ifname1,ifname\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip) || ($ifname1 && $ifname1 eq $ifname))) {
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip\n";
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip))) {
return 1;
}
}
@@ -1170,21 +1120,12 @@ sub addPersistentRoute_Debian{
#ipv6
if ( $net =~ /:/){
if ( $gw_ip == "" || $gw_ip == "::" ) {
$cmd = "grep \"$net/$mask dev $ifname\" $conf_file";
$route_conf = " up route -A inet6 add $net/$mask dev $ifname \n down route -A inet6 del $net/$mask dev $ifname \n";
} else {
$cmd = "grep \"$net/$mask gw $gw_ip\" $conf_file";
$route_conf = " up route -A inet6 add $net/$mask gw $gw_ip \n down route -A inet6 del $net/$mask gw $gw_ip \n";
}
$cmd = "grep \"$net/$mask gw $gw_ip\" $conf_file";
$route_conf = " up route -A inet6 add $net/$mask gw $gw_ip \n down route -A inet6 del $net/$mask gw $gw_ip \n";
}
else { #ipv4
$cmd = "grep \"-net $net netmask $mask gw $gw_ip\" $conf_file";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$route_conf = " up route add -net $net netmask $mask dev $ifname \n down route del -net $net netmask $mask dev $ifname \n";
} else {
$route_conf = " up route add -net $net netmask $mask gw $gw_ip \n down route del -net $net netmask $mask gw $gw_ip\n";
}
$route_conf = " up route add -net $net netmask $mask gw $gw_ip \n down route del -net $net netmask $mask gw $gw_ip \n";
}
#fine the corresponding config in the config file
@@ -1242,18 +1183,10 @@ sub deletePersistentRoute_Debian{
preParse_Debian();
#ipv6
if ( $net =~ /:/){
if ( $gw_ip == "" || $gw_ip == "::" ) {
$match = "$net/$mask dev $ifname";
} else {
$match = "$net/$mask gw $gw_ip";
}
$match = "$net/$mask gw $gw_ip";
}
else {
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$match = "net $net netmask $mask dev $ifname";
} else {
$match = "net $net netmask $mask gw $gw_ip";
}
$match = "net $net netmask $mask gw $gw_ip";
}
open(FH, "<", $conf_file);

View File

@@ -14,7 +14,6 @@ use xCAT::Schema;
use Data::Dumper;
use xCAT::Utils;
use xCAT::SvrUtils;
use xCAT::Scope;
use xCAT::Usage;
use Storable qw(dclone);
use xCAT::TableUtils;
@@ -189,7 +188,6 @@ sub preprocess_updatenode
my @requests = ();
my $installdir = xCAT::TableUtils->getInstallDir();
my $localhost = hostname();
# subroutine to display the usage
sub updatenode_usage
@@ -253,40 +251,20 @@ sub preprocess_updatenode
$callback->($rsp);
return;
}
# preprocess generate mypostscripts files (-g) for hierarchy
# if no sharedtftp then we need to broadcast this updatenode -g to all service nodes inorder
# to be able to support service node pools
#
# Just generate mypostscripts file and get out
if ($::GENMYPOST)
{
# precreatemypostscript has to be yes/1 or do nothing
my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts");
if ($entries[0] ) {
$entries[0] =~ tr/a-z/A-Z/;
if ($entries[0] =~ /^(1|YES)$/ ) {
# now check if sharedtftp = 0, if it is we need to broadcast to all the servicenode
# if there are service nodes
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry eq "0" or $t_entry eq "no" or $t_entry eq "NO")) {
# see if there are any servicenodes. If so then run updatenode -g on all of them
my @SN;
my @CN;
my $nodes = $request->{node};
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
if (@CN >0 ) { # if compute nodes broadcast to all servicenodes
return xCAT::Scope->get_broadcast_scope($request,@_);
}
} else { # sharedtftp=yes, just run on MN
my $notmpfiles=1;
my $nofiles=0;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
my $rsp = {};
$rsp->{data}->[0] = "Generated new mypostscript files on $localhost";
$callback->($rsp);
return 0;
}
my $notmpfiles=1;
my $nofiles=0;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
my $rsp = {};
$rsp->{data}->[0] = "Generated new mypostscript files";
$callback->($rsp);
} else { # not valid unless precreatemypostscripts enabled
my $rsp = {};
$rsp->{error}->[0] =
@@ -295,7 +273,7 @@ sub preprocess_updatenode
$callback->($rsp);
return ;
}
} else { # precreatemypostscripts not in the site table
} else { # not in the site table
my $rsp = {};
$rsp->{error}->[0] =
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
@@ -303,9 +281,8 @@ sub preprocess_updatenode
$callback->($rsp);
return ;
}
} # end GENMYPOST
return 0;
}
# -c must work with -S for AIX node
if ($::CMDLINE && !$::SWMAINTENANCE)
@@ -990,6 +967,27 @@ sub updatenode
}
#create each /tftpboot/mypostscript/mypostscript.<nodename> for each node
# This first removes the old one if precreatemypostscripts =0 or undefined
# call create files but no tmp files
my $notmpfiles=1;
my $nofiles=0;
#my $nofiles=1;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
# convert the hashes back to the way they were passed in
my $flatreq = xCAT::InstUtils->restore_request($request, $callback);
my $imgdefs;
my $updates;
if ($flatreq->{imagedef})
{
$imgdefs = $flatreq->{imagedef};
}
if ($flatreq->{updateinfo})
{
$updates = $flatreq->{updateinfo};
}
# get the NIM primary server name
my $nimprime = xCAT::InstUtils->getnimprime();
chomp $nimprime;
@@ -1002,7 +1000,6 @@ sub updatenode
'A|updateallsw' => \$::ALLSW,
'c|cmdlineonly' => \$::CMDLINE,
'd=s' => \$::ALTSRC,
'g|genmypost' => \$::GENMYPOST,
'h|help' => \$::HELP,
'v|version' => \$::VERSION,
'V|verbose' => \$::VERBOSE,
@@ -1045,60 +1042,6 @@ sub updatenode
$::attrres{$attr} = $value;
}
}
# Just generate mypostscripts file and get out
if ($::GENMYPOST)
{
my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts");
if ($entries[0] ) {
$entries[0] =~ tr/a-z/A-Z/;
if ($entries[0] =~ /^(1|YES)$/ ) {
my $notmpfiles=1;
my $nofiles=0;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
my $rsp = {};
$rsp->{data}->[0] = "Generated new mypostscript files on $localhostname";
$callback->($rsp);
} else { # not valid unless precreatemypostscripts enabled
my $rsp = {};
$rsp->{error}->[0] =
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
$rsp->{errorcode}->[0] =1;
$callback->($rsp);
return ;
}
} else { # not in the site table
my $rsp = {};
$rsp->{error}->[0] =
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
$rsp->{errorcode}->[0] =1;
$callback->($rsp);
return ;
}
return 0;
}
#create each /tftpboot/mypostscript/mypostscript.<nodename> for each node
# This first removes the old one if precreatemypostscripts =0 or undefined
# call create files but no tmp files
my $notmpfiles=1;
my $nofiles=0;
#my $nofiles=1;
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
# convert the hashes back to the way they were passed in
my $flatreq = xCAT::InstUtils->restore_request($request, $callback);
my $imgdefs;
my $updates;
if ($flatreq->{imagedef})
{
$imgdefs = $flatreq->{imagedef};
}
if ($flatreq->{updateinfo})
{
$updates = $flatreq->{updateinfo};
}
# if not just using the -k flag, then set all nodes to syncing in
# nodelist updatestatus for the other updatenode options
if (!($::SECURITY)) {

View File

@@ -27,9 +27,6 @@ function configipv4(){
echo "NETWORK_${num_v4num}=${str_v4net}" >> $str_conf_file
echo "LABEL_${num_v4num}=${num_v4num}" >> $str_conf_file
fi
if [[ ${str_if_name} == eth[0-9]*.[0-9]* ]]; then
echo "VLAN=yes" >> $str_conf_file
fi
#debian ubuntu
elif [ "$str_os_type" = "debian" ];then
str_conf_file="/etc/network/interfaces.d/${str_if_name}"
@@ -43,10 +40,6 @@ function configipv4(){
echo " address ${str_v4ip}" >> $str_conf_file
echo " netmask ${str_v4mask}" >> $str_conf_file
echo " network ${str_v4net}" >> $str_conf_file
if [[ ${str_if_name} == eth[0-9]*.[0-9]* ]]; then
parent_device=`echo ${str_if_name} | sed -e 's/\(eth[0-9]*\)\.[0-9]*/\1/g'`
echo " vlan-raw-device ${parent_device}" >> $str_conf_file
fi
else
# Write the info to the ifcfg file for redhat
str_conf_file=""
@@ -63,9 +56,6 @@ function configipv4(){
echo "IPADDR=${str_v4ip}" >> $str_conf_file
echo "NETMASK=${str_v4mask}" >> $str_conf_file
echo "ONBOOT=yes" >> $str_conf_file
if [[ ${str_if_name} == eth[0-9]*.[0-9]* ]]; then
echo "VLAN=yes" >> $str_conf_file
fi
fi
}

View File

@@ -286,9 +286,9 @@ do
if [ -f /etc/sysctl.conf ]
then
TMP1=`sed "/net.ipv4.conf.$nic.arp_filter=1/d" /etc/sysctl.conf`
TMP1=`sed "/net.ipv4.conf.$nic.arp_filter=1/d" /etc/sysctl.conf 2>&1 1>/dev/null`
echo "$TMP1" > /etc/sysctl.conf
TMP2=`sed "/net.ipv4.conf.$nic.arp_ignore=1/d" /etc/sysctl.conf`
TMP2=`sed "/net.ipv4.conf.$nic.arp_ignore=1/d" /etc/sysctl.conf 2>&1 1>/dev/null`
echo "$TMP2" > /etc/sysctl.conf
cfg="net.ipv4.conf.$nic.arp_filter=1"
grep "$cfg" /etc/sysctl.conf 2>&1 1>/dev/null

View File

@@ -278,7 +278,7 @@ do
else
if [ `echo $key | grep -E '(eth|en)[0-9]+'` ];then
str_nic_type="ethernet"
elif [ `echo $key | grep -E 'ib[0-9]+'` ];then
elif [ `echo $KEY | grep -E 'ib[0-9]+'` ];then
str_nic_type="infiniband"
else
logger -t xcat -p local4.info "confignics: unknown nic type for $key: $str_value ."

View File

@@ -107,8 +107,7 @@ route_exists()
net1=`echo $x|cut -d',' -f1`
gw1=`echo $x|cut -d',' -f2`
mask1=`echo $x|cut -d',' -f3`
ifname1=`echo $x|cut -d',' -f8`
if [ "$net" = "$net1" ] && [ "$mask" = "$mask1" ] && [ "$gw" = "$gw1" ] && [ "$ifname" = "$ifname1" ]; then
if [ "$net" = "$net1" ] && [ "$mask" = "$mask1" ] && [ "$gw" = "$gw1" ]; then
ret=1
break
fi
@@ -175,21 +174,11 @@ add_persistent_route()
filename="/etc/sysconfig/network/routes";
if echo $net | grep : 2>&1 1>/dev/null
then
if [ $gw_ip = "" -o $gw_ip = "::" ] ; then
route="$net/$mask :: - $ifname"
route1="$net\/$mask :: - $ifname";
else
route="$net/$mask $gw - -"
route1="$net\/$mask $gw - -";
fi
route="$net/$mask $gw - -"
route1="$net\/$mask $gw - -";
else
if [ $gw_ip = "" -o $gw_ip = "0.0.0.0" ] ; then
route="$net 0.0.0.0 $mask $ifname";
route1="$net 0.0.0.0 $mask $ifname";
else
route="$net $gw $mask $ifname";
route1="$net $gw $mask $ifname";
fi
route="$net $gw $mask $ifname";
route1="$net $gw $mask $ifname";
fi
if [ -f $filename ]; then
grep "$route" $filename 2>&1 1>/dev/null
@@ -232,18 +221,10 @@ add_persistent_route()
echo $net | grep : 2>&1 1>/dev/null
#ipv6
if [ $? -eq 0 ];then
if [ "$gw" = "" -o "$gw" = "::" ] ; then
matchstr="$net/$mask dev $ifname"
else
matchstr="$net/$mask gw $gw"
fi
matchstr="$net/$mask gw $gw"
v6flag=1
else
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
matchstr="net $net netmask $mask dev $ifname"
else
matchstr="net $net netmask $mask gw $gw"
fi
matchstr="net $net netmask $mask gw $gw"
fi
grep "$matchstr" $filename 2>&1 1>/dev/null
@@ -256,21 +237,11 @@ add_persistent_route()
if [ $? -eq 0 -a $foundflag -eq 1 ];then
foundflag=0
if [ $v6flag -eq 1 ];then
if [ "$gw" = "" -o "$gw" = "::" ] ; then
echo " up route -A inet6 add $net/$mask dev $ifname" >> $tempfile
echo " down route -A inet6 del $net/$mask dev $ifname" >> $tempfile
else
echo " up route -A inet6 add $net/$mask gw $gw" >> $tempfile
echo " down route -A inet6 del $net/$mask gw $gw" >> $tempfile
fi
echo " up route -A inet6 add $net/$mask gw $gw" >> $tempfile
echo " down route -A inet6 del $net/$mask gw $gw" >> $tempfile
else
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
echo " up route add -net $net netmask $mask dev $ifname" >> $tempfile
echo " down route del -net $net netmask $mask dev $ifname" >> $tempfile
else
echo " up route add -net $net netmask $mask gw $gw" >> $tempfile
echo " down route del -net $net netmask $mask gw $gw" >> $tempfile
fi
echo " up route add -net $net netmask $mask gw $gw" >> $tempfile
echo " down route del -net $net netmask $mask gw $gw" >> $tempfile
fi
fi
echo $LINE | grep "iface $ifname " 2>&1 1>/dev/null
@@ -284,21 +255,11 @@ add_persistent_route()
#the insert place is the last line of the config file
if [ $foundflag -eq 1 ];then
if [ $v6flag -eq 1 ];then
if [ "$gw" = "" -o "$gw" = "::" ] ; then
echo " up route -A inet6 add $net/$mask dev $ifname" >> $tempfile
echo " down route -A inet6 del $net/$mask dev $ifname" >> $tempfile
else
echo " up route -A inet6 add $net/$mask gw $gw" >> $tempfile
echo " down route -A inet6 del $net/$mask gw $gw" >> $tempfile
fi
echo " up route -A inet6 add $net/$mask gw $gw" >> $tempfile
echo " down route -A inet6 del $net/$mask gw $gw" >> $tempfile
else
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
echo " up route add -net $net netmask $mask dev $ifname" >> $tempfile
echo " down route del -net $net netmask $mask dev $ifname" >> $tempfile
else
echo " up route add -net $net netmask $mask gw $gw" >> $tempfile
echo " down route del -net $net netmask $mask gw $gw" >> $tempfile
fi
echo " up route add -net $net netmask $mask gw $gw" >> $tempfile
echo " down route del -net $net netmask $mask gw $gw" >> $tempfile
fi
fi
mv -f $tempfile $filename
@@ -312,22 +273,14 @@ add_persistent_route()
# ipv6 net
if echo $net | grep : 2>&1 1>/dev/null
then
if [ "$gw" = "" ] ; then
$gw = "::";
fi
filename="/etc/sysconfig/static-routes-ipv6";
route="$ifname $net/$mask $gw";
# $net/mask does not work with sed cmd
route1="$ifname $net\/$mask $gw";
else
filename="/etc/sysconfig/static-routes";
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
route="any net $net netmask $mask dev $ifname";
route1="any net $net netmask $mask dev $ifname";
else
route="any net $net netmask $mask gw $gw $ifname";
route1="any net $net netmask $mask gw $gw $ifname";
fi
route="any net $net netmask $mask gw $gw $ifname";
route1="any net $net netmask $mask gw $gw $ifname";
fi
if [ -f $filename ]; then
grep "$route" $filename 2>&1 1>/dev/null
@@ -387,23 +340,15 @@ rm_persistent_route()
# ipv6 net
if echo $net | grep : 2>&1 1>/dev/null
then
if [ $gw = "" -o $gw = "::" ] ; then
route="$net/$mask :: - $ifname";
route1="$net\/$mask :: - $ifname";
else
route="$net/$mask $gw - -";
route1="$net\/$mask $gw - -";
fi
route="$net/$mask $gw - -";
route1="$net\/$mask $gw - -";
else
if [ $gw = "" ] ; then
$gw = "0.0.0.0";
fi
if [ -n "$ifname" ]; then
route="$net $gw $mask $ifname";
route1="$net $gw $mask $ifname";
else
route="$net $gw $mask -";
route1="$net $gw $mask -";
route="$net $gw $mask";
route1="$net $gw $mask";
fi
fi
if [ -f $filename ]; then
@@ -431,18 +376,10 @@ rm_persistent_route()
echo $net | grep : 2>&1 1>/dev/null
#ipv6
if [ $? -eq 0 ];then
if [ $gw = "" -o $gw = "::" ] ; then
matchstr="$net/$mask dev $ifname"
else
matchstr="$net/$mask gw $gw"
fi
matchstr="$net/$mask gw $gw"
v6flag=1
else
if [ $gw = "" -o $gw = "0.0.0.0" ] ; then
matchstr="net $net netmask $mask dev $ifname"
else
matchstr="net $net netmask $mask gw $gw"
fi
matchstr="net $net netmask $mask gw $gw"
fi
grep "$matchstr" $filename
@@ -460,22 +397,12 @@ rm_persistent_route()
then
filename="/etc/sysconfig/static-routes-ipv6";
# $net/$mask does not work with sed
if [ "$gw" = "" -o "$gw" = "::" ] ; then
route="$ifname $net\/$mask ::"
route1="$ifname $net/$mask ::"
else
route="$ifname $net\/$mask $gw"
route1="$ifname $net/$mask $gw"
fi
route="$ifname $net\/$mask $gw"
route1="$ifname $net/$mask $gw"
else
filename="/etc/sysconfig/static-routes";
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
route="any net $net netmask $mask dev $ifname";
route1="any net $net netmask $mask dev $ifname";
else
route="any net $net netmask $mask gw $gw $ifname";
route1="any net $net netmask $mask gw $gw $ifname";
fi
route="any net $net netmask $mask gw $gw $ifname";
route1="any net $net netmask $mask gw $gw $ifname";
fi
if [ -f $filename ]; then
grep "$route" $filename 2>&1 1>/dev/null
@@ -504,22 +431,14 @@ if [ "$op" = "add" ]; then
if echo $net | grep : 2>&1 1>/dev/null
then
if [ "$(uname -s)" = "Linux" ]; then
if [ "$gw" = "" -o "$gw" = "::" ] ; then
cmd="ip -6 route add $net/$mask dev $ifname"
else
cmd="ip -6 route add $net/$mask via $gw"
fi
cmd="ip -6 route add $net/$mask via $gw"
else
# AIX TODO
cmd="ip -6 route add $net/$mask via $gw"
fi
else
if [ "$(uname -s)" = "Linux" ]; then
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
cmd="route add -net $net netmask $mask dev $ifname"
else
cmd="route add -net $net netmask $mask gw $gw"
fi
cmd="route add -net $net netmask $mask gw $gw"
else
cmd="route add -net $net -netmask $mask $gw"
fi
@@ -553,22 +472,14 @@ elif [ "$op" = "delete" ]; then
if echo $net | grep : 2>&1 1>/dev/null
then
if [ "$(uname -s)" = "Linux" ]; then
if [ "$gw" = "" -o "$gw" = "::" ] ; then
cmd="ip -6 route delete $net/$mask dev $ifname"
else
cmd="ip -6 route delete $net/$mask via $gw"
fi
cmd="ip -6 route delete $net/$mask via $gw"
else
# AIX TODO
cmd="ip -6 route delete $net/$mask via $gw"
fi
else
if [ "$(uname -s)" = "Linux" ]; then
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
cmd="route delete -net $net netmask $mask dev $ifname"
else
cmd="route delete -net $net netmask $mask gw $gw"
fi
cmd="route delete -net $net netmask $mask gw $gw"
else
cmd="route delete -net $net -netmask $mask $gw"
fi