Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
softlayer scripted install and sysclone both working with bonding
This commit is contained in:
commit
f4b1cce7cc
@ -0,0 +1,10 @@
|
||||
# AIX Bundle file for compiler runtime packages
|
||||
|
||||
I:xlC.aix61
|
||||
I:xlC.rte
|
||||
I:xlfrte
|
||||
I:xlfrte.aix61
|
||||
I:xlfrte.msg.en_US
|
||||
I:xlsmp.aix61.rte
|
||||
I:xlsmp.msg.en_US.rte
|
||||
I:xlsmp.rte
|
@ -89,7 +89,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%ifos linux
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then
|
||||
/etc/init.d/xcatd reload
|
||||
/etc/init.d/xcatd restart
|
||||
fi
|
||||
fi
|
||||
%endif
|
||||
|
@ -106,7 +106,7 @@ fi
|
||||
%ifos linux
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then
|
||||
/etc/init.d/xcatd reload
|
||||
/etc/init.d/xcatd restart
|
||||
fi
|
||||
fi
|
||||
%else
|
||||
|
@ -1539,9 +1539,9 @@ sub mkinstall
|
||||
foreach(@addfiles){
|
||||
$kcmdline .= " --- $rtftppath/$_";
|
||||
}
|
||||
}elsif ($pkvm) {
|
||||
$k = "$httpmethod://$instserver:$httpport$tftppath/vmlinuz";
|
||||
$i = "$httpmethod://$instserver:$httpport$tftppath/initrd.img";
|
||||
#}elsif ($pkvm) {
|
||||
# $k = "$httpmethod://$instserver:$httpport$tftppath/vmlinuz";
|
||||
# $i = "$httpmethod://$instserver:$httpport$tftppath/initrd.img";
|
||||
}else{
|
||||
$k = "$rtftppath/vmlinuz";
|
||||
$i = "$rtftppath/initrd.img";
|
||||
|
@ -1901,7 +1901,7 @@ sub make_files {
|
||||
}
|
||||
if ( $hasplugin ) {
|
||||
# Issue xcatd reload to load the new plugins
|
||||
system("/etc/init.d/xcatd reload");
|
||||
system("/etc/init.d/xcatd restart");
|
||||
$hasplugin=0;
|
||||
}
|
||||
|
||||
|
@ -1411,7 +1411,7 @@ sub addkit
|
||||
|
||||
if ( $hasplugin ) {
|
||||
# Issue xcatd reload to load the new plugins
|
||||
system("/etc/init.d/xcatd reload");
|
||||
system("/etc/init.d/xcatd restart");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1716,7 +1716,7 @@ sub rmkit
|
||||
|
||||
if ( $hasplugin ) {
|
||||
# Issue xcatd reload to load the new plugins
|
||||
system("/etc/init.d/xcatd reload");
|
||||
system("/etc/init.d/xcatd restart");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -612,7 +612,25 @@ sub rflash {
|
||||
# run the cmd on the host to flash the mic
|
||||
my @args = ("-s", "-v", "-e");
|
||||
push @args, "$::XCATROOT/sbin/flashmic";
|
||||
my $master = $request->{'_xcatdest'};
|
||||
# assume that all hosts are on the same network connected to this master
|
||||
# (otherwise, will need to move this call into loop above for each host
|
||||
# and build separate miccfg calls for each unique returned value from
|
||||
# my_ip_facing)
|
||||
my $ipfn = xCAT::NetworkUtils->my_ip_facing(@hosts[0]);
|
||||
if ($ipfn) {
|
||||
$master = $ipfn;
|
||||
} else {
|
||||
my $hostname = "";
|
||||
my $hostnamecmd = "/bin/hostname";
|
||||
my @thostname = xCAT::Utils->runcmd($hostnamecmd, 0);
|
||||
if ($::RUNCMD_RC = 0) {
|
||||
$hostname = "from server $thostname[0]";
|
||||
}
|
||||
xCAT::MsgUtils->message("E", {error=>["Cannot detect an active network interface $hostname to @hosts[0]."], errorcode=>["1"]}, $callback);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
push @args, ("-m", "$master");
|
||||
push @args, ("-p", "$tftpdir/xcat/miccfg");
|
||||
|
||||
@ -912,7 +930,23 @@ sub nodeset {
|
||||
# run the cmd on the host to configure the mic
|
||||
my @args = ("-s", "-v", "-e");
|
||||
push @args, "$::XCATROOT/sbin/configmic";
|
||||
my $master = $request->{'_xcatdest'};
|
||||
# assume that all hosts are on the same network connected to this master
|
||||
# (otherwise, will need to move this call into loop above for each host
|
||||
# and build separate miccfg calls for each unique returned value from
|
||||
# my_ip_facing)
|
||||
my $ipfn = xCAT::NetworkUtils->my_ip_facing(@hosts[0]);
|
||||
if ($ipfn) {
|
||||
$master = $ipfn;
|
||||
} else {
|
||||
my $hostname = "";
|
||||
my $hostnamecmd = "/bin/hostname";
|
||||
my @thostname = xCAT::Utils->runcmd($hostnamecmd, 0);
|
||||
if ($::RUNCMD_RC = 0) {
|
||||
$hostname = "from server $thostname[0]";
|
||||
}
|
||||
xCAT::MsgUtils->message("E", {error=>["Cannot detect an active network interface $hostname to @hosts[0]."], errorcode=>["1"]}, $callback);
|
||||
return;
|
||||
}
|
||||
push @args, ("-m", "$master");
|
||||
push @args, ("-p", "$tftpdir/xcat/miccfg");
|
||||
|
||||
|
@ -10,6 +10,10 @@ my $globaltftpdir = xCAT::TableUtils->getTftpDir();
|
||||
my %usage = (
|
||||
"nodeset" => "Usage: nodeset <noderange> osimage[=<imagename>]",
|
||||
);
|
||||
|
||||
my $httpmethod="http";
|
||||
my $httpport = "80";
|
||||
|
||||
sub handled_commands {
|
||||
return {
|
||||
nodeset => "noderes:netboot"
|
||||
@ -79,7 +83,21 @@ sub setstate {
|
||||
my %nrhash = %{shift()};
|
||||
my $linuximghash = shift();
|
||||
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
|
||||
if ($kern->{kcmdline} =~ /!myipfn!/) {
|
||||
#my $nodereshash=$noderestab->getNodesAttribs(\@nodes,['tftpdir','xcatmaster','nfsserver', 'servicenode']);
|
||||
if ($kern->{kernel} !~ /^$tftpdir/) {
|
||||
my $nodereshash = $nrhash{$node}->[0];
|
||||
my $installsrv;
|
||||
if ($nodereshash and $nodereshash->{nfsserver} ) {
|
||||
$installsrv = $nodereshash->{nfsserver};
|
||||
} elsif ($nodereshash->{xcatmaster}) {
|
||||
$installsrv = $nodereshash->{xcatmaster};
|
||||
} else {
|
||||
$installsrv = '!myipfn!';
|
||||
}
|
||||
$kern->{kernel} = "$httpmethod://$installsrv:$httpport$tftpdir/".$kern->{kernel};
|
||||
$kern->{initrd} = "$httpmethod://$installsrv:$httpport$tftpdir/".$kern->{initrd};
|
||||
}
|
||||
if ($kern->{kcmdline} =~ /!myipfn!/ or $kern->{kernel} =~ /!myipfn!/) {
|
||||
my $ipfn = xCAT::NetworkUtils->my_ip_facing($node);
|
||||
unless ($ipfn) {
|
||||
my $servicenodes = $nrhash{$node}->[0];
|
||||
@ -118,6 +136,8 @@ sub setstate {
|
||||
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($kern->{addkcmdline}) {
|
||||
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
|
||||
}
|
||||
@ -303,6 +323,8 @@ sub process_request {
|
||||
my $command = $request->{command}->[0];
|
||||
%breaknetbootnodes=();
|
||||
%normalnodes=();
|
||||
if ($::XCATSITEVALS{"httpmethod"}) { $httpmethod = $::XCATSITEVALS{"httpmethod"}; }
|
||||
if ($::XCATSITEVALS{"httpport"}) { $httpport = $::XCATSITEVALS{"httpport"}; }
|
||||
|
||||
my @args;
|
||||
my @nodes;
|
||||
@ -384,11 +406,9 @@ sub process_request {
|
||||
my $chaintab=xCAT::Table->new('chain',-create=>1);
|
||||
my $chainhash=$chaintab->getNodesAttribs(\@nodes,['currstate']);
|
||||
my $noderestab=xCAT::Table->new('noderes',-create=>1);
|
||||
my $nodereshash=$noderestab->getNodesAttribs(\@nodes,['tftpdir']);
|
||||
my $nodereshash=$noderestab->getNodesAttribs(\@nodes,['tftpdir','xcatmaster','nfsserver', 'servicenode']);
|
||||
my $mactab=xCAT::Table->new('mac',-create=>1);
|
||||
my $machash=$mactab->getNodesAttribs(\@nodes,['mac']);
|
||||
my $nrtab=xCAT::Table->new('noderes',-create=>1);
|
||||
my $nrhash=$nrtab->getNodesAttribs(\@nodes,['servicenode']);
|
||||
my $typetab=xCAT::Table->new('nodetype',-create=>1);
|
||||
my $typehash=$typetab->getNodesAttribs(\@nodes,['os','provmethod','arch','profile']);
|
||||
my $linuximgtab=xCAT::Table->new('linuximage',-create=>1);
|
||||
@ -415,7 +435,7 @@ sub process_request {
|
||||
my $linuximghash = $linuximghash = $linuximgtab->getAttribs({imagename => $osimgname}, 'boottarget', 'addkcmdline');
|
||||
|
||||
|
||||
($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir,$nrhash,$linuximghash);
|
||||
($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir,$nodereshash,$linuximghash);
|
||||
if ($rc) {
|
||||
$response{node}->[0]->{errorcode}->[0]= $rc;
|
||||
$response{node}->[0]->{errorc}->[0]= $errstr;
|
||||
|
@ -27,7 +27,8 @@ rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
|
||||
|
||||
#partition / --ondisk=/dev/mapper/ibmpkvm_vg_root-ibmpkvm_lv_root
|
||||
partition / --ondisk=/dev/sda
|
||||
network --bootproto dhcp
|
||||
#the --devicename must specify right now, but without network command, it can also work, so we delete it.
|
||||
#network --bootproto dhcp
|
||||
|
||||
%post
|
||||
touch "/startpost"
|
||||
|
@ -26,8 +26,6 @@ proc /proc proc rw 0 0
|
||||
sysfs /sys sysfs rw 0 0
|
||||
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
|
||||
${profile}_${arch} / tmpfs rw 0 1
|
||||
none /tmp tmpfs defaults,size=10m 0 2
|
||||
none /var/tmp tmpfs defaults,size=10m 0 2
|
||||
END
|
||||
|
||||
|
||||
|
@ -218,6 +218,25 @@ else
|
||||
fi
|
||||
cd /
|
||||
|
||||
function getdevfrommac() {
|
||||
boothwaddr=$1
|
||||
ip link show | while read line
|
||||
do
|
||||
dev=`echo $line | egrep "^[0-9]+: [0-9A-Za-z]+" | cut -d ' ' -f 2 | cut -d ':' -f 1`
|
||||
if [ "X$dev" != "X" ]; then
|
||||
devname=$dev
|
||||
fi
|
||||
|
||||
if [ "X$devname" != "X" ]; then
|
||||
hwaddr=`echo $line | egrep "^[ ]*link" | awk '{print $2}'`
|
||||
if [ "X$hwaddr" = "X$boothwaddr" ]; then
|
||||
echo $devname
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
if [ -z $STATEMNT ]; then
|
||||
for lf in /tmp/dhclient.*.lease; do
|
||||
netif=${lf#*.}
|
||||
@ -233,7 +252,7 @@ if [ -z $STATEMNT ]; then
|
||||
MACX=`ip link show $netdev | grep ether | awk '{print $2}'`
|
||||
elif [ ! -z "$BOOTIF" ]; then
|
||||
MACX=$BOOTIF
|
||||
ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'`
|
||||
ETHX=$(getdevfrommac $BOOTIF)
|
||||
fi
|
||||
|
||||
if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then
|
||||
|
@ -779,8 +779,8 @@ system("chroot $rootimg_dir depmod $kernelver");
|
||||
# the other one is for statelite
|
||||
|
||||
if ($dracutmode) {
|
||||
mkinitrd_dracut("statelite");
|
||||
mkinitrd_dracut("stateless");
|
||||
mkinitrd_dracut("statelite");
|
||||
} else {
|
||||
mkinitrd("statelite");
|
||||
mkinitrd("stateless");
|
||||
|
@ -14,7 +14,7 @@
|
||||
# -n hostname
|
||||
# Flags are used for check output:
|
||||
# -o expected output
|
||||
# -l logical operator
|
||||
# -O logical operator
|
||||
#
|
||||
# Expected result format is '{ANY:{ANY:content}}'
|
||||
# These steps are used to explain how to scan result
|
||||
@ -30,7 +30,7 @@ BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
use Getopt::Long;
|
||||
use Getopt::Long qw{:config bundling no_ignore_case};
|
||||
use Data::Dumper;
|
||||
use strict;
|
||||
my $help;
|
||||
@ -64,7 +64,7 @@ if (
|
||||
"c=s" => \$cert,
|
||||
"n=s" => \$hostname,
|
||||
"o=s" => \$output,
|
||||
"l=s" => \$loperator,
|
||||
"O=s" => \$loperator,
|
||||
"debug" => \$debug,
|
||||
)
|
||||
) {
|
||||
@ -181,8 +181,8 @@ sub usage
|
||||
print " testrestapi [-m method] [-r resource] [-t tocken]\n";
|
||||
print " [-h host] [-P port][-u user] [-p passwd]\n";
|
||||
print " [-d data] [-c cert] [-n hostname]\n";
|
||||
print " [-o expect_output] [-l logical_operator] [-debug]\n";
|
||||
print " [-debug]\n";
|
||||
print " [-o expect_output] [-O logical_operator] \n";
|
||||
print " [--debug]\n";
|
||||
print "\n";
|
||||
return;
|
||||
}
|
||||
@ -333,7 +333,7 @@ sub parse_json
|
||||
my @all = split /,/, $content;
|
||||
foreach my $n (@all) {
|
||||
$n =~ /\"(.*)\"/;
|
||||
$hash{$1} = 1;
|
||||
$hash{$1} = "restapiarray";
|
||||
}
|
||||
return \%hash;
|
||||
}
|
||||
@ -402,9 +402,13 @@ sub check_result
|
||||
my @actualvalue = split /:/, $actual; # @actualvalue = nodetype, arch, x86_64
|
||||
print_debug("begin to compare $expval and $actualvalue[$flag]");
|
||||
|
||||
if(($expval eq "restapiarray" ) and ($actualvalue[$flag] eq "restapiarray")){
|
||||
next;
|
||||
}
|
||||
|
||||
if(($expval eq $actualvalue[$flag]) or ($expval eq "ANY")) { #ANY =~ nodetype
|
||||
$flaghash{$actual} = "eq";
|
||||
} elsif (($expval =~ $actualvalue[$flag]) or ($expval eq "ANY")) {
|
||||
} elsif (($actualvalue[$flag] =~ $expval) or ($expval eq "ANY")) {
|
||||
$flaghash{$actual} = "match";
|
||||
} else {
|
||||
$flaghash{$actual} = "none";
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
PREFIXMASK#!/bin/sh
|
||||
# pmatch determines if 1st argument string is matched by 2nd argument pattern
|
||||
|
||||
pmatch ()
|
||||
@ -9,6 +9,18 @@ pmatch ()
|
||||
|
||||
return 1 # non-zero return code means string not matched by pattern
|
||||
}
|
||||
# converts netmask CIDR fromat to x.x.x.x mask value
|
||||
maskfromprefix ()
|
||||
{
|
||||
prefixlen=$1
|
||||
maskval=$((0xffffffff>>(32-prefixlen)<<(32-prefixlen)))
|
||||
mask1=$((maskval >> 24))
|
||||
mask2=$((maskval >> 16 & 0xff))
|
||||
mask3=$((maskval >> 8 & 0xff))
|
||||
mask4=$((maskval & 0xff))
|
||||
echo $mask1.$mask2.$mask3.$mask4
|
||||
NETMASK=$mask1.$mask2.$mask3.$mask4
|
||||
}
|
||||
|
||||
network_ipv4calc ()
|
||||
{
|
||||
@ -56,9 +68,12 @@ else
|
||||
echo "GATEWAY=$defgw" >> /etc/sysconfig/network
|
||||
fi
|
||||
fi
|
||||
for nic in `ifconfig -a|grep -B1 "inet addr"|awk '{print $1}'|grep -v inet|grep -v -- --|grep -v lo`; do
|
||||
IPADDR=`ifconfig $nic |grep "inet addr"|awk '{print $2}' |awk -F: '{print $2}'`
|
||||
NETMASK=`ifconfig $nic |grep "inet addr"|awk '{print $4}' |awk -F: '{print $2}'`
|
||||
for nic in `ip link |grep "BROADCAST" |awk '{print $2}' | sed s/://`; do
|
||||
IPADDRMASK=`ip addr show dev $nic | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1`
|
||||
IPADDR=`echo $IPADDRMASK | awk -F'/' '{print $1}'`
|
||||
PREFIXMASK=`echo $IPADDRMASK | awk -F'/' '{print $2}'`
|
||||
# converts to x.x.x.x mask value
|
||||
maskfromprefix $PREFIXMASK
|
||||
if ( pmatch $OSVER "ubuntu*" )
|
||||
then
|
||||
NETWORK=`network_ipv4calc $IPADDR $NETMASK`
|
||||
@ -69,7 +84,7 @@ for nic in `ifconfig -a|grep -B1 "inet addr"|awk '{print $1}'|grep -v inet|grep
|
||||
else
|
||||
gateway_line=""
|
||||
fi
|
||||
|
||||
# add info to interfaces file on ubuntu, TBD does unbuntu change to systemd, this will not exist
|
||||
cat >>/etc/network/interfaces <<EOF
|
||||
auto $nic
|
||||
iface $nic inet static
|
||||
@ -81,12 +96,14 @@ iface $nic inet static
|
||||
|
||||
|
||||
EOF
|
||||
# not ubuntu
|
||||
else
|
||||
if [ -f ${NICFILEPRE}${nic} ]
|
||||
then
|
||||
NICFILE=${NICFILEPRE}${nic}
|
||||
else
|
||||
mac=`ifconfig $nic|grep HWaddr|awk '{print $5}'|tr "[A-Z]" "[a-z]"`
|
||||
#mac=`ifconfig $nic|grep HWaddr|awk '{print $5}'|tr "[A-Z]" "[a-z]"`
|
||||
mac=`ip link show $nic | grep ether | awk '{print $2}'`
|
||||
NICFILE=${NICFILEPRE}eth-id-${mac}
|
||||
fi
|
||||
sed -i s/BOOTPROTO=dhcp/BOOTPROTO=static/ $NICFILE
|
||||
|
@ -47,7 +47,8 @@ then
|
||||
echo "KeyRegenerationInterval 0" >>/etc/ssh/sshd_config
|
||||
sed -i '/MaxStartups /'d /etc/ssh/sshd_config
|
||||
echo "MaxStartups 1024" >>/etc/ssh/sshd_config
|
||||
|
||||
sed -i 's/^\s*\(PermitRootLogin\s*\).*/\1yes/' /etc/ssh/sshd_config
|
||||
|
||||
if [ "$SETUPFORPCM" = "1" ];then
|
||||
sed -i '/PasswordAuthentication /'d /etc/ssh/sshd_config
|
||||
echo "PasswordAuthentication yes" >>/etc/ssh/sshd_config
|
||||
|
6
xCAT/postscripts/setupesx
Normal file → Executable file
6
xCAT/postscripts/setupesx
Normal file → Executable file
@ -43,9 +43,9 @@ cat >/tmp/esxcfg.sh <<EOF1
|
||||
# Configure ESX Server. You'll need to put your own IP address
|
||||
# in here. We assume eth0 is your nic. Change if needed.
|
||||
NIC=eth0
|
||||
IPADDRMASK=`ip addr show dev $NIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1`
|
||||
IPADDR=`echo $IPADDRMASK | awk -F'/' '{print $1}'`
|
||||
NETMASK=`echo $IPADDRMASK | awk -F'/' '{print $2}'`
|
||||
IPADDR=`ifconfig $NIC |grep "inet addr"|awk '{print $2}' |awk -F: '{print $2}' | head -1`
|
||||
NETMASK=`ifconfig $NIC |grep "inet addr"|awk '{print $4}' |awk -F: '{print $2}'`
|
||||
|
||||
#esxcfg-vswitch -U vmnic0 vSwitch0
|
||||
esxcfg-vswitch -L vmnic0 vSwitch0
|
||||
esxcfg-vswif -i \$IPADDR -n \$NETMASK vswif0
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
# Change these two parameters according to your requirements
|
||||
$::NFSRETRIES = 3;
|
||||
$::NFSTIMEO = 10;
|
||||
$::NFSTIMEO = 50;
|
||||
|
||||
# Candidate commands: mount, df, lsfs, nfs4cl showfs
|
||||
# Only the mount command could list all file systems
|
||||
|
@ -11,7 +11,8 @@ hostname $HOSTNAME
|
||||
|
||||
#write the config files, the device name may change after reboot
|
||||
#so use the dhcp for all interface
|
||||
device_names=`ifconfig -a | grep -i hwaddr | grep -i 'Ethernet' | grep -v usb| awk '{print $1}'`
|
||||
#device_names=`ifconfig -a | grep -i hwaddr | grep -i 'Ethernet' | grep -v usb| awk '{print $1}'`
|
||||
device_names=`ip link |grep "BROADCAST" |awk '{print $2}' | sed s/://`
|
||||
str_cfg_file=''
|
||||
if [ -d "/etc/sysconfig/network-scripts/" ];then
|
||||
#redhat
|
||||
|
Loading…
x
Reference in New Issue
Block a user