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

This commit is contained in:
xcat ubuntu build machine 2013-08-05 03:08:56 +00:00
commit 1de09a51c9
13 changed files with 1083 additions and 1358 deletions

View File

@ -1 +1 @@
2.8.2
2.8.3

View File

@ -18,8 +18,8 @@
# - Run this script from the local svn repository you just created. It will create the other
# directories that are needed.
# Usage: buildcore.sh BRANCH=<branch> [attr=value attr=value ...]
# BRANCH=<branch> - the branch within the git repo that should be built. This arg is required for git.
# Usage: buildcore.sh [attr=value attr=value ...]
# Before running buildcore.sh, you must change the local git repo to the branch you want built, using: git checkout <branch>
# PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release. This does not
# actually build xcat, just uploads the most recent snap build to https://sourceforge.net/projects/xcat/files/xcat/ .
# If not specified, a snap build is assumed, which uploads to https://sourceforge.net/projects/xcat/files/yum/
@ -70,10 +70,6 @@ if [ -z "$REL" ]; then
D=${curdir%/src/xcat-core}
REL=`basename $D`
fi
if [ "$REL" = "xcat-core" -a -z "$BRANCH" ]; then # using git but they didnt specify BRANCH
echo "Error: must specify BRANCH=<branch> when building a git repository. Exiting...."
exit 1
fi
OSNAME=$(uname)
if [ "$OSNAME" != "AIX" ]; then
@ -155,11 +151,10 @@ else
#echo "source=$source"
fi
# for the git case, set the current branch and also set REL (changing master to devel if necessary)
# for the git case, query the current branch and set REL (changing master to devel if necessary)
function setbranch {
git checkout $BRANCH
#REL=`git rev-parse --abbrev-ref HEAD`
REL=$BRANCH
#git checkout $BRANCH
REL=`git rev-parse --abbrev-ref HEAD`
if [ "$REL" = "master" ]; then
REL="devel"
fi

View File

@ -1024,7 +1024,7 @@ sub fork_fanout_dsh
&& (keys(%$targets_active) < $$options{'fanout'}))
{
my $user_target = shift @$targets_waiting;
# now add export NODE=nodename to the pre-command if not a device;
# now add export NODE=nodename to the pre-command, if not a device;
my $exportnode;
if (($$options{'devicetype'})) {
$exportnode="";
@ -2345,10 +2345,14 @@ sub config_dsh
}
}
else
{
# if not Mellanox, it does not need a config file
if (!($$options{'devicetype'} =~ /Mellanox/i)) {
my $rsp = {};
$rsp->{error}->[0] = "EMsgMISSING_DEV_CFG";
xCAT::MsgUtils->message('E', $rsp, $::CALLBACK);
$rsp->{error}->[0] = "The config file: $devicepath is missing";
xCAT::MsgUtils->message('E', $rsp, $::CALLBACK);
}
}
}
@ -5782,8 +5786,10 @@ sub bld_and_run_append
# that were rsyn'd to at least one node
if ($tmpappendfile eq $ps) {
my $parm="$appendfile:$filetoappend ";
$::xdcpappendparms .= $parm;
# check to see if the parameter is already in the list
if (!($::xdcpappendparms =~ /$parm/)) {
$::xdcpappendparms .= $parm;
}
$processappend=1;
}
@ -5919,8 +5925,10 @@ sub bld_and_run_merge
# that were rsyn'd to at least one node
if ($tmpmergefile eq $ps) {
my $parm="$mergefile:$filetomerge ";
$::xdcpmergeparms .= $parm;
# check to see if the parameter is already in the list
if (!($::xdcpmergeparms =~ /$parm/)) {
$::xdcpmergeparms .= $parm;
}
$processmerge=1;
}

View File

@ -19,9 +19,11 @@ BEGIN
use lib "$::XCATROOT/lib/perl";
use File::Basename;
use Getopt::Long;
use xCAT::MsgUtils;
use xCAT::Table;
use xCAT::NodeRange;
sub usage {
print basename($0)." usage:\n";
print " ".basename($0)." [-o|--osver] [-p|--profile] [-a|--arch] [-O|--osimage] [-c|--console] <noderange>\n"
@ -83,7 +85,10 @@ if($OSIMAGE){
&checkoption("[-O|--osimage] $OSIMAGE");
$rc=system("nodeset $noderange osimage=$OSIMAGE");
if ($rc) { die "nodeset failure" };
if ($rc) {
xCAT::MsgUtils->message("E","nodeset failure");
exit 1;
};
}else
{
@ -161,7 +166,8 @@ if($OSIMAGE){
}
if($rc){
die "nodeset failure";
xCAT::MsgUtils->message("E","nodeset failure");
exit 1;
}
# call "rsetboot" to set the boot order of the nodehm.mgt=ipmi nodes,for others, assume user has set the correct boot order before "rinstall"
@ -169,7 +175,10 @@ system("rsetboot $noderange net");
# call "rpower" to start the node provision process
$rc=system("rpower $noderange boot");
if ($rc) { die "rpower failure" };
if ($rc) {
xCAT::MsgUtils->message("E","rpower failure");
exit 1;
};
if (basename($0) =~ /rinstall/) {
@ -177,7 +186,8 @@ if (basename($0) =~ /rinstall/) {
# for rinstall, the -c|--console option can provide the remote console for only 1 node
if ($CONSOLE) {
if(scalar @allnodes ne 1){
die "rinstall [-c|--console] will only work if there is only one node in the noderange. See winstall(8) for consoles on multiple systems";
xCAT::MsgUtils->message("rinstall [-c|--console] will only work if there is only one node in the noderange. See winstall(8) for consoles on multiple systems");
exit 1;
}
exec("rcons $noderange");
}

View File

@ -10,6 +10,8 @@ B<tabdump> [I<table>]
B<tabdump> [I<-f> I<filename>] [I<table>]
B<tabdump> [I<-n> I<# of records>] [I<auditlog | eventlog>]
B<tabdump> [I<-w> I<attr>==I<val>] [B<-w> I<attr>=~I<val>] ...] [I<table>]
B<tabdump> [I<-w> I<attr>==I<val>] [B<-w> I<attr>=~I<val>] ...] [I<-f> I<filename>] [I<table>]
@ -38,6 +40,15 @@ Display usage message.
Show descriptions of the tables, instead of the contents of the tables. If a table name is also specified, descriptions of the columns (attributes) of the table will be displayed. Otherwise, a summary of each table will be displayed.
=item B<-n>
Shows the most recent number of entries as supplied on the -n flag from the auditlog or eventlog table.
=item B<-f>
File name or path to file in which to dump the table. Without this the table is dumped
to stdout. Using the -f flag allows the table to be dumped one record at a time. If tables are very large, dumping to stdout can cause problems such as running out of memory.
=item B<-w> I<'attr==val'> B<-w> I<'attr=~val'> ...
Use one or multiple -w flags to specify the selection string that can be used to select particular rows of the table. See examples.
@ -54,11 +65,6 @@ Operator descriptions:
!~ Select nodes where the attribute value matches the SQL NOT LIKE value.
=item B<-f>
File name or path to file in which to dump the table. Without this the table is dumped
to stdout. Using the -f flag allows the table to be dumped one record at a time. If tables are very large, dumping to stdout can cause problems such as running out of memory.
=back
=head1 RETURN VALUE
@ -111,6 +117,12 @@ tabdump -w 'audittime>2011-04-18 11:30:00' auditlog
=item *
To display the 10 most recent entries in the auditlog:
tabdump -n 10 auditlog
=item *
To see what tables exist in the xCAT database:
B<tabdump>

View File

@ -2512,19 +2512,26 @@ sub insert_dd {
} elsif ( grep (/LZMA compressed data/, @format)) {
$initrdfmt = "lzma";
} else {
my $rsp;
push @{$rsp->{data}}, "Could not handle the format of the initrd.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return ();
# check whether it can be handled by xz
$cmd = "xz -t $img";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Could not handle the format of the initrd.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return ();
} else {
$initrdfmt = "lzma";
}
}
if ($initrdfmt eq "gzip") {
$cmd = "gunzip -c $img > $dd_dir/initrd";
} elsif ($initrdfmt eq "lzma") {
if (! -x "/usr/bin/lzma") {
if (! -x "/usr/bin/xz") {
my $rsp;
push @{$rsp->{data}}, "The format of initrd for the target node is \'lzma\', but this management node has not lzma command.";
push @{$rsp->{data}}, "The format of initrd for the target node is \'lzma\', but this management node has not xz command.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return ();
}
@ -2698,7 +2705,7 @@ sub insert_dd {
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not generate the depdency for the drivers in the initrd.";
push @{$rsp->{data}}, "Handle the driver update failed. Could not generate the drivers depdency for $kernelver in the initrd.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
@ -3004,7 +3011,7 @@ sub insert_dd {
if ($initrdfmt eq "gzip") {
$cmd = "cd $dd_dir/initrd_img; find .|cpio -H newc -o|gzip -9 -c - > $dd_dir/initrd.img";
} elsif ($initrdfmt eq "lzma") {
$cmd = "cd $dd_dir/initrd_img; find .|cpio -H newc -o|lzma -C crc32 -9 > $dd_dir/initrd.img";
$cmd = "cd $dd_dir/initrd_img; find .|cpio -H newc -o|xz --format=lzma -C crc32 -9 > $dd_dir/initrd.img";
}
xCAT::Utils->runcmd($cmd, -1);
@ -3072,13 +3079,23 @@ sub insert_dd {
my $rsp;
if (@dd_list) {
push @{$rsp->{data}}, "Inserted the driver update disk:".join(',',@inserted_dd).".";
push @{$rsp->{data}}, "The driver update disk:".join(',',@inserted_dd)." have been injected to initrd.";
}
if (@driver_list) {
push @{$rsp->{data}}, "Inserted the drivers:".join(',', sort(@rpm_drivers))." from driver packages.";
} elsif (@rpm_list && ($Injectalldriver || @driver_list)) {
push @{$rsp->{data}}, "Inserted the drivers from driver packages:".join(',', sort(@rpm_list)).".";
# remove the duplicated names
my %dnhash;
foreach (@rpm_drivers) {
$dnhash{$_} = 1;
}
@rpm_drivers = keys %dnhash;
if (@rpm_list) {
if (@driver_list) {
push @{$rsp->{data}}, "The drivers:".join(',', sort(@rpm_drivers))." from ".join(',', sort(@rpm_list))." have been injected to initrd.";
} elsif ($Injectalldriver) {
push @{$rsp->{data}}, "All the drivers from :".join(',', sort(@rpm_list))." have been injected to initrd.";
}
}
xCAT::MsgUtils->message("I", $rsp, $callback);
return @inserted_dd;

View File

@ -7,6 +7,7 @@ BEGIN
use strict;
use lib "$::XCATROOT/lib/perl";
use File::Path;
use File::Copy;
use xCAT::MsgUtils;
use xCAT::TableUtils;
@ -127,6 +128,9 @@ sub geninitrd {
$tftpdir = $t_entry;
}
my $tftppath = "$tftpdir/xcat/osimage/$osimage";
unless (-d $tftppath) {
mkpath $tftppath;
}
if ($arch =~ /x86/) {
if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)/) {
$kernelpath = "$tftppath/vmlinuz";

View File

@ -254,6 +254,12 @@ sub add_hosts_content {
{
addnode $callback, $nodename, $ip, $ref->{hostnames}, $domain;
}
else
{
my $rsp;
push @{$rsp->{data}}, "Invalid IP Addr \'$_->{ip}\' for node \'$_->{node}\'.";
xCAT::MsgUtils->message("E", $rsp, $callback);
}
if (defined($ref->{otherinterfaces}))
{
addotherinterfaces $callback, $nodename, $ref->{otherinterfaces}, $domain;

View File

@ -1802,9 +1802,9 @@ sub insert_dd () {
}
# get the new kernel if it exists in the update distro
my @new_kernels = <$dd_dir/rpm/boot/vmlinuz*>;
my @new_kernels = <$dd_dir/rpm/boot/vmlinu*>;
foreach my $new_kernel (@new_kernels) {
if (-r $new_kernel && $new_kernel =~ /\/vmlinuz-(.*(x86_64|ppc64))$/) {
if (-r $new_kernel && $new_kernel =~ /\/vmlinu[zx]-(.*(x86_64|ppc64|default))$/) {
$new_kernel_ver = $1;
$cmd = "/bin/mv -f $new_kernel $dd_dir/rpm/newkernel";
xCAT::Utils->runcmd($cmd, -1);
@ -1928,34 +1928,32 @@ sub insert_dd () {
}
}
} # end of loading drivers from rpm packages
}
# Create the dir for driver update disk
mkpath("$dd_dir/initrd_img/cus_driverdisk");
# Create the dir for driver update disk
mkpath("$dd_dir/initrd_img/cus_driverdisk");
# insert the driver update disk into the cus_driverdisk dir
foreach my $dd (@dd_list) {
copy($dd, "$dd_dir/initrd_img/cus_driverdisk");
}
# insert the driver update disk into the cus_driverdisk dir
foreach my $dd (@dd_list) {
copy($dd, "$dd_dir/initrd_img/cus_driverdisk");
}
# Repack the initrd
# In order to avoid the runcmd add the '2>&1' at end of the cpio
# cmd, the echo cmd is added at the end
$cmd = "cd $dd_dir/initrd_img; find . -print | cpio -H newc -o > $dd_dir/initrd | echo";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update disk failed. Could not pack the hacked initrd.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return ();
}
# Repack the initrd
# In order to avoid the runcmd add the '2>&1' at end of the cpio
# cmd, the echo cmd is added at the end
$cmd = "cd $dd_dir/initrd_img; find . -print | cpio -H newc -o > $dd_dir/initrd | echo";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update disk failed. Could not pack the hacked initrd.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return ();
}
# zip the initrd
#move ("$dd_dir/initrd.new", "$dd_dir/initrd");
$cmd = "gzip -f $dd_dir/initrd";
xCAT::Utils->runcmd($cmd, -1);
# zip the initrd
#move ("$dd_dir/initrd.new", "$dd_dir/initrd");
$cmd = "gzip -f $dd_dir/initrd";
xCAT::Utils->runcmd($cmd, -1);
if ($arch =~/ppc/ || (@rpm_list && ($Injectalldriver || @driver_list))) {
if ($arch =~/ppc/) {
if (-r "$dd_dir/rpm/newkernel") {
# if there's new kernel from update distro, then use it
@ -1999,12 +1997,21 @@ sub insert_dd () {
my $rsp;
if (@dd_list) {
push @{$rsp->{data}}, "Inserted the driver update disk:".join(',', sort(@dd_list)).".";
push @{$rsp->{data}}, "The driver update disk:".join(',',@dd_list)." have been injected to initrd.";
}
if (@driver_list) {
push @{$rsp->{data}}, "Inserted the drivers:".join(',', sort(@rpm_drivers))." from driver packages.";
} elsif (@rpm_list && ($Injectalldriver || @driver_list)) {
push @{$rsp->{data}}, "Inserted the drivers from driver packages:".join(',', sort(@rpm_list)).".";
# remove the duplicated names
my %dnhash;
foreach (@rpm_drivers) {
$dnhash{$_} = 1;
}
@rpm_drivers = keys %dnhash;
if (@rpm_list) {
if (@driver_list) {
push @{$rsp->{data}}, "The drivers:".join(',', sort(@rpm_drivers))." from ".join(',', sort(@rpm_list))." have been injected to initrd.";
} elsif ($Injectalldriver) {
push @{$rsp->{data}}, "All the drivers from :".join(',', sort(@rpm_list))." have been injected to initrd.";
}
}
xCAT::MsgUtils->message("I", $rsp, $callback);

View File

@ -558,6 +558,7 @@ sub tabdump
my $OPTW;
my $VERSION;
my $FILENAME;
my $NUMBERENTRIES;
my $tabdump_usage = sub {
my $exitcode = shift @_;
@ -565,6 +566,7 @@ sub tabdump
push @{$rsp{data}}, "Usage: tabdump [-d] [table]";
push @{$rsp{data}}, " tabdump [table]";
push @{$rsp{data}}, " tabdump [-f <filename>] [table]";
push @{$rsp{data}}, " tabdump [-n <# of records>] [auditlog | eventlog]";
push @{$rsp{data}}, " tabdump [-w attr==val [-w attr=~val] ...] [table]";
push @{$rsp{data}}, " tabdump [-w attr==val [-w attr=~val] ...] [-f <filename>] [table]";
push @{$rsp{data}}, " tabdump [-?|-h|--help]";
@ -578,10 +580,14 @@ sub tabdump
if ($args) {
@ARGV = @{$args};
}
Getopt::Long::Configure("posix_default");
Getopt::Long::Configure("no_gnu_compat");
Getopt::Long::Configure("bundling");
if (!GetOptions(
'h|?|help' => \$HELP,
'v|version' => \$VERSION,
'n|lines=i' => \$NUMBERENTRIES,
'd' => \$DESC,
'f=s' => \$FILENAME,
'w=s@' => \$OPTW,
@ -601,8 +607,23 @@ sub tabdump
if ($HELP) { $tabdump_usage->(0); return; }
if (($NUMBERENTRIES) && ($DESC)) {
$cb->({error => "You cannot use the -n and -d flag together. ",errorcode=>1});
return 1;
}
if (($NUMBERENTRIES) && ($OPTW)) {
$cb->({error => "You cannot use the -n and -w flag together. ",errorcode=>1});
return 1;
}
if (($NUMBERENTRIES) && ($FILENAME)) {
$cb->({error => "You cannot use the -n and -f flag together. ",errorcode=>1});
return 1;
}
if (scalar(@ARGV)>1) { $tabdump_usage->(1); return; }
my %rsp;
# If no arguments given, we display a list of the tables
if (!scalar(@ARGV)) {
@ -626,9 +647,18 @@ sub tabdump
}
# get the table name
$table = $ARGV[0];
# if -n can only be the auditlog or eventlog
if ($NUMBERENTRIES) {
if (!( $table =~ /^auditlog/ ) && (!($table =~ /^eventlog/))){
$cb->({error => "$table table is not supported in tabdump -n. You may only use this option on the auditlog or the eventlog.",errorcode=>1});
return 1;
}
}
# do not allow teal tables
if ( $table =~ /^x_teal/ ) {
$cb->({error => "$table is not supported in tabdump. Use Teal maintenance commands. ",errorcode=>1});
$cb->({error => "$table table is not supported in tabdump. Use Teal maintenance commands. ",errorcode=>1});
return 1;
}
if ($DESC) { # only show the attribute descriptions, not the values
@ -665,6 +695,15 @@ sub tabdump
$cb->({error => "No such table: $table",errorcode=>1});
return 1;
}
#
# if tabdump -n <number of recs> auditlog|eventlog
#
if (defined $NUMBERENTRIES ) {
my $rc=tabdump_numberentries($table,$cb,$NUMBERENTRIES);
return $rc;
}
my $recs;
my @ents;
my @attrarray;
@ -717,6 +756,81 @@ sub tabdump
}
}
}
#
# display input number of records for the table requested tabdump -n
#
sub tabdump_numberentries {
my $table = shift;
my $cb = shift;
my $numberentries = shift; # either number of records to display
my $attrrecid="recid";
my $VERBOSE = shift;
my $rc=0;
my $tab = xCAT::Table->new($table);
unless ($tab) {
$cb->({error => "Unable to open $table",errorcode=>4});
return 1;
}
my $DBname = xCAT::Utils->get_DBName;
my @attribs = ($attrrecid);
my @ents=$tab->getAllAttribs(@attribs);
if (@ents) { # anything to process
# find smallest and largest recid, note table is not ordered by recid after
# a while
my $smallrid;
my $largerid;
foreach my $rid (@ents) {
if (!(defined $smallrid)) {
$smallrid=$rid;
}
if (!(defined $largerid)) {
$largerid=$rid;
}
if ($rid->{$attrrecid} < $smallrid->{$attrrecid}) {
$smallrid=$rid;
}
if ($rid->{$attrrecid} > $largerid->{$attrrecid}) {
$largerid=$rid;
}
}
my $RECID;
#determine recid to show all records after
$RECID= $largerid->{$attrrecid} - $numberentries ;
$rc=tabdump_recid($table,$cb,$RECID, $attrrecid);
} else {
my %rsp;
push @{$rsp{data}}, "Nothing to display from $table.";
$rsp{errorcode} = $rc;
$cb->(\%rsp);
}
return $rc;
}
# Display requested recored
# if rec id does not exist error
sub tabdump_recid {
my $table = shift;
my $cb = shift;
my $recid = shift;
my $rc=0;
# check which database so can build the correct Where clause
my $tab = xCAT::Table->new($table);
unless ($tab) {
$cb->({error => "Unable to open $table",errorcode=>4});
return 1;
}
my $DBname = xCAT::Utils->get_DBName;
my @recs;
my $attrrecid="recid";
# display the output
if ($DBname =~ /^DB2/) {
@recs=$tab->getAllAttribsWhere("\"$attrrecid\">$recid", 'ALL');
} else {
@recs=$tab->getAllAttribsWhere("$attrrecid>$recid", 'ALL');
}
output_table($table,$cb,$tab,\@recs);
return $rc;
}
# Display information from the daemon.
#
sub lsxcatd
@ -853,7 +967,7 @@ sub tabprune
push @{$rsp{data}}, " tabprune <tablename> [-V] -d <# of days>";
push @{$rsp{data}}, " tabprune [-h|--help]";
push @{$rsp{data}}, " tabprune [-v|--version]";
push @{$rsp{data}}, " tables supported:eventlog,auditlog,isnm_perf,isnm_perf_sum";
push @{$rsp{data}}, " tables supported:eventlog,auditlog";
push @{$rsp{data}}, " -d option only supported for eventlog,auditlog";
if ($exitcode) { $rsp{errorcode} = $exitcode; }
$cb->(\%rsp);
@ -952,7 +1066,7 @@ sub tabprune
if (($table eq "eventlog") || ($table eq "auditlog")) {
$attrrecid="recid";
} else {
if ($table eq "isnm_perf") { # if ISNM
if ($table eq "isnm_perf") { # if ISNM These tables are really not supported in 2.8 or later
$attrrecid="perfid";
} else {
$attrrecid="period"; # isnm_perf_sum table

File diff suppressed because it is too large Load Diff

View File

@ -1,532 +1,209 @@
#!/usr/bin/perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#!/bin/bash
# confignics postscript for configuring additional ethernet and ib NIC adapters.
# This module parses NIC environment variables containing data from the nics table
# for the specific node i.e.:
# NICNODE - the node name
# NICIPS - comma separated list of ips per NIC
# NICHOSTNAMESUFFIXES - comma spearated list of hostname suffixes per NIC
# NICTYPES - ethernet or infiniband
# NICCUSTOMSCRIPTS - script to configure nic, i.e. configeth or configib
# NICNETWORKS - network and subnetmask for the adapter.
str_dir_name=`dirname $0`
. $str_dir_name/xcatlib.sh
use strict;
use Socket;
use Data::Dumper;
# Only three args are supported for confignics:
# "-s" to allow the install nic to be configured. If not set
# then the install nic will not be configured.
# "--ibaports=x" to specify the number of ports for an ib adapter.
# This value will set in an environment variable
# prior to calling configib.
# "-r" unconfigure/remove existing configured nics. This flag will
# compare existing configured nics with nics in the nics table
# if nic doesn't exist in nics table then ifdown and remove
# config file (ifcfg-*)
my $ibaports = 1; # default to one port per ib adapter.
my $cfg_inst_nic = '';
my $rem_eth_nics = ''; # ethernet nics to remove if -r is set
my $rem_ib_nics = ''; # ib nics to remove if -r is set
my $rem_nics = 0;
my $arg ='';
while ($arg = shift(@ARGV)) {
if ( $arg eq "-s" ) {
$cfg_inst_nic = 1;
} elsif ( $arg =~ /--ibaports=(\d)$/) {
$ibaports = $1;
} elsif ( $arg eq "-r" ) {
$rem_nics = 1;
}
}
my $ibnics = '';
my $ethnics = '';
my $bridgednics = '';
my $nicips = $ENV{NICIPS};
my $niccustomscripts = $ENV{NICCUSTOMSCRIPTS};
my $nictypes = $ENV{NICTYPES};
my $xcatpostdir = "/xcatpost";
my %cust_script_nics = (); # hash to save nics specified in niccustomscripts
my $type = '';
my $nic = '';
my $MAC = $ENV{MACADDRESS};
my $inst_nic = '';
my $thisnode = $ENV{NODE};
# After discussing with Bruce, getting install nic in following order:
# 1) get NODE env var, resolve to ip and get related nic info, if not found:
# 2) Check if INSTALLNIC is set to specific nic then use that nic, if set to "mac"
# then use mac to get nic. If still not set then:
# 3) check PRIMARYNIC in similar manor as INSTALLNIC.
# If still not found then exit with error.
my $cfg_nic_ref_hash = {}; # set from get_install_nic
my $nic_to_cfg_ref_hash = {}; # set from env variables in mypostscript
$cfg_nic_ref_hash = get_current_nics();
$inst_nic = get_install_nic();
$bridgednics = get_bridged_nics();
# niccustomscripts specifies which NICS need to be configured.
# and which script to use to configure it.
# Strip NIC and customscript and then call the custom script with the NIC
# it is up to the custom script to verify information passed in NIC env vars.
# i.e. if customscript is "eth1:configeth eth1, eth2:configeth2"
# then first get eth1 for the nic and "configeth eth1" for the command to run"
# the do the same for eth2.
if ( defined $niccustomscripts && length $niccustomscripts > 0 ) {
system("logger -t xcat -p local4.info 'confignics $thisnode: processing custom scripts: $niccustomscripts '");
foreach my $customscript (split(/,/,$niccustomscripts)) {
my @script = ();
if ( $customscript =~ /!/ ) {
@script = split(/!/,$customscript);
} else {
@script = split(/:/,$customscript);
}
$cust_script_nics{$script[0]} = 1;
my @s = split(/ /,$script[1]);
# if installnic then verify that "-s" flag was passed in.
if (($inst_nic ne $script[0]) || (($inst_nic eq $script[0]) && $cfg_inst_nic)) {
runcmd("$script[1]");
system("logger -t xcat -p local4.info 'confignics $thisnode: executed custom script: $script[1] '");
}
}
}
# Get nic from nicips. If nic is in cust_script_nics hash then ignore this nic.
# otherwise, get nictype if set or determine type from nic name, eth* or en*
# implies ethernet, ib* implies infiniband.
#
# configib prefers to have ib adapters configured in one call for performance
# reasons. So add ib nics to a list and call configib outside the loop.
foreach my $nic_ips (split(/,/,$nicips)) {
$type = '';
my $type_found = 0;
$nic = '';
my @nic_and_ips = ();
if ( $nic_ips =~ /!/ ) {
@nic_and_ips = split(/!/,$nic_ips);
} else {
@nic_and_ips = split(/:/,$nic_ips);
}
$nic = $nic_and_ips[0];
# do not configure if nic is in the customscript hash
if ($cust_script_nics{$nic_and_ips[0]} == 1 ) {
system("logger -t xcat -p local4.info 'confignics $thisnode: nic $nic_and_ips[0] already configured through custom script '");
#the nics' information contain:
#1. ip address
#2. nic network
#3. nic type
#4. custom scripts
#all of them are saved by different variable
#this function can split the varable for each nic, and svae the information for each nic
#into an hash, the key is nic name, the value are all information, which joined by ','
function splitconfig(){
if [ ! "$1" ];then
return
fi
old_ifs=$IFS
IFS=$','
array_conf_temp=($1)
IFS=$old_ifs
for i in ${array_conf_temp[@]}
do
D=
if [ `echo $i | grep "!"` ];then
D="!"
else
D=":"
fi
key=`echo $i | cut -d"$D" -f 1`
str_temp_value=`echo $i | cut -d"$D" -f 2`
}
else {
# Find matching type for this nic
foreach my $nic_type (split(/,/,$nictypes)) {
my @nic_and_type = ();
if ( $nic_type =~ /!/ ) {
@nic_and_type = split(/!/,$nic_type);
} else {
@nic_and_type = split(/:/,$nic_type);
}
if ($nic_and_type[0] eq $nic ) {
$type = $nic_and_type[1];
# verify type is "ethernet" or "infiniband"
if ($type =~ /ethernet|infiniband/i ) {
$type_found = 1;
}
last;
}
}
# if no matching nic type then derive nic type from nic
if ( !$type_found ) {
if ( $nic =~ /(eth|en)\d+/i ) {
$type = "ethernet";
} elsif ($nic =~ /ib\d+/i ) {
$type = "infiniband";
}
}
if ("ethernet" eq lc($type)) {
# Ensure to only configure the install nic if the "-s" flag was set.
if (($inst_nic ne $nic) || (($inst_nic eq $nic) && $cfg_inst_nic)) {
if ($ethnics) {
$ethnics = $ethnics . "," . $nic;
} else {
$ethnics = $nic;
}
}
else {
system("logger -t xcat -p local4.info 'confignics $thisnode: Not configuring install nic $nic '");
}
} elsif ("infiniband" eq lc($type)) {
if ($ibnics) {
$ibnics = $ibnics . "," . $nic;
} else {
$ibnics = $nic;
}
} else {
system("logger -t xcat -p local4.info 'confignics $thisnode: unknown type $type for NIC: $nic '");
}
}
str_temp=$(hashget hash_defined_nics $key)
if [ -n "$str_temp" ];then
str_temp=$str_temp",${str_temp_value}"
else
str_temp="$str_temp_value"
str_all_nics=$str_all_nics"$key "
fi
hashset hash_defined_nics $key $str_temp
done
}
# set_nics_to_remove will compare $rem_nics for install nic, and bonded or bridged nics
# and set $rem_nics to only those $nics that should be unconfigured.
if ( $rem_nics ) {
set_nics_to_remove();
}
bool_cfg_inst_nic=0
str_inst_nic=''
str_ib_nics=''
str_os_type=`uname | tr 'A-Z' 'a-z'`
bool_remove=0
num_iba_ports=
str_all_nics=''
for arg in "$@"
do
if [ "$arg" = "-s" ];then
bool_cfg_inst_nic=1
elif [ "$arg" = "-r" ];then
bool_remove=1
elif [ "${arg:0:10}" = "--ibaports" ];then
num_iba_ports=${arg#--ibaports=}
fi
done
my $cmd = '';
logger -t xcat -p local4.info "confignics is called: config install nic:$bool_cfg_inst_nic, remove: $bool_remove, iba ports: $num_iba_ports"
echo "confignics on $NODE: config install nic:$bool_cfg_inst_nic, remove: $bool_remove, iba ports: $num_iba_ports"
# Call configeth now to configure all ethernet adapters in one call.
if ($ethnics) {
$cmd = "configeth -c $ethnics";
}
if ( $rem_eth_nics) {
if ($cmd) {
$cmd = $cmd . " -u $rem_eth_nics";
}
else {
$cmd = "configeth -u $rem_eth_nics";
}
}
if ($cmd) {
runcmd("$cmd");
system("logger -t xcat -p local4.info 'confignics $thisnode: executed $cmd '");
}
else {
system("logger -t xcat -p local4.info 'confignics $thisnode : no ethernet nics to configure'");
}
str_temp=''
if [ ! $INSTALLNIC ];then
str_temp="mac"
else
str_temp=$INSTALLNIC
fi
# Call configib now to configure all ib adapters in one call.
if ($ibnics) {
runcmd("NIC_IBNICS=$ibnics NIC_IBAPORTS=$ibaports configib");
system("logger -t xcat -p local4.info 'confignics $thisnode: executed script: configib for nics $ibnics '");
}
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 'confignics $thisnode: command $cmd failed with rc $rc: " . join('',@output) . "'");
my $errout= "confignics $thisnode: command $cmd failed with rc $rc.\n";
print $errout;
exit $rc;
}
print join("\n",@output),"\n";
}
if [ "$str_temp" = "mac" ];then
if [ "$str_os_type" = "aix" ];then
old_ifs=$IFS
IFS=$' '
str_temp=`ifconfig -l`
array_nicnames_temp=($str_temp)
IFS=$old_ifs
for temp_nic in ${array_nicnames_temp[@]}
do
entstat -t $temp_nic | grep -i "$MACADDRESS"
if [ $? -eq 0 ];then
str_inst_nic=$temp_nic
break
fi
done
else
str_inst_nic=`ifconfig -a | grep -i "$MACADDRESS" | awk '{print $1;}'`
fi
elif [ `echo $str_temp | grep -E "e(n|th)[0-9]+"` ];then
str_inst_nic=$str_temp
fi
sub get_current_nics {
my @ip_addr_array = `ip addr show`;
my $nic_name;
my $nic_type;
my $nic_state;
my $nic_slave;
my $nic_mac;
my $a_len = scalar(@ip_addr_array);
splitconfig $NICIPS
splitconfig $NICTYPES
splitconfig $NICNETWORKS
splitconfig $NICCUSTOMSCRIPTS
my %nics;
#get state of nic in "UP" status
#If bonded redhat then "SLAVE" or "MASTER" will be in the first line of stanza
#do not configure the loopback nic
if [ $bool_remove -eq 1 ];then
if [ "$str_os_type" = "aix" ];then
str_temp=`ifconfig -a | grep flags | grep -vi loopback | grep -v SALVE | grep -v MASTER | awk -F: {'print $1'}`
else
str_temp=`ip link show | grep -v link | grep -vi loopback | grep -v SALVE | grep -v MASTER | awk {'print $2'} | sed s/://`
fi
old_ifs=$IFS
IFS=$'\n'
array_nics_temp=($str_temp)
IFS=$old_ifs
for str_temp_nic in ${array_nics_temp[@]}
do
#the nic type should be ethernet
echo $str_temp_nic | grep -E "e(n|th)[0-9]+"
if [ $? -ne 0 ];then
continue
fi
if [ "$str_os_type" != "aix" ];then
brctl show 2>/dev/null | grep $str_temp_nic
#the nic belongs to a bridge, go to next
if [ $? -eq 0 ];then
continue
fi
fi
#the nic is defined this time
str_temp=$(hashget hash_defined_nics $str_temp_nic)
if [ -n "$str_temp" ];then
continue
fi
if [ "$str_temp_nic" = "$str_inst_nic" -a $bool_cfg_inst_nic -eq 0 ];then
continue
fi
#ignore the vlan interface
echo $str_temp_nic | grep "\."
if [ $? -eq 0 ];then
continue
fi
my $i = 0;
while ( $i < scalar(@ip_addr_array)) {
#print "array index $i: @ip_addr_array[$i]\n";
# check if line starts with "number: text:"
# if so then it is the start of a nic stanza which looks like:
# 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
# link/ether 5c:f3:fc:a8:bb:93 brd ff:ff:ff:ff:ff:ff
# inet 9.114.34.232/24 brd 9.114.34.255 scope global eth1
# inet6 fd55:faaf:e1ab:336:5ef3:fcff:fea8:bb93/64 scope global dynamic
# valid_lft 2591627sec preferred_lft 604427sec
# inet6 fd56::214:5eff:fe15:849b/64 scope global
# valid_lft forever preferred_lft forever
# inet6 fe80::5ef3:fcff:fea8:bb93/64 scope link
# valid_lft forever preferred_lft forever
logger -t xcat -p local4.info "confignics: remove nic $str_temp_nic"
echo "confignics on $NODE: remove nic $str_temp_nic"
configeth -r $str_temp_nic
done
fi
if ( $ip_addr_array[$i] =~ /^(\d+): / ) {
# get nic name
$ip_addr_array[$i] =~ /^\d+: ([^:].*):/;
$nic_name = $1;
old_ifs=$IFS
IFS=$' '
array_nics_temp=($str_all_nics)
IFS=$old_ifs
for key in ${array_nics_temp[@]}
do
key=`echo $key | sed 's/^ \+//' | sed 's/ \+$//'`
str_nic_type=
str_value=$(hashget hash_defined_nics $key)
if [ "$key" = "$str_inst_nic" -a $bool_cfg_inst_nic -eq 0 ];then
continue
fi
old_ifs=$IFS
IFS=$','
array_temp=($str_value)
IFS=$old_ifs
# get state of nic either "UP" if different, such as DOWN, not configured
# then assume state is DOWN.
if ($ip_addr_array[$i] =~ /,UP/ ) {
$nic_state = "UP";
}
else {
$nic_state = "DOWN";
}
if [ "${array_temp[3]}" ];then
logger -t xcat -p local4.info "confignics: processing custom scripts: ${array_temp[3]} for interface $key"
echo "confignics on $NODE: processing custom scripts: ${array_temp[3]} for interface $key"
${array_temp[3]}
else
if [ "${array_temp[1]}" ];then
str_nic_type=`echo ${array_temp[1]} | tr "[A-Z]" "[a-z]"`
else
if [ `echo $key | grep -E '(eth|en)[0-9]+'` ];then
str_nic_type="ethernet"
elif [ `echo $KEY | grep -E 'ib[0-9]+'` ];then
str_nic_type="infiniband"
fi
fi
# Check if this nic is part of a bridge or bonded interface. If bonded on
# redhat then "SLAVE" or "MASTER" will be in the first line of stanza
# inside <>.
#
# A bridged interface is a little different. The command, "brctl show", is used
# to show information about bridged interfaces. The subroutine get_bridged_nics()
# writes out $bridgednics which is a comma separated strings of bridged nics.
# If $nic_name matches a bridgednic then set nic_slave=1 for now to lump them
# with bonded nics for now since we will not unconfigure bridged or bonded nics.
#
$nic_slave = 0; # default to 0
if ($ip_addr_array[$i] =~ /SLAVE/ ) {
$nic_slave = 1;
}
if ($ip_addr_array[$i] =~ /MASTER/ ) {
$nic_slave = 1;
}
if ($nic_name =~ /$bridgednics/) {
$nic_slave = 1;
}
if [ $str_nic_type = "ethernet" ];then
logger -t xcat -p local4.info "confignics: call 'configeth $key ${array_temp[0]} ${array_temp[2]}'"
echo "confignics on $NODE: call 'configeth $key ${array_temp[0]} ${array_temp[2]}'"
configeth $key ${array_temp[0]} ${array_temp[2]}
elif [ $str_nic_type = "infiniband" ];then
if [ $str_ib_nics ];then
str_ib_nics=$str_ib_nics","$key
else
str_ib_nics=$key
fi
else
logger -t xcat -p local4.info "confignics: unknown type $str_nic_type for NIC: $key"
echo "confignics on $NODE: unknown type $str_nic_type for NIC: $key"
fi
fi
done
# example output shows type is "link/ether" for ethernet or
# "link/infiniband" for ib. Look ahead to next line for this.
$ip_addr_array[$i+1] =~ /^\s+link\/([a-z]+) /;
$nic_type = $1;
$i++;
# CHECK: it looks like there could be a usb nic ethernet adapter. Need to investigate
# if more needs to be done for that such as it is handled differently.
# If value is not "ether" or "infiniband" then continue on to next stanza
if ($nic_type ne "ether" && $nic_type ne "infiniband") {
next;
}
my @line = split(' ', $ip_addr_array[$i]);
$nic_mac = $line[1];
# move on to next line and loop through all lines for additional information or
# and until the line is the start of a new stanza.
# This is where things get dicey and may need enhancements:
# inet 70.0.0.182/24 brd 70.0.0.255 scope global eth5
# indicates an ipv4 address with a netmask of /24, a broadcast address,
# scope global nicname (eth5). If this was an aliased ip then nicname would be eth5:1 or such.
# inet6 fd55:faaf:e1ab:336:3640:b5ff:fe89:66c4/64 scope global dynamic
# it appears that valid ips have "scope global"
$i++;
# print "NIC: $nic_name, TYPE: $nic_type, MAC: $nic_mac SLAVE: $nic_slave, STATE: $nic_state \n";
$nics{$nic_name} = {};
$nics{$nic_name}->{state} = $nic_state;
$nics{$nic_name}->{mac} = $nic_mac;
$nics{$nic_name}->{slave} = $nic_slave;
$nics{$nic_name}->{type} = $nic_type;
$nics{$nic_name}->{ips} = [];
while ($i < scalar(@ip_addr_array) && !($ip_addr_array[$i] =~ /^(\d+): / ) ) {
# $ip_proto - is either inet or inet6
# $ip_mask is "ipaddr or ipv6addr"/netmask and possibly "brd broadcastip"
# $scope has the scope (global, link, site, host) if global or site then
# only data after scope is the nic "label", i.e. eth0, eth5:1.
# note that "tentative" may appear but is not a label.
# On RH for an ip alias with same netmask/subnet then line will be:
# inet 11.0.0.80/16 brd 11.0.255.255 scope global secondary eth2:1
my ($ip_proto, $ip_mask, $scope) =
$ip_addr_array[$i]=~/\s+(inet|inet6)\s+(.+)\s+scope\s+(.+)$/;
if ( $ip_proto =~ /inet/ ) { # line contains inet or inet6. Process info
my ($nic_ip_mask, $junk) = split(' ', $ip_mask);
my ($nic_ip, $nic_mask) = split('\/', $nic_ip_mask);
my ($sc, $label, $more_label) = split(' ', $scope);
if ( $sc ne "link" ) { # this is a valid one to keep
if ($label eq "secondary") {
$label = $more_label;
}
#print "\tPROTO: $ip_proto, IP: $nic_ip, MASK: $nic_mask, SCOPE: $sc, LABEL:$label\n";
push @{$nics{$nic_name}->{ips}},{ip => $nic_ip, netmask => $nic_mask, label => $label };
}
}
$i++;
}
next; # next nic stanza or end of file.
}
$i++;
}
return \%nics;
}
sub get_install_nic {
# get "NODE" from env, resolve to ip and determine which nic it belongs
# to. This should be the "base" nic, i.e. eth0, eth1 - not eth1:1
# To do: Need to find equivalent methods for an ipv6 address.
my $node = $ENV{NODE};
my $installnic = $ENV{INSTALLNIC};
my $primarynic = $ENV{PRIMARYNIC};
my $i_p_nic = ''; # variable to hold installnic or primarynic value
my @ip_info;
my $inst_ip;
my @addr_info;
my %hash = $cfg_nic_ref_hash;
@addr_info = gethostbyname($node);
@ip_info = unpack("C4", $addr_info[4]); # Is this only for ipv4 or does this include ipv6 as well?
$inst_ip = join(".",@ip_info);
# get ip output, compare ip_addr and determine nic.
foreach my $k (keys %$cfg_nic_ref_hash) {
my $nic = $cfg_nic_ref_hash->{$k};
my $ips = $nic->{'ips'};
if (defined($ips)) {
foreach my $ip_info (@$ips) {
my $ip = $ip_info->{'ip'};
# print " IP:$ip";
if ($ip eq $inst_ip) {
return $k;
}
}
}
}
# install nic not found from configured nics. Try to get install nic from environment
# variables.
if ($installnic) {
$i_p_nic = $installnic;
}
elsif ($primarynic) {
$i_p_nic = $primarynic;
}
if (!$i_p_nic) {
system("logger -t xcat -p local4.info 'confignics $thisnode: installnic and primarynic are not defined', use 'mac' by default.");
$i_p_nic = "mac";
}
if ($i_p_nic =~ /(e(n|th)\d+)$/ ) {
$inst_nic = $1;
} elsif ($i_p_nic eq "mac") {
# determine nic from mac. Get all NICs and their mac addresses from ifconfig
# and compare that with MACADDR.
my @ifcfg_info = split(/\n/,`ifconfig -a | grep HWaddr | awk '{print \$1,\$5;}'`);
foreach my $nic_mac (@ifcfg_info) {
my @nicmac = split(/ /,$nic_mac);
if (uc($nicmac[1]) eq uc($MAC)) {
$inst_nic = $nicmac[0];
last;
}
}
} else { # INSTALLNIC not set or is not known
system("logger -t xcat -p local4.info 'confignics $thisnode: install nic $inst_nic not known '");
}
return;
}
# subroutine compares configured nic hash with defined nics from nics table.
# If configured nic is not in nics table and it is not the install nic then
# set global variables $rem_eth_nics and $rem_ibnics.
# This subroutine needs to be called after get_current_nics() and after parsing
# custom scripts and nics to be configured.
sub set_nics_to_remove {
my $do_not_remove;
my %hash = $cfg_nic_ref_hash;
foreach my $nic_key (keys %$cfg_nic_ref_hash) {
my $nic = $cfg_nic_ref_hash->{$nic_key};
# check if $nic is in $ethnics, $ibnics, $cust_script_nics or is $inst_nic.
# if not then add to appropriate list to be removed.
if ($nic_key eq $inst_nic) {
}
elsif ($ethnics =~ /$nic_key/ ) {
}
elsif ($ibnics =~ /$nic_key/) {
}
elsif ($cust_script_nics{$nic_key}) {
}
else {
# now check if nic is part of bonded or bridged interface.
#
if ( $nic->{slave} ) {
system("logger -t xcat -p local4.info 'confignics $thisnode: Not removing $nic_key. It is part of a bonded or bridged interface. '");
}
elsif ( $nic_key =~ /@/ ) {
# For a vlan interface on redhat the nic name appears as
# nic.vlan@nic, i.e. eth0.30@eth0 and in this case the label will be
# eth0.30. So verify that there is no "@" in the nic name (should we
# also check that the label contains a "."?)
my ($label, $base) = split(/@/,$nic_key);
# need to make sure that $base is not added to nics to be removed.
# add both the label and base to $do_not_remove.
if ($do_not_remove) {
$do_not_remove = $label . "," . $base;
}
else {
$do_not_remove = $do_not_remove . "," . $label . "," . $base;
}
}
else {
# finally have a nic to remove. Determine if it is ib or eth
if ($nic->{type} eq "ether") {
if ( $rem_eth_nics ) {
$rem_eth_nics = $rem_eth_nics . "," . $nic_key;
}
else {
$rem_eth_nics = $nic_key;
}
}
if ($nic->{type} eq "infiniband") {
if ( $rem_ib_nics ) {
$rem_ib_nics = $rem_ib_nics . "," . $nic_key;
}
else {
$rem_ib_nics = $nic_key;
}
}
}
}
}
}
# Bridged interfaces do not show differently than ethernet nics in
# the "ip addr show" command. Therefore the command "brctl show" is
# used to get the bridged nics.
# This subroutine will set the global variable $bridgednics.
# brctl show output is similar to:
# bridge name bridge id STP enabled interfaces
# virbr0 8000.5254004a3d54 yes virbr0-nic
# first line is skipped as it is the heading. The values specified by
# bridge name and interfaces show up as nics in the "ip addr show" output.
# Therefore need to put both of these # in the $bridgednics string
# because we don't want to remove either of those interfaces.
sub get_bridged_nics {
# first, ensure that brctl is installed. If not then just exit since there will be no
# bridged interfaces.
my $i;
if ( -e "/usr/sbin/bcrtl" ) {
my @bridge_out = `brctl show`;
my $lines = scalar(@bridge_out);
for ($i=1; $i < $lines ; $i++) {
# brctl ouput puts half tabs '\cI' and line feed \cJ' chars in
# the ouput. Need to convert these to spaces then split.
# Get first and last values for nics.
$bridge_out[$i] =~ s/\cI/ /g;
my @br = split(/ /,$bridge_out[$i]);
if ( $bridgednics ) {
$bridgednics = $bridgednics . "," . $br[0] . "," . $br[-1];
}
else {
$bridgednics = $br[0] . "," . $br[-1];
}
}
}
}
if [ -n "$str_ib_nics" ];then
logger -t xcat -p local4.info "confignics: executed script: configib for nics: $str_ib_nics, ports: $num_iba_ports"
echo "confignics on $NODE: executed script: configib for nics: $str_ib_nics, ports: $num_iba_ports"
NIC_IBNICS=$str_ib_nics NIC_IBAPORTS=$num_iba_ports configib
else
if [ $bool_remove -eq 1 ];then
logger -t xcat -p local4.info "confignics: executed script: 'configib -u' to remove all ib nics and configuration files"
echo "confignics on $NODE: executed script: 'configib -r' to remove all ib nics and configuration files"
configib
fi
fi

View File

@ -0,0 +1,17 @@
function hashencode(){
local map="$1"
echo `echo $map | sed 's/\./xDOTx/g' | sed 's/:/xCOLONx/g' | sed 's/,/:xCOMMAx/g'`
}
function hashset(){
local hashname="hash${1}${2}"
local value=$3
hashname=$(hashencode $hashname)
eval "${hashname}='${value}'"
}
function hashget(){
local hashname="hash${1}${2}"
hashname=$(hashencode $hashname)
eval echo "\$${hashname}"
}