From ac121cabbed3de591fbdd0436e267a27b58c79ce Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 22 Aug 2013 16:04:33 +0800 Subject: [PATCH 001/110] support genesis on ppc64, compile on Fedora 20 ppc64 --- xCAT-genesis-builder/buildrpm | 26 ++++++++++++++++++++++++-- xCAT-genesis-builder/install | 2 +- xCAT-genesis-builder/xcat-cmdline.sh | 17 +++++++++++++++-- 3 files changed, 40 insertions(+), 5 deletions(-) mode change 100644 => 100755 xCAT-genesis-builder/xcat-cmdline.sh diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index 498bfa271..287a6ecd3 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -10,7 +10,15 @@ DIR=`dirname $0` DIR=`readlink -f $DIR` # get the input files for dracut in the right place -DRACUTMODDIR=/usr/share/dracut/modules.d/97xcat +# Fedora 20 ppc64 uses /usr/lib/dracut/modules.d +# CentOS 7 probably uses /usr/lib/dracut/modules.d also +if [ -f "/usr/share/dracut/modules.d/97xcat" ] +then + DRACUTMODDIR=/usr/share/dracut/modules.d/97xcat +else + DRACUTMODDIR=/usr/lib/dracut/modules.d/97xcat +fi + mkdir -p $DRACUTMODDIR cp $DIR/* $DRACUTMODDIR # For ppc64 platform, needs to remove some files, @@ -22,6 +30,20 @@ if [ `uname -m` = "ppc64" ]; then sed -i 's/\/usr\/lib\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.13/' $DRACUTMODDIR/install sed -i 's/\/lib\/libgcc_s.so.1/\/lib64\/libgcc_s.so.1/' $DRACUTMODDIR/install sed -i 's/\/lib\/libtinfo.so.5.7/\/lib64\/libtinfo.so.5.7/' $DRACUTMODDIR/install + # following changes are required on Fedora 20 ppc64 + sed -i 's/\/lib64\/libnss_dns-2.12.so/\/lib64\/libnss_dns-2.18.so/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libc.so.6/\/lib64\/libc.so.6/' $DRACUTMODDIR/install + sed -i 's/\/lib\/ld-linux.so.2/\/lib64\/ld-2.18.so/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libdl.so.2/\/lib64\/libdl.so.2/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libm.so.6/\/lib64\/libm.so.6/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libpthread.so.0/\/lib64\/libpthread.so.0/' $DRACUTMODDIR/install + sed -i 's/\/lib64\/libncurses.so.5.7/\/lib64\/libncurses.so.5.9/' $DRACUTMODDIR/install + sed -i 's/\/usr\/lib64\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.19/' $DRACUTMODDIR/install + sed -i 's/\/lib64\/libtinfo.so.5.7/\/lib64\/libtinfo.so.5.9/' $DRACUTMODDIR/install + sed -i 's/\/usr\/lib64\/libsasl2.so.2/\/usr\/lib64\/libsasl2.so.3/' $DRACUTMODDIR/install + sed -i 's/\/lib64\/libnss_dns-2.12.so/\/lib64\/libnss_dns-2.18.so/' $DRACUTMODDIR/install + sed -i 's/\/lib\/terminfo\/l\/linux/\/usr\/share\/terminfo\/l\/linux/g' $DRACUTMODDIR/install + sed -i 's/\/lib\/terminfo\/v\/vt100/\/usr\/share\/terminfo\/v\/vt100/g' $DRACUTMODDIR/install fi if [ "$HOSTOS" = "mcp" ]; then @@ -55,7 +77,7 @@ if [ "$HOSTOS" = "mcp" ]; then else echo Creating the initramfs in /tmp/xcatgenesis.$$.rfs using dracut ... fi -dracut -m "xcat base" -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION +dracut -m "xcat base" -N -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION echo Expanding the initramfs into /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs ... cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index e335b9941..26f1ac2c3 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget openssl tar mstflint ipmitool cpio gzip lsmod ethtool modprobe touch echo cut wc +dracut_install wget openssl tar mstflint ipmitool cpio gzip lsmod ethtool modprobe touch echo cut wc bash dracut_install netstat # broadcom update requires dracut_install uniq # mellanox update requires dracut_install grep ip hostname /usr/bin/awk egrep grep dirname expr diff --git a/xCAT-genesis-builder/xcat-cmdline.sh b/xCAT-genesis-builder/xcat-cmdline.sh old mode 100644 new mode 100755 index 0b60f30d9..1188095f5 --- a/xCAT-genesis-builder/xcat-cmdline.sh +++ b/xCAT-genesis-builder/xcat-cmdline.sh @@ -12,10 +12,23 @@ echo sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin >> /etc/passwd echo rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin >> /etc/passwd echo rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin >> /etc/passwd echo qemu:x:107:107:qemu user:/:/sbin/nologin >> /etc/passwd -echo '[ -e $NEWROOT/proc ]' > /initqueue-finished/xcatroot.sh +# Fedora 20 ppc64 uses /lib/dracut/hooks/initqueue/finished +# CentOS 7 probably uses /lib/dracut/hooks/initqueue/finished also +if [ -d "/initqueue-finished" ]; then + echo '[ -e $NEWROOT/proc ]' > /initqueue-finished/xcatroot.sh +else + #echo 'if [ -e /proc ]; then /bin/doxcat; fi' > /lib/dracut/hooks/initqueue/finished/xcatroot.sh + echo '[ -e /proc ]' > /lib/dracut/hooks/initqueue/finished/xcatroot.sh +fi mkdir /dev/cgroup mount -t cgroup -o cpu,memory,devices cgroup /dev/cgroup -udevd --daemon +# Fedora 20 ppc64 does not udevd +# CentOS 7 probably does not have udevd either +if [ -f "/sbin/udevd" ]; then + udevd --daemon +else + /usr/lib/systemd/systemd-udevd --daemon +fi udevadm trigger mkdir -p /var/lib/dhclient/ mkdir -p /var/log From 33fd485628a1d0b0582f5890cbacfbcc902148a4 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 20 Aug 2014 23:26:17 -0700 Subject: [PATCH 002/110] fulfill the requirement of defect #4242 In physical rhel7 env,set installnic=ethx can not provision compute node. --- xCAT-server/lib/perl/xCAT/Postage.pm | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index a8a1d8633..de2425e89 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -1865,6 +1865,38 @@ sub getPostScripts } + #for redhat 7, append "disableconsistentNICrename" to default postscripts + #if "net.ifnames=0" is specified in kcmdline/addkcmdline of node or osimage + my $tftpdir = xCAT::TableUtils::getTftpDir(); + my $osimagetab=xCAT::Table->new('osimage',-create=>1); + my $osimgent = $osimagetab->getAttribs({imagename => $osimgname },'osvers'); + my $os = $osimgent->{'osvers'}; + my $nrret = $::GLOBAL_TAB_HASH{noderes}{$node}; + my $netboot = $nrret->{'netboot'}; + + if( ($os =~ "rhel7*") || ($os =~ "rhels7*") ) + { + my $nodecfg; + if($netboot eq "grub2") + { + $nodecfg="$tftpdir/boot/grub2/$node"; + }elsif($netboot eq "xnba") + { + $nodecfg="$tftpdir/xcat/xnba/nodes/$node"; + + }elsif($netboot eq "pxe") + { + $nodecfg="$tftpdir/pxelinux.cfg/$node"; + + } + + my $rc=system("grep net.ifnames=0 $nodecfg >/dev/null 2>&1"); + if($rc ==0) + { + $result .= "disableconsistentNICrename\n"; + } + } + return $result; } From 79ad455b31d196c3d308ac8d76331a84bafa8188 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 21 Aug 2014 00:07:58 -0700 Subject: [PATCH 003/110] fix defect #4253 [DEV] the substitution bug in post.xcat --- xCAT-server/share/xcat/install/scripts/post.xcat | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 10d406998..44fdf2912 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -94,7 +94,7 @@ cd /xcatpost export PATH=$PATH:/xcatpost # use the run_ps subroutine to run the postscripts -TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript` +TMP=`sed "/^#\s*postscripts-start-here/,/^#\s*postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript` echo " # global value to store the running status of the postbootscripts,the value is non-zero if one postbootscript failed return_value=0 @@ -125,12 +125,12 @@ run_ps () { " > /xcatpost/mypostscript echo "$TMP" >> /xcatpost/mypostscript -TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript` +TMP=`sed "/^#\s*postbootscripts-start-here/,/^#\s*postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript` echo "$TMP" > /xcatpost/mypostscript #save the postboot scripts to /xcatpost/mypostscript.post -TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /xcatpost/mypostscript` +TMP=`sed "/^#\s*postscripts-start-here/,/^#\s*postscripts-end-here/ d" /xcatpost/mypostscript` echo "$TMP" > /xcatpost/mypostscript.post chmod 755 /xcatpost/mypostscript.post @@ -173,7 +173,7 @@ EOF chmod 755 /opt/xcat/xcatdsklspost #only run the prebooot scripts here -TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript` +TMP=`sed "/^#\s*postbootscripts-start-here/,/^#\s*postbootscripts-end-here/ d" /xcatpost/mypostscript` echo "$TMP" > /xcatpost/mypostscript export NODE=#TABLE:nodelist:THISNODE:node# From c7037487974958bc6f58d306803e8c252c8c86e2 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Thu, 21 Aug 2014 00:25:29 -0700 Subject: [PATCH 004/110] remove lowpower option for rpower from Usage --- perl-xCAT/xCAT/Usage.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 5bbb4ba2e..9ef3b006b 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -33,7 +33,7 @@ my %usage = ( LPAR(with HMC) specific: rpower [on|off|reset|stat|state|boot|of|sms|softoff] CEC(using Direct FSP Management) specific: - rpower [on|onstandby|off|stat|state|lowpower|resetsp] + rpower [on|onstandby|off|stat|state|resetsp] Frame(using Direct FSP Management) specific: rpower [stat|state|rackstandby|exit_rackstandby|resetsp] LPAR(using Direct FSP Management) specific: From 7ae7479c3ae2d230201d6a9e6fade1e70b2264a6 Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 21 Aug 2014 03:42:12 -0400 Subject: [PATCH 005/110] support xcat genesis on ppc64: check if the dmidecode exists before run dmidecode --- xCAT-genesis-scripts/bin/doxcat | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 7e84e097c..3048dee6f 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -176,9 +176,11 @@ ntpd -g -x # rv 0 state does not work with the new ntp versions #(while ! ntpq -c "rv 0 state"|grep 'state=4' > /dev/null; do sleep 1; done; hwclock --systohc) & (while [ "`ntpq -c \"rv 0 offset\" | grep \"offset=\" | awk -F \"=\" '{print $2}' | awk -F \".\" '{print $1}' | sed s/-//`" -ge 1000 ]; do sleep 1; done; hwclock --systohc) & -if dmidecode|grep IPMI > /dev/null; then - modprobe ipmi_si - modprobe ipmi_devintf +if [ -f "/usr/sbin/dmidecode" ]; then + if dmidecode|grep IPMI > /dev/null; then + modprobe ipmi_si + modprobe ipmi_devintf + fi fi DEVICE=$bootnic export DEVICE From d92fc99a3a1639cc0b768139433eefb0f4e9c5f3 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 21 Aug 2014 02:03:35 -0700 Subject: [PATCH 006/110] add template and pkglist of kvm.rhel7 --- .../share/xcat/install/rh/kvm.rhel7.pkglist | 13 ++ .../share/xcat/install/rh/kvm.rhel7.tmpl | 154 ++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 xCAT-server/share/xcat/install/rh/kvm.rhel7.pkglist create mode 100644 xCAT-server/share/xcat/install/rh/kvm.rhel7.tmpl diff --git a/xCAT-server/share/xcat/install/rh/kvm.rhel7.pkglist b/xCAT-server/share/xcat/install/rh/kvm.rhel7.pkglist new file mode 100644 index 000000000..7a6779c4b --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/kvm.rhel7.pkglist @@ -0,0 +1,13 @@ +#Please make sure there is a space between @ and group name +wget +ntp +nfs-utils +net-snmp +rsync +yp-tools +openssh-server +util-linux-ng +net-tools +libvirt +screen +qemu-kvm diff --git a/xCAT-server/share/xcat/install/rh/kvm.rhel7.tmpl b/xCAT-server/share/xcat/install/rh/kvm.rhel7.tmpl new file mode 100644 index 000000000..b32f1f01d --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/kvm.rhel7.tmpl @@ -0,0 +1,154 @@ +# +#cmdline + +lang en_US +#KICKSTARTNET# + +# +# Where's the source? +# nfs --server hostname.of.server or IP --dir /path/to/RH/CD/image +# +#nfs --server #XCATVAR:INSTALL_NFS# --dir #XCATVAR:INSTALL_SRC_DIR# + +%include /tmp/repos + +#device ethernet e100 +keyboard "us" + +# +# Clear the MBR +# +zerombr + +# +# Wipe out the disk +# +clearpart --all --initlabel +#clearpart --linux +#key --skip + +# +# Customize to fit your needs +# + +#XCAT_PARTITION_START# +#No RAID +#/boot really significant for this sort of setup nowadays? +#part /boot --size 50 --fstype ext3 +%include /tmp/partitioning +#part swap --size 1024 +#part / --size 1 --grow --fstype ext4 +#XCAT_PARTITION_END# + +#RAID 0 /scr for performance +#part / --size 1024 --ondisk sda +#part swap --size 512 --ondisk sda +#part /var --size 1024 --ondisk sdb +#part swap --size 512 --ondisk sdb +#part raid.01 --size 1 --grow --ondisk sda +#part raid.02 --size 1 --grow --ondisk sdb +#raid /scr --level 0 --device md0 raid.01 raid.02 + +#Full RAID 1 Sample +#part raid.01 --size 50 --ondisk sda +#part raid.02 --size 50 --ondisk sdb +#raid /boot --level 1 --device md0 raid.01 raid.02 +# +#part raid.11 --size 1024 --ondisk sda +#part raid.12 --size 1024 --ondisk sdb +#raid / --level 1 --device md1 raid.11 raid.12 +# +#part raid.21 --size 1024 --ondisk sda +#part raid.22 --size 1024 --ondisk sdb +#raid /var --level 1 --device md2 raid.21 raid.22 +# +#part raid.31 --size 1024 --ondisk sda +#part raid.32 --size 1024 --ondisk sdb +#raid swap --level 1 --device md3 raid.31 raid.32 +# +#part raid.41 --size 1 --grow --ondisk sda +#part raid.42 --size 1 --grow --ondisk sdb +#raid /scr --level 1 --device md4 raid.41 raid.42 + +# +# bootloader config +# --append +# --useLilo +# --md5pass +# +bootloader + +# +# install or upgrade +# +install + +# +# text mode install (default is graphical) +# +text + +# +# firewall +# +firewall --disabled + +# +# Select a zone +# Add the --utc switch if your hardware clock is set to GMT +# +#timezone US/Hawaii +#timezone US/Pacific +#timezone US/Mountain +#timezone US/Central +#timezone US/Eastern +timezone --utc "#TABLE:site:key=timezone:value#" + +# +# Don't do X +# +skipx + + +# +# To generate an encrypted root password use: +# +# perl -e 'print crypt("blah","Xa") . "\n";'p +# openssl passwd -apr1 -salt xxxxxxxx password +# +# where "blah" is your root password. +# +#rootpw --iscrypted XaLGAVe1C41x2 +#rootpw XaLGAVe1C41x2 --iscrypted +rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password# + +# +# NIS setup: auth --enablenis --nisdomain sensenet +# --nisserver neptune --useshadow --enablemd5 +# +# OR +auth --useshadow --enablemd5 + + +# +# SE Linux +# +selinux --disabled + +# +# Reboot after installation +# +reboot + +# +#end of section +# +%packages +#INCLUDE_DEFAULT_PKGLIST# +%end +%pre +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh.rhel7# +%end +%post +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat# +%end From 77625c7fe90e80aa117dbe9052313e6d2b42e906 Mon Sep 17 00:00:00 2001 From: mellor Date: Thu, 21 Aug 2014 16:14:29 -0400 Subject: [PATCH 007/110] rewrote getxcatdocs to work with Allura wiki on sourceforge --- xCAT-client/bin/getxcatdocs | 353 +++++++++++++++++++----------------- 1 file changed, 188 insertions(+), 165 deletions(-) diff --git a/xCAT-client/bin/getxcatdocs b/xCAT-client/bin/getxcatdocs index c9f0bcc8b..5ba806aa7 100755 --- a/xCAT-client/bin/getxcatdocs +++ b/xCAT-client/bin/getxcatdocs @@ -1,191 +1,214 @@ #!/usr/bin/perl -# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html -# Downloads/converts the xCAT docs on the sourceforge wiki to local HTML and PDF. + +# Downloads/converts the xCAT docs on the sourceforge Allura wiki to local HTML and PDF. # This script is not dependent on other xCAT code, so you can copy it to a machine # that has internet access to run it. Before running this command, you must have -# wget, python, and pisa installed. See: http://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documentation_Pages#Converting_Wiki_Pages_to_HTML_and_PDFs . +# curl, pandoc, and latex installed. See: http://sourceforge.net/p/xcat/wiki/Editing_and_Downloading_xCAT_Documentation/#converting-wiki-pages-to-html-and-pdfs + # Note: do not use the --upload option, unless your machine has authority to write to http://xcat.sourceforge.net/doc/ . -# You also need to set $UPLOADUSER to your sourceforge user. +# You also need to set $UPLOADUSER to your sourceforge user: +my $UPLOADUSER = 'mellor'; -#BEGIN -#{ -# $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; -#} use strict; -#use lib "$::XCATROOT/lib/perl"; -#use xCAT::Utils; use Getopt::Long; -#use File::Path; use Cwd; -#use Data::Dumper; +use JSON; + +# URL for the xCAT Allura wiki API markdown on SourceForge +my $sf_url='http://sourceforge.net/rest'; +my $wiki_url=$sf_url.'/p/xcat/wiki/'; + +# Update this list if you group any xcat docs on a separate page such that they +# are no longer linked from the main doc page: +my @indexdocs = ('XCAT_Documentation', + 'Power_775_Cluster_Documentation', + 'Highly_Available_Management_Node', + 'Mixed_Cluster_Support', + 'IBM_HPC_Stack_in_an_xCAT_Cluster'); -# Update this list if you group any xcat docs on a separate page such that they are no longer linked from the -# main doc page. -my @indexdocs = ('XCAT_Documentation', 'Power_775_Cluster_Documentation', 'Highly_Available_Management_Node', 'Mixed_Cluster_Support', 'IBM_HPC_Stack_in_an_xCAT_Cluster'); -#my $VERSION; my $HELP; my $UPLOAD; my $UPLOADONLY; +my $IGNOREERRORS; +my $SINGLE_DOC; my $VERBOSE; - -my $usage = sub { - my $exitcode = shift @_; - print "Usage: getxcatdocs [-?|-h|--help] [-v|--verbose] [-u|--upload] [--uploadonly] []\n"; - exit $exitcode; -}; - -# Process the cmd line args -Getopt::Long::Configure("bundling"); -#Getopt::Long::Configure("pass_through"); -Getopt::Long::Configure("no_pass_through"); -if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'u|upload' => \$UPLOAD, 'uploadonly' => \$UPLOADONLY )) { $usage->(1); } - -if ($HELP) { $usage->(0); } - -#if ($VERSION) { - #print xCAT::Utils->Version(), "\n"; -# exit; -#} - -if ($^O =~ /^aix/i) { die "Error: this command is not yet supported on AIX.\n"; } - -my $destdir = scalar(@ARGV) ? $ARGV[0] : '.'; -chdir($destdir) or die "Can not cd to $destdir: $!\n"; -#my $docdir = $ENV{'PWD'}; - -# Download the HTML docs and convert them all to pdfs -my @dir; -if (!$UPLOADONLY) { - @dir = gethtmldocs('html'); - convert2pdf('pdf', \@dir); -} - - -# tar/compress -my $date=`date +%Y%m%d%H%M`; -chop $date; -my $docname="xcat-docs-snap$date.tar.gz"; -#system('pwd'); -my $cmd = "tar -zcf $docname html pdf 2>&1"; -verbose($cmd); -system($cmd) == 0 or die "Error running $cmd: $!, rc=$?"; - -# Optionally upload the tarball to sourceforge -if ($UPLOAD || $UPLOADONLY) { - my $UPLOADUSER = 'bp-sawyers'; - my $count = 1; - #my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:htdocs/doc/'; - my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/doc/'; - print "$cmd\n"; - while ($count<=5 && system("$cmd 2>&1")) { $count++; } -} -exit 0; - sub verbose { if ($VERBOSE) { print shift, "\n"; } } +my $usage = sub { + my $exitcode = shift @_; + print "Usage: getxcatdocs [-?|-h|--help] \n"; + print "Usage: getxcatdocs [-v|--verbose] [-u|--upload] [--uploadonly] [-i|--ignoreerrors] []\n"; + print "Usage: getxcatdocs [-v|--verbose] [-d|--doc single_doc] [-i|--ignoreerrors] []\n"; + exit $exitcode; +}; + + +# Main processing + + # Process the cmd line args + Getopt::Long::Configure("bundling"); + #Getopt::Long::Configure("pass_through"); + Getopt::Long::Configure("no_pass_through"); + if (!GetOptions( + 'h|?|help' => \$HELP, + 'v|verbose' => \$VERBOSE, + 'u|upload' => \$UPLOAD, + 'uploadonly' => \$UPLOADONLY, + 'i|ignoreerrors' => \$IGNOREERRORS, + 'd|doc=s' => \$SINGLE_DOC )) + { $usage->(1); } + + if ($HELP) { $usage->(0); } + + if ($^O =~ /^aix/i) { die "Error: this command is not yet supported on AIX.\n"; } + + my $destdir = scalar(@ARGV) ? $ARGV[0] : '.'; + chdir($destdir) or die "Can not cd to $destdir: $!\n"; + + my $json = JSON->new(); + + if ($SINGLE_DOC) { + my $scurlcmd = "curl -X GET $wiki_url$SINGLE_DOC"; + verbose($scurlcmd); + my $pagecontent = `$scurlcmd`; + if ($? && !$IGNOREERRORS) { die "error encountered in $scurlcmd \n";} + my $pageout = $json->decode($pagecontent); + foreach my $pageatt (@{$pageout->{attachments}}) { + my $swgetcmd = "wget $pageatt->{url}"; + verbose($swgetcmd); + system($swgetcmd); + if ($? && !$IGNOREERRORS) { die "error encountered in $swgetcmd \n";} + } + convert_doc($SINGLE_DOC,$pageout->{text},'.','.','.','.'); + exit; + } + + # Download the HTML docs and convert them all to pdfs + if (!$UPLOADONLY) { gethtmldocs('md','html','pdf','images'); } + + # tar/compress + my $date=`date +%Y%m%d%H%M`; + chop $date; + my $docname="xcat-docs-snap$date.tar.gz"; + chdir($destdir) or die "Can not cd to $destdir: $!\n"; + + my $cmd = "tar -zcf $docname html pdf images 2>&1"; + verbose($cmd); + system($cmd) == 0 or die "Error running $cmd: $!, rc=$?"; + + # Optionally upload the tarball to sourceforge + if ($UPLOAD || $UPLOADONLY) { + my $count = 1; + #my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:htdocs/doc/'; + my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/doc/'; + print "$cmd\n"; + while ($count<=5 && system("$cmd 2>&1")) { $count++; } + } + exit 0; + + -# Download all of the html docs from several "index" docs sub gethtmldocs { - my $dir = shift; - my $savedir = getcwd(); - #File::Path::make_path($dir); - mkdir($dir); - chdir($dir); - #system('pwd'); - unlink <*>; # delete all the files in the dir, in case they previously ran this - #system('ls'); - - my $indexes = ''; - foreach my $index (@indexdocs) { - $indexes .= qq('http://sourceforge.net/apps/mediawiki/xcat/index.php?title=$index&printable=yes' ); - } - print "Downloading the xCAT wiki documentation to $dir, from: $indexes ...\n"; - runwget($indexes); - - # Remove the funny chars from the links to other docs and rename the docs - #my $sedcmd = q(sed -i 's/ tags, but converting them does not seem to do any good anyway. - my $cmd = q(sed -i 's/; + unlink <$htmldir/*>; + unlink <$pdfdir/*>; + unlink <$imagedir/*>; + + print "\nDownloading and converting the xCAT wiki document list from $wiki_url ...\n"; + my @doclist; + my %donelist; + foreach my $index (@indexdocs) { + if ( $donelist{$index} ) { next; } + my $indexcmd = "curl -X GET $wiki_url/$index"; + verbose($indexcmd); + my $indexmd = `$indexcmd`; + if ($? && !$IGNOREERRORS) { die "error encountered in $indexcmd \n";} + my $jsout = $json->decode($indexmd); + push @doclist,@{$jsout->{related_artifacts}}; + foreach my $att (@{$jsout->{attachments}}) { + my $iwgetcmd = "wget -P $imagedir/ $att->{url}"; + verbose($iwgetcmd); + system($iwgetcmd); + if ($? && !$IGNOREERRORS) { die "error encountered in $iwgetcmd \n";} + } + convert_doc($index,$jsout->{text},$mddir,$htmldir,$pdfdir,$imagedir); + $donelist{$index}=1; + } + print "\nDownloading and converting the xCAT wiki documentation to $savedir ...\n"; + + foreach my $doc (@doclist) { + my $doc_name = $doc; + $doc_name =~ s/\/.*\/(.+)\/$/$1/; + if ( $donelist{$doc_name} ) { next; } + verbose("processing $doc"); + my $doc_url=$sf_url.$doc; + my $curlcmd = "curl -X GET $doc_url"; + verbose($curlcmd); + my $pagecontent = `$curlcmd`; + my $pageout = $json->decode($pagecontent); + foreach my $pageatt (@{$pageout->{attachments}}) { + my $wgetcmd = "wget -P $imagedir/ $pageatt->{url}"; + system($wgetcmd); + if ($? && !$IGNOREERRORS) { die "error encountered in $wgetcmd \n";} + } + convert_doc($doc_name,$pageout->{text},$mddir,$htmldir,$pdfdir,$imagedir); + $donelist{$doc_name}=1; + } + + chdir($savedir); } +sub convert_doc { + my $doc_name = shift; + my $doc_text = shift; + my $mddir = shift; + my $htmldir = shift; + my $pdfdir = shift; + my $imagedir = shift; + + ## Make image refs local + $doc_text =~ s/\!\[\]\(.+\/(.+)\.png\)/\!\[\]\(\.\.\/$imagedir\/$1\.png\)/g; + $doc_text =~ s/\!\[\]\(.+\/(.+)\.PNG\)/\!\[\]\(\.\.\/$imagedir\/$1\.PNG\)/g; + $doc_text =~ s/\!\[\]\(.+\/(.+)\.jpg\)/\!\[\]\(\.\.\/$imagedir\/$1\.jpg\)/g; + open(MDFILE, ">$mddir/${doc_name}.md") or die; + print MDFILE $doc_text; + close MDFILE; + + my $pandoccmd = "pandoc -s --toc $mddir/${doc_name}.md -o $htmldir/${doc_name}.html"; + verbose($pandoccmd); + system($pandoccmd); + if ($? && !$IGNOREERRORS) { die "error encountered in $pandoccmd \n";} + # This rename is probably a hack, but I didn't want to take the time to + # figure out what was going on: + # pandoc does different processing if target filetype is html + # but all internal refs only work in browser when there is no html filetype + rename "$htmldir/${doc_name}.html","$htmldir/${doc_name}"; + + $doc_text =~ s/\!\[\]\(\.\.\/$imagedir\/(.+)\.png\)/\!\[\]\(\.\/$imagedir\/$1\.png\)/g; + $doc_text =~ s/\!\[\]\(\.\.\/$imagedir\/(.+)\.PNG\)/\!\[\]\(\.\/$imagedir\/$1\.PNG\)/g; + $doc_text =~ s/\!\[\]\(\.\.\/$imagedir\/(.+)\.jpg\)/\!\[\]\(\.\/$imagedir\/$1\.jpg\)/g; + open(MDFILE, ">$mddir/${doc_name}.md") or die; + print MDFILE $doc_text; + close MDFILE; + my $pandoccmd2 = "pandoc --toc $mddir/${doc_name}.md -o $pdfdir/${doc_name}.pdf"; + verbose($pandoccmd2); + system($pandoccmd2); + if ($? && !$IGNOREERRORS) { die "error encountered in $pandoccmd2 \n";} -# Convert to pdf -sub convert2pdf { - my ($dir, $files) = @_; - my $savedir = getcwd(); - #File::Path::make_path($dir); - mkdir($dir); - chdir($dir); - if (system('which xhtml2pdf >/dev/null 2>&1')) { die "xhtml2pdf is not installed. See http://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documentation_Pages#Converting_Wiki_Pages_to_HTML_and_PDFs .\n"; } - unlink <*>; # delete all the files in the dir, in case they previously ran this - foreach my $file (@$files) { - #if ($file =~ /^index.php\?title=MediaWiki:/ || $file eq 'index.php?title=XCAT_Documentation') { next; } - if ($file eq 'XCAT_Documentation') { next; } - #my ($docname) = $file =~ /^index.php\?title=(.+)$/; - $file =~ s/\.html$//; - print "Converting $file to PDF format...\n"; - my $url = 'http://sourceforge.net/apps/mediawiki/xcat/index.php?title=' . $file . '&printable=yes'; - my $destfile = "$file.pdf"; - my $cmd = "xhtml2pdf '$url' '$destfile' "; - runh2p($cmd); - } - chdir($savedir); } - -# Run the wget cmd and filter out some of the silly output -sub runwget { - my $index = shift; - # options we might consider: --html-extension --restrict-file-names=windows --cut-dirs=3 - # options that do not work: --relative - #my $rejectlist = q('*title=Special:*,*title=Talk:*,*title=-&*,*title=HowTos,*title=Main_Page,*title=MediaWiki:*,*title=Release_Notes,*title=Wish_List_for_xCAT_2,*&action=edit*,*&action=history*,*&printable=yes*,*&oldid=*,index.html,opensearch_desc.php,xcat,login.php,support'); - my $rejectlist = q('*title=Special:*,*title=Talk:*,*title=-&*,*title=HowTos,*title=Main_Page,*title=Release_Notes,*title=Wish_List_for_xCAT_2,*&action=edit*,*&action=history*,*&printable=yes*,*&oldid=*,index.html,opensearch_desc.php,xcat,login.php,support'); - my $cmd = qq(wget --recursive --convert-links --no-verbose --progress=bar --level=1 --page-requisites --no-parent --no-host-directories --no-directories --no-clobber --execute robots=off --post-data='printable=yes' --reject $rejectlist $index); - verbose($cmd); - open(OUT, "$cmd 2>&1 |") || die "can't fork $cmd: $!\n"; - while () { - if (/URL:https*:\/\/sourceforge\.net.+\s+->\s+\"(\S+)\"\s+\[/) { print "Downloaded $1.\n"; } - else { print; } - } - close OUT || print "Error running $cmd: $! $?\n"; -} - -# Run the xhtml2pdf cmd and filter out some of the silly output -sub runh2p { - my $cmd = shift; - verbose($cmd); - open(OUT, "$cmd 2>&1 |") || die "can't fork $cmd: $!\n"; - while () { - next if /DeprecationWarning:\sthe sets module is deprecated/; - next if /from sets import ImmutableSet/; - next if /^\s*import sets\s*$/; - next if /^Converting\ssourceforge.net/; - print; - } - close OUT || print "Error running $cmd: $! $?\n"; -} From 812fc4b3bc325f5b9b795ea5ef08eaaf2aa99a90 Mon Sep 17 00:00:00 2001 From: mellor Date: Thu, 21 Aug 2014 19:03:46 -0400 Subject: [PATCH 008/110] man page updates for rewritten getxcatdocs to work with Allura wiki on sourceforge --- xCAT-client/pods/man1/getxcatdocs.1.pod | 28 ++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/xCAT-client/pods/man1/getxcatdocs.1.pod b/xCAT-client/pods/man1/getxcatdocs.1.pod index 08c5ad28c..cbe7a1ad4 100644 --- a/xCAT-client/pods/man1/getxcatdocs.1.pod +++ b/xCAT-client/pods/man1/getxcatdocs.1.pod @@ -4,19 +4,23 @@ B - downloads the xCAT documentation and converts to HTML and PDF =head1 SYNOPSIS -B [B<-?> | B<-h> | B<--help> | B<-v> | B<--version>] [I] +B [B<-?> | B<-h> | B<--help>] +B [B<-v> | B<--verbose>] [I] +B [B<-v> | B<--verbose>] [B<-d> | B<--doc> I] [I] =head1 DESCRIPTION The B command downloads the xCAT documentation from the wiki and converts it to both HTML and PDF. This enables reading the documentation when you do not have internet access. Note that this command does not -download/convert the entire xCAT wiki - only the "official" xCAT documentation linked from https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Documentation . +download/convert the entire xCAT wiki - only the "official" xCAT documentation linked from http://sourceforge.net/p/xcat/wiki/XCAT_Documentation. -If I is specified, B will put the converted documentation in that directory, in 2 sub-directories: html, pdf. -Otherwise, it will put it in the current directory (in the same two sub-directories). +If I is specified, B will put the converted documentation in that directory, in 3 sub-directories: html, pdf, images. +Otherwise, it will put it in the current directory (in the same three sub-directories). -B uses wget to do the download the documents and xhtml2pdf to convert them to PDF. To install xhtml2pdf, see: -https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documentation_Pages#Converting_Wiki_Pages_to_HTML_and_PDFs . +If B<--doc> I is specified, only that one wiki page will be downloaded and converted. + +B uses curl to run the Allura wiki API to download the document markdown text, and Pandoc with LaTex them to PDF. You must have all of these functions installed to run B. See: +http://sourceforge.net/p/xcat/wiki/Editing_and_Downloading_xCAT_Documentation/#converting-wiki-pages-to-html-and-pdfs =head2 Limitations: @@ -26,24 +30,24 @@ https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documen This command does not run on AIX or Windows. -=item * - -The conversion to HTML does not yet honor the xCAT wiki style sheet. - =back =head1 OPTIONS =over 10 -=item B<-v|--version> +=item B<-v|--verbose> -Command Version. +Run the command in verbose mode. =item B<-?|-h|--help> Display usage message. +=item B<-d|--doc> I + +Run this command for a single document only. If you get errors about Official-xcat-doc.png not found, either download this image directly from http://sourceforge.net/p/xcat/wiki/XCAT_Documentation/attachment/Official-xcat-doc.png or run B first. + =back =head1 RETURN VALUE From 4753c86b3835b6050631827b7cee4c3e2214808d Mon Sep 17 00:00:00 2001 From: Lei Ai Date: Fri, 22 Aug 2014 17:01:54 +0800 Subject: [PATCH 009/110] merge fix from 2.8 branch: clear currchain while regen chain --- xCAT-server/lib/xcat/plugins/profilednodes.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index 06bcccf2c..c8ab55cec 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -933,6 +933,7 @@ Usage: my %chainAttr = {}; foreach my $node (@$nodes){ $chainAttr{$node}{'chain'} = $chainstr; + $chainAttr{$node}{'currchain'} = ''; } my $chaintab = xCAT::Table->new('chain', -create=>1); $chaintab->setNodesAttribs(\%chainAttr); @@ -1124,8 +1125,9 @@ Usage: $fsp_flag = 1; $fspipsAttr{$node}{"hcp"} = $nextip; } - } + } } + # Add reserve nics foreach my $nicname (@reserveNics){ my $oldip = $nodesNicsRef->{$node}->{$nicname}->{"ip"}; @@ -1323,7 +1325,7 @@ Usage: # DB update: chain table. my $chaintab = xCAT::Table->new('chain', -create=>1); - $mactab->setNodeAttribs($hostname, {chain=>$chainstr}); + $chaintab->setNodeAttribs($hostname, {chain=>$chainstr, currchain=>''}); $chaintab->close(); From 7fffc07e542d733603f1eca258de13418c1a7946 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Fri, 22 Aug 2014 03:25:37 -0700 Subject: [PATCH 010/110] Fix bug 4257: chvm hugepage doesn't work with dfm on Powerlinux --- perl-xCAT/xCAT/FSPvm.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/perl-xCAT/xCAT/FSPvm.pm b/perl-xCAT/xCAT/FSPvm.pm index 6271f4aa6..45e5bfc4f 100644 --- a/perl-xCAT/xCAT/FSPvm.pm +++ b/perl-xCAT/xCAT/FSPvm.pm @@ -801,6 +801,19 @@ sub do_op_extra_cmds { if ($op eq "lparname") { $action = "set_lpar_name"; } elsif ($op eq "huge_page") { + my @td = @$d; + @td[0] = 0; + my $tmphash = &query_cec_info_actions($request, $name, \@td, 1, ["get_huge_page"]); + if ($tmphash->{huge_page_avail}) { + if ($param > $tmphash->{huge_page_avail}) { + push @values, [$name, "No enough huge pages, only $tmphash->{huge_page_avail} pages available", 0]; + $param = $tmphash->{huge_page_avail}; + } + $param = "1/$param/$param"; + } else { + push @values, [$name, "No huge page available to configure", 0]; + next; + } $action = "set_huge_page"; } elsif ($op eq "vmcpus") { $action = "part_set_lpar_pending_proc"; From a6ca187a16dd05ec697d187844514ce9331cc9a1 Mon Sep 17 00:00:00 2001 From: immarvin Date: Sun, 24 Aug 2014 07:54:02 -0700 Subject: [PATCH 011/110] add kdump support for redhat7 --- xCAT/postscripts/enablekdump | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/enablekdump b/xCAT/postscripts/enablekdump index 52b8d7c89..2ba1eebe9 100755 --- a/xCAT/postscripts/enablekdump +++ b/xCAT/postscripts/enablekdump @@ -213,7 +213,14 @@ EOF mv ${oldremount}.bak $oldremount fi else - if (pmatch $OSVER "fedora*") || (pmatch $OSVER "rhel6*") || (pmatch $OSVER "rhels6*") || [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ];then + if (pmatch $OSVER "rhel7*") || (pmatch $OSVER "rhels7*");then + /bin/mount -o nolock $KDIP:$KDPATH $MOUNTPATH + [ -d $MOUNTPATH/var/crash ] || mkdir -p $MOUNTPATH/var/crash + echo "nfs $KDIP:$KDPATH" > /etc/kdump.conf + echo "default shell" >> /etc/kdump.conf + sed -i 's/KDUMP_COMMANDLINE_APPEND="/KDUMP_COMMANDLINE_APPEND="nonodestatus /' /etc/sysconfig/kdump + restartservice kdump + elif (pmatch $OSVER "fedora*") || (pmatch $OSVER "rhel6*") || (pmatch $OSVER "rhels6*") || [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ];then /bin/mount -o nolock $KDIP:$KDPATH $MOUNTPATH echo "net $KDIP:$KDPATH" > /etc/kdump.conf echo "link_delay 180" >> /etc/kdump.conf From 4e9ee2bbdc8a6f245031d97caa9fd34e4fff72de Mon Sep 17 00:00:00 2001 From: immarvin Date: Sun, 24 Aug 2014 22:30:06 -0700 Subject: [PATCH 012/110] add kdump support for redhat7 stateless --- xCAT-server/lib/xcat/plugins/packimage.pm | 9 +++++++++ xCAT/postscripts/enablekdump | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 2480c00d8..79e231270 100644 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -246,6 +246,13 @@ sub process_request { } } + #restore the install.netboot of xcat dracut module + if(-e "$rootimg_dir/usr/lib/dracut/modules.d/97xcat/install"){ + xCAT::Utils->runcmd("mv $rootimg_dir/usr/lib/dracut/modules.d/97xcat/install $rootimg_dir/.statebackup/install", 0, 1); + } + xCAT::Utils->runcmd("cp /opt/xcat/share/xcat/netboot/rh/dracut_033/install.netboot $rootimg_dir/usr/lib/dracut/modules.d/97xcat/install", 0, 1); + + my $xcat_packimg_tmpfile = "/tmp/xcat_packimg.$$"; my $excludestr = "find . -xdev "; my $includestr; @@ -439,6 +446,8 @@ sub process_request { xCAT::Utils->runcmd("mv $rootimg_dir/.statebackup$filename $rootimg_dir$filename", 0, 1); } } + + xCAT::Utils->runcmd("mv $rootimg_dir/.statebackup/install $rootimg_dir/usr/lib/dracut/modules.d/97xcat/install", 0, 1); xCAT::Utils->runcmd("mv $rootimg_dir/.statebackup/statelite $rootimg_dir/etc/init.d/statelite", 0, 1); xCAT::Utils->runcmd("rm -rf $rootimg_dir/.statebackup", 0, 1); } diff --git a/xCAT/postscripts/enablekdump b/xCAT/postscripts/enablekdump index 2ba1eebe9..1a17d2e51 100755 --- a/xCAT/postscripts/enablekdump +++ b/xCAT/postscripts/enablekdump @@ -218,8 +218,10 @@ EOF [ -d $MOUNTPATH/var/crash ] || mkdir -p $MOUNTPATH/var/crash echo "nfs $KDIP:$KDPATH" > /etc/kdump.conf echo "default shell" >> /etc/kdump.conf - sed -i 's/KDUMP_COMMANDLINE_APPEND="/KDUMP_COMMANDLINE_APPEND="nonodestatus /' /etc/sysconfig/kdump + sed -i 's/KDUMP_COMMANDLINE_APPEND="/KDUMP_COMMANDLINE_APPEND="nonodestatus /' /etc/sysconfig/kdump + [ -f /etc/dracut.conf ] && mv /etc/dracut.conf /tmp/dracut.conf restartservice kdump + [ -f /tmp/dracut.conf ] && mv /tmp/dracut.conf /etc/dracut.conf elif (pmatch $OSVER "fedora*") || (pmatch $OSVER "rhel6*") || (pmatch $OSVER "rhels6*") || [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ];then /bin/mount -o nolock $KDIP:$KDPATH $MOUNTPATH echo "net $KDIP:$KDPATH" > /etc/kdump.conf From 40f96179a6dd6855960a8dd132d27558d028b42f Mon Sep 17 00:00:00 2001 From: huweihua Date: Mon, 25 Aug 2014 03:00:13 -0400 Subject: [PATCH 013/110] only used by sysclone, change the disk by-id name of targer node when deploy it --- xCAT/postscripts/replace_byid_device | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 xCAT/postscripts/replace_byid_device diff --git a/xCAT/postscripts/replace_byid_device b/xCAT/postscripts/replace_byid_device new file mode 100644 index 000000000..8d199c2a6 --- /dev/null +++ b/xCAT/postscripts/replace_byid_device @@ -0,0 +1,45 @@ +#!/bin/bash + +#Only used by sysclone + +#if the /etc/systemimager/byid_real_map.conf exist, +#the device name used in fstab and grub are in "by-id" style +#use the by-id name on target node to replace the name on the goden client + +if [ ! -e /etc/systemimager/byid_real_map.conf ];then + exit 0 +fi + +sed -e 's/-part[0-9]\+//g' -e 's/[0-9]\+$//' /etc/systemimager/byid_real_map.conf | uniq | + while read str_line +do + str_old_dev="${str_line%%:*}" + str_real="${str_line##*:}" + str_real="${str_line##*/}" +# str_dev_prefix=`basename $str_old_dev | awk -F'-' '{print $1}'` + + #find out the new by-id name + str_new_dev=`ls -l --time-style=locale /dev/disk/by-id/ | grep -E "$str_real\$" | awk '{print $9}'` + if [ -z "$str_new_dev" ];then + continue + fi + str_new_dev="/dev/disk/by-id/${str_new_dev}" + + for str_file_name in \ + /boot/efi/efi/SuSE/elilo.conf \ + /boot/efi/EFI/redhat/grub.conf \ + /boot/grub/menu.lst \ + /boot/grub/device.map \ + /etc/elilo.conf \ + /etc/fstab \ + /etc/grub.conf \ + /etc/lilo.conf \ + /etc/yaboot.conf + do + if [ -f $str_file_name ];then + sed -i "s:$str_old_dev:$str_new_dev:g" "$str_file_name" + fi + done +done + +exit 0 From 246f7d1e2bfff3f89e6cdd153e2788426d7c3f68 Mon Sep 17 00:00:00 2001 From: huweihua Date: Mon, 25 Aug 2014 03:15:58 -0400 Subject: [PATCH 014/110] sysclone support p system --- xCAT-server/lib/xcat/plugins/anaconda.pm | 12 ++++++++++++ xCAT-server/lib/xcat/plugins/sles.pm | 23 ++++++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index d1303f37b..033942f24 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -1957,6 +1957,18 @@ sub mksysclone } } $kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename"; + + my $nodetab = xCAT::Table->new('nodetype'); + my $archref = $nodetab->getNodeAttribs($node, ['arch']); + if ($archref->{arch} eq "ppc64"){ + my $mactab = xCAT::Table->new('mac'); + my $macref = $mactab->getNodeAttribs($node, ['mac']); + my $formatmac = $macref->{mac}; + $formatmac =~ s/:/-/g; + $formatmac = "01-".$formatmac; + $kcmdline .= " BOOTIF=$formatmac "; + } + #$kcmdline .= " noipv6"; # add the addkcmdline attribute to the end # of the command, if it exists diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 483cafc90..a66573dfc 100755 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1349,6 +1349,7 @@ sub mksysclone my $clusterfile = "$installroot/sysclone/scripts/cluster.txt"; mkpath("$pspath"); + copy("$installroot/postscripts/replace_byid_device","$pspath/11all.replace_byid_device"); copy("$installroot/postscripts/configefi","$pspath/15all.configefi"); copy("$installroot/postscripts/updatenetwork","$pspath/16all.updatenetwork"); copy("$installroot/postscripts/runxcatpost","$pspath/17all.runxcatpost"); @@ -1361,11 +1362,11 @@ sub mksysclone copy("/var/lib/systemimager/scripts/post-install/10all.fix_swap_uuids","$pspath"); } - unless (-r "$pspath/11all.replace_byid_device") - { - mkpath("$pspath"); - copy("/var/lib/systemimager/scripts/post-install/11all.replace_byid_device","$pspath"); - } + #unless (-r "$pspath/11all.replace_byid_device") + #{ + # mkpath("$pspath"); + # copy("/var/lib/systemimager/scripts/post-install/11all.replace_byid_device","$pspath"); + #} unless (-r "$pspath/95all.monitord_rebooted") { @@ -1481,6 +1482,18 @@ sub mksysclone } $kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename"; + my $nodetab = xCAT::Table->new('nodetype'); + my $archref = $nodetab->getNodeAttribs($node, ['arch']); + if ($archref->{arch} eq "ppc64"){ + my $mactab = xCAT::Table->new('mac'); + my $macref = $mactab->getNodeAttribs($node, ['mac']); + my $formatmac = $macref->{mac}; + $formatmac =~ s/:/-/g; + $formatmac = "01-".$formatmac; + $kcmdline .= " BOOTIF=$formatmac "; + } + + my $i = "xcat/genesis.fs.$arch.gz"; if ( -r "$tftpdir/xcat/genesis.fs.$arch.lzma" ){ $i = "xcat/genesis.fs.$arch.lzma"; From 18a8cdf36a4cabb5d7d2748293f132a7cb875185 Mon Sep 17 00:00:00 2001 From: huweihua Date: Mon, 25 Aug 2014 03:23:47 -0400 Subject: [PATCH 015/110] sysclone support p system --- xCAT/postscripts/configefi | 175 +++++++++++++++++++++---------------- 1 file changed, 100 insertions(+), 75 deletions(-) diff --git a/xCAT/postscripts/configefi b/xCAT/postscripts/configefi index 5bc8c1ac8..5ad3c302d 100644 --- a/xCAT/postscripts/configefi +++ b/xCAT/postscripts/configefi @@ -4,81 +4,106 @@ # SI post-install script to configure the efi boot mgr or grub after SI has installed the OS # SI post-install scripts run in a chroot environment of the final OS image -if [ -d /sys/firmware/efi ]; then - echo "Setting Boot Manager for the next boot." - echo "delete all sysclone boot list" - str_bootnums=`efibootmgr | grep 'syscloneLinux' | awk '{print $1}' | sed 's/boot//i' | sed 's/*//'` - for str_num in $str_bootnums - do - efibootmgr -b $str_num -B -q - done +arch=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/` +if [ "$arch" = "x86_64" ]; then + if [ -d /sys/firmware/efi ]; then + echo "Setting Boot Manager for the next boot." + echo "delete all sysclone boot list" + str_bootnums=`efibootmgr | grep 'syscloneLinux' | awk '{print $1}' | sed 's/boot//i' | sed 's/*//'` + for str_num in $str_bootnums + do + efibootmgr -b $str_num -B -q + done - if [ -f "/boot/efi/EFI/redhat/grub.efi" ];then - efibootmgr -c -l \\EFI\\redhat\\grub.efi -L syscloneLinux - elif [ -f "/boot/efi/efi/SuSE/elilo.efi" ];then - efibootmgr -c -l \\efi\\SuSE\\elilo.efi -L syscloneLinux + if [ -f "/boot/efi/EFI/redhat/grub.efi" ];then + efibootmgr -c -l \\EFI\\redhat\\grub.efi -L syscloneLinux + elif [ -f "/boot/efi/efi/SuSE/elilo.efi" ];then + efibootmgr -c -l \\efi\\SuSE\\elilo.efi -L syscloneLinux + else + echo "Can not find the boot loader." + exit 1 + fi + else + echo "run grub-install to configure the MBR." + if [ -e /etc/mtab ];then + mv /etc/mtab /etc/mtab.bak + fi + grep -v rootfs /proc/mounts > /etc/mtab + boot_device='' + if [ -f "/etc/systemconfig/systemconfig.conf" ];then + boot_root=`cat /etc/systemconfig/systemconfig.conf | grep ROOTDEV | awk '{print $3}'` + boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'` + else + boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'` + boot_device=`echo $boot_root | sed -e 's/[0-9]*$//'` + + #str_temp=`mount | awk '{print $1","$3}'` + #for line in $str_temp + #do + # mp=`echo $line | awk -F, '{print $2}'` + # if [ "$mp" = "/" ];then + # boot_device=`echo $line | awk -F, '{print $1}' | sed -e 's/[0-9]*$//'` + # break + # fi + #done + fi + + if [ -n "$boot_device" ];then + echo "The boot device is $boot_device" + echo "The boot root device is $boot_root" + else + echo "Can not find the boot device, return error" + exit 1 + fi + + # set grub to use this boot device + if grep -qe '^VERSION\s*=\s*11' /etc/SuSE-release; then + #sles11, run grub-install.unsupported directly + echo "grub-install.unsupported --no-floppy --recheck $boot_device" + grub-install.unsupported --no-floppy --recheck $boot_device + # note: the error about grub-set-default not existing is harmless, because we want the default to be 0 anyway + else + #for sles10, should run grub-install with parameters + echo "grub-install --no-floppy --recheck $boot_device" + grub-install --no-floppy --recheck $boot_device + fi + + # change the entries in the grub conf file to use the correct boot root device + # (not the one leftover from the golden image) + if [ -f "/boot/grub/grub.conf" ];then + conffile="/boot/grub/grub.conf" + else + conffile="/boot/grub/menu.lst" + fi + sed -i 's| root=\S*| root='$boot_root'|' $conffile + sed -i 's| resume=\S*| noresume|' $conffile + + if [ -e /etc/mtab.bak ];then + mv -f /etc/mtab.bak /etc/mtab + else + rm -f /etc/mtab + fi + fi +elif [ "$arch" = "ppc64" ]; then + echo "run yaboot to configure the MBR." + if [ -f "/usr/lib/yaboot/yaboot" ]; then + # set bootloader + echo "dd if=/usr/lib/yaboot/yaboot of=/dev/sda1 bs=4096" + dd if=/usr/lib/yaboot/yaboot of=/dev/sda1 bs=4096 + + # Set 0x41 as the partition type of the first partition + echo A | dd of=/dev/sda bs=1 count=1 seek=450 + elif [ -f "/lib/lilo/pmac/yaboot" ]; then + # set bootloader + echo "dd if=/lib/lilo/pmac/yaboot of=/dev/sda1 bs=4096" + dd if=/lib/lilo/pmac/yaboot of=/dev/sda1 bs=4096 + + # Set 0x41 as the partition type of the first partition + echo A | dd of=/dev/sda bs=1 count=1 seek=450 else - echo "Can not find the boot loader." - exit 1 - fi + echo "there isn't yaboot bootloader" + fi else - echo "run grub-install to configure the MBR." - if [ -e /etc/mtab ];then - mv /etc/mtab /etc/mtab.bak - fi - grep -v rootfs /proc/mounts > /etc/mtab - boot_device='' - if [ -f "/etc/systemconfig/systemconfig.conf" ];then - boot_root=`cat /etc/systemconfig/systemconfig.conf | grep ROOTDEV | awk '{print $3}'` - boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'` - else - boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'` - boot_device=`echo $boot_root | sed -e 's/[0-9]*$//'` - - #str_temp=`mount | awk '{print $1","$3}'` - #for line in $str_temp - #do - # mp=`echo $line | awk -F, '{print $2}'` - # if [ "$mp" = "/" ];then - # boot_device=`echo $line | awk -F, '{print $1}' | sed -e 's/[0-9]*$//'` - # break - # fi - #done - fi - - if [ -n "$boot_device" ];then - echo "The boot device is $boot_device" - echo "The boot root device is $boot_root" - else - echo "Can not find the boot device, return error" - exit 1 - fi - - # set grub to use this boot device - if grep -qe '^VERSION\s*=\s*11' /etc/SuSE-release; then - #sles11, run grub-install.unsupported directly - echo "grub-install.unsupported --no-floppy --recheck $boot_device" - grub-install.unsupported --no-floppy --recheck $boot_device - # note: the error about grub-set-default not existing is harmless, because we want the default to be 0 anyway - else - #for sles10, should run grub-install with parameters - echo "grub-install --no-floppy --recheck $boot_device" - grub-install --no-floppy --recheck $boot_device - fi - - # change the entries in the grub conf file to use the correct boot root device - # (not the one leftover from the golden image) - if [ -f "/boot/grub/grub.conf" ];then - conffile="/boot/grub/grub.conf" - else - conffile="/boot/grub/menu.lst" - fi - sed -i 's| root=\S*| root='$boot_root'|' $conffile - sed -i 's| resume=\S*| noresume|' $conffile - - if [ -e /etc/mtab.bak ];then - mv -f /etc/mtab.bak /etc/mtab - else - rm -f /etc/mtab - fi -fi + echo "[ERROR]: unsupport arch....." +fi + From f9e77f3ddfacd0f5f098e1ffd60613a4b5147bb3 Mon Sep 17 00:00:00 2001 From: huweihua Date: Mon, 25 Aug 2014 03:26:34 -0400 Subject: [PATCH 016/110] add sfdisk command for sysclone support p --- xCAT-genesis-builder/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index 26f1ac2c3..36e788e19 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -617,7 +617,7 @@ dracut_install /lib64/rsyslog/lmnet.so dracut_install /lib64/rsyslog/lmstrmsrv.so dracut_install /lib64/rsyslog/imuxsock.so dracut_install /usr/lib64/libnfsidmap/nsswitch.so -dracut_install killall logger nc nslookup bc chown chroot dd expr kill mkdosfs parted rsync shutdown sort ssh-keygen tr blockdev findfs insmod kexec lvm mdadm mke2fs pivot_root sshd swapon tune2fs mkreiserfs reiserfstune pvcreate lvremove vgremove vgcreate lvcreate lvscan lvchange vgchange pvdisplay lvdisplay vgdisplay blkid dmsetup # for sysclone +dracut_install killall logger nc nslookup bc chown chroot dd expr kill mkdosfs parted rsync shutdown sort ssh-keygen tr blockdev findfs insmod kexec lvm mdadm mke2fs pivot_root sshd swapon tune2fs mkreiserfs reiserfstune pvcreate lvremove vgremove vgcreate lvcreate lvscan lvchange vgchange pvdisplay lvdisplay vgdisplay blkid dmsetup sfdisk # for sysclone dracut_install /lib/udev/rules.d/10-dm.rules dracut_install /lib/udev/rules.d/11-dm-lvm.rules dracut_install /lib/udev/rules.d/13-dm-disk.rules From 9b5f4e2d05943a8f583318345993172e1a2fb9df Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 25 Aug 2014 21:28:21 -0700 Subject: [PATCH 017/110] fix defect #4246 In rhel7/p8 env,sometimes cn provision status is failed. --- xCAT/postscripts/xcatinstallpost | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index c0ac65f1c..03fd10b82 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -12,6 +12,24 @@ fi SLI=$(awk 'BEGIN{srand(); printf("%d\n",rand()*10)}') sleep $SLI + + +#the nics have not been configured when running the PBS sometimes, need to make sure... +RETRY=0 +until ip -4 --oneline addr show|grep -v 127.0.0.1 >/dev/null +do + sleep 2 + RETRY=$[ $RETRY + 1 ] + if [ $RETRY -eq 15 ];then + logger -t xcat -p local4.err "Network not configured, please check..." + echo `date` "xcatinstallpost: Network not configured, please check..." >> /var/log/xcat/xcat.log + exit 1 + fi + +done + + + cd /xcatpost; PATH=/xcatpost:$PATH export PATH From 975b90e619baf6c786a54c031bcfbb426e35795e Mon Sep 17 00:00:00 2001 From: Jia Zhao Date: Tue, 26 Aug 2014 14:11:31 +0800 Subject: [PATCH 018/110] validate cec and lparid during nodeimport --- perl-xCAT/xCAT/ProfiledNodeUtils.pm | 33 +++++++++++++++++++ xCAT-client/pods/man1/nodeimport.1.pod | 8 +++-- xCAT-server/lib/xcat/plugins/profilednodes.pm | 15 +++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/ProfiledNodeUtils.pm b/perl-xCAT/xCAT/ProfiledNodeUtils.pm index 62c1b5081..5fee1f892 100644 --- a/perl-xCAT/xCAT/ProfiledNodeUtils.pm +++ b/perl-xCAT/xCAT/ProfiledNodeUtils.pm @@ -653,6 +653,39 @@ sub get_all_cecs } } +#------------------------------------------------------------------------------- + +=head3 get_all_lparids + Description : Get all LPAR ids in system. + Arguments : ref of all cecs + Returns : ref for LPAR ids hash. + Example : + my $arrayref = xCAT::ProfiledNodeUtils->get_all_lparids(\%allcecs); +=cut + +#------------------------------------------------------------------------------- +sub get_all_lparids +{ + my $class= shift; + my $cecsref = shift; + my %allcecs = %$cecsref; + my %lparids; + + my $ppctab = xCAT::Table->new('ppc'); + foreach my $cec (keys %allcecs) { + my @ids = $ppctab->getAllAttribsWhere("hcp = '$cec'", 'id'); + foreach (@ids) { + if ( $_->{'id'} ){ + $lparids{$cec}{$_->{'id'}} = 0; + } + } + } + $ppctab->close(); + + return \%lparids; +} + + #------------------------------------------------------------------------------- =head3 is_discover_started diff --git a/xCAT-client/pods/man1/nodeimport.1.pod b/xCAT-client/pods/man1/nodeimport.1.pod index 871b7510d..41e962a52 100644 --- a/xCAT-client/pods/man1/nodeimport.1.pod +++ b/xCAT-client/pods/man1/nodeimport.1.pod @@ -128,7 +128,11 @@ To import nodes using a profile, follow the following steps: __hostname__: mac=b8:ac:6f:37:59:28 cec=mycec - lparid=1 + + __hostname__: + mac=b8:ac:6f:37:59:28 + cec=mycec + lparid=2 # Node information file ends. The node information file includes the following items: @@ -155,7 +159,7 @@ Description: Specifies the name of a Power rack-mount central electronic complex B> This is a optional option for defining Power rack-mounted nodes. -Description: Specifies the LPAR id of Power rack-mounted node. +Description: Specifies the LPAR ID of a Power rack-mounted node, where is the ID number. The default value is 1 if it is not defined. B> This is an optional item. diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index c8ab55cec..846111e0e 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -33,6 +33,7 @@ my %allhostnames; my %allbmcips; my %allmacs; my %allcecs; +my %alllparids; my %allmacsupper; my %allips; my %allinstallips; @@ -425,6 +426,10 @@ Usage: # Get all CEC names $recordsref = xCAT::ProfiledNodeUtils->get_all_cecs(1); %allcecs = %$recordsref; + + # Get all LPAR ids + $recordsref = xCAT::ProfiledNodeUtils->get_all_lparids(\%allcecs); + %alllparids = %$recordsref; #TODO: can not use getallnode to get rack infos. $recordsref = xCAT::ProfiledNodeUtils->get_all_rack(1); @@ -2437,10 +2442,20 @@ sub validate_node_entry{ $errmsg .= "The lparid option must be used with the cec option.\n"; } }elsif ($_ eq "cec"){ + my $cec_name = $node_entry{"cec"}; + my $lpar_id = 1; # Check the specified CEC is existing if (! exists $allcecs{$node_entry{$_}}){ $errmsg .= "The CEC name $node_entry{$_} that is specified in the node information file is not defined in the system.\n"; + }elsif (exists $node_entry{"lparid"}){ + $lpar_id = $node_entry{"lparid"}; } + + if (exists $alllparids{$cec_name}{$lpar_id}){ + $errmsg .= "The CEC name $cec_name and LPAR id $lpar_id already exist in the database or in the nodeinfo file. You must use a new CEC name and LPAR id.\n"; + }else{ + $alllparids{$cec_name}{$lpar_id} = 0; + } }elsif ($_ eq "nicips"){ # Check Multi-Nic's ip my $othernics = $node_entry{$_}; From 151409cff92623c540703faf624875ef4c64b6d0 Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 26 Aug 2014 02:36:13 -0400 Subject: [PATCH 019/110] Compile genesis-base on Fedora ppc64, the ibm virtual disk module is ibmvscsi --- xCAT-genesis-builder/installkernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/installkernel b/xCAT-genesis-builder/installkernel index c5f2776f9..d5aefc726 100755 --- a/xCAT-genesis-builder/installkernel +++ b/xCAT-genesis-builder/installkernel @@ -6,6 +6,6 @@ instmods mptctl #LSI firmware management requires this instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys instmods reiserfs #reiserfs on sysclone instmods ibmveth # ppc64 virtual ethernet -instmods ibmvscsic # ppc64 virtual disk +instmods ibmvscsi # ppc64 virtual disk instmods ehea # ppc64 hea ethernet instmods dm-mod #support LVM for sysclone From 9a05a5ea1f2bb09537835360c11d15d8cf6cf72e Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 26 Aug 2014 04:29:01 -0400 Subject: [PATCH 020/110] fix the file from install of xCAT-genesis-scripts-ppc64-1:2.9-snap201408210348.noarch conflicts with file from package xCAT-genesis-base-ppc64-1:2.9-snap201408210346.noarch, if the rpms are built on RHEL 7 or Fedora 20 --- .../xCAT-genesis-scripts.spec | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec index 70ffe87e4..cc6f3f02b 100755 --- a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec +++ b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec @@ -7,6 +7,7 @@ %ifarch ppc ppc64 %define tarch ppc64 %endif +%define rpminstallroot /opt/xcat/share/xcat/netboot/genesis/%{tarch}/fs BuildArch: noarch %define name xCAT-genesis-scripts-%{tarch} %define __spec_install_post : @@ -74,4 +75,33 @@ touch /etc/xcat/genesis-scripts-updated %Files %defattr(-,root,root) -/opt/xcat/share/xcat/netboot/genesis/%{tarch}/fs +#%dir %attr(-,root,root) %{rpminstallroot} +%{rpminstallroot}/bin/allowcred.awk +%{rpminstallroot}/bin/bmcsetup +%{rpminstallroot}/bin/dodiscovery +%{rpminstallroot}/bin/dosysclone +%{rpminstallroot}/bin/doxcat +%{rpminstallroot}/bin/getcert +%{rpminstallroot}/bin/getdestiny +%{rpminstallroot}/bin/getipmi +%{rpminstallroot}/bin/ifup +%{rpminstallroot}/bin/minixcatd.awk +%{rpminstallroot}/bin/nextdestiny +%{rpminstallroot}/bin/remoteimmsetup +%{rpminstallroot}/bin/udpcat.awk +%{rpminstallroot}/bin/updateflag.awk +%{rpminstallroot}/debian/changelog +%{rpminstallroot}/debian/compat +%{rpminstallroot}/debian/control +%{rpminstallroot}/debian/copyright +%{rpminstallroot}/debian/dirs +%{rpminstallroot}/debian/docs +%{rpminstallroot}/debian/install +%{rpminstallroot}/debian/postinst +%{rpminstallroot}/debian/postrm +%{rpminstallroot}/debian/preinst +%{rpminstallroot}/debian/prerm +%{rpminstallroot}/debian/rules +%{rpminstallroot}/etc/init.d/functions +%{rpminstallroot}/etc/udev/rules.d/99-imm.rules +%{rpminstallroot}/sbin/setupimmnic From 90ed515fb37b8b85015ecf8f580467b7cc14499c Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 28 Aug 2013 11:25:53 +0800 Subject: [PATCH 021/110] support genesis-base on ppc64: use -N with dracut command on ppc64 --- xCAT-genesis-builder/buildrpm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index 287a6ecd3..cc402c395 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -77,8 +77,13 @@ if [ "$HOSTOS" = "mcp" ]; then else echo Creating the initramfs in /tmp/xcatgenesis.$$.rfs using dracut ... fi -dracut -m "xcat base" -N -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION +# On Fedora 20 ppc64, dracut uses host-only mode by default +if [ `uname -m` = "ppc64" ]; then + dracut -m "xcat base" -N -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION +else + dracut -m "xcat base" -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION +fi echo Expanding the initramfs into /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs ... cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs zcat /tmp/xcatgenesis.$$.rfs|cpio -dumi From 15cc210445d2850212c80d5f6ef5fc0cb695511a Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 27 Aug 2014 00:50:58 -0700 Subject: [PATCH 022/110] fix bug 4250 xcat crashes system console on IBM power system: 8248-L4T --- perl-xCAT/xCAT/FSPmac.pm | 14 ++++--- perl-xCAT/xCAT/LparNetbootExp.pm | 70 ++++++++++++++++++++++++++++---- perl-xCAT/xCAT/PPCmac.pm | 47 ++++++++++++++++----- 3 files changed, 108 insertions(+), 23 deletions(-) diff --git a/perl-xCAT/xCAT/FSPmac.pm b/perl-xCAT/xCAT/FSPmac.pm index b943af7b4..650057d0a 100644 --- a/perl-xCAT/xCAT/FSPmac.pm +++ b/perl-xCAT/xCAT/FSPmac.pm @@ -517,12 +517,14 @@ sub getmacs { $data.= "\n$_\n"; push @$value, "\n$_\n"; } elsif ( /^ent\s+/ || /^hfi-ent\s+/ ) { - my @fields = split /\s+/, $_; - my $mac = $fields[2]; - $mac = format_mac( $mac ); - $fields[2] = $mac; - $data .= join(" ",@fields)."\n"; - push @$value, join(" ",@fields)."\n"; + #my @fields = split /\s+/, $_; + #my $mac = $fields[2]; + #$mac = format_mac( $mac ); + #$fields[2] = $mac; + #$data .= join(" ",@fields)."\n"; + #push @$value, join(" ",@fields)."\n"; + $data .= "$_\n"; + push @$value, "$_\n"; } } push @$res,[$node,$data,0]; diff --git a/perl-xCAT/xCAT/LparNetbootExp.pm b/perl-xCAT/xCAT/LparNetbootExp.pm index 92fab81d5..27cd82dd1 100755 --- a/perl-xCAT/xCAT/LparNetbootExp.pm +++ b/perl-xCAT/xCAT/LparNetbootExp.pm @@ -629,7 +629,8 @@ sub get_adap_prop { $cmd[0] = "\" supported-network-types\" " . $phandle . " get-package-property\r"; $msg[0] = "Status: rc and all supported network types now on stack\n"; #$pattern[0] = "(.*)3 >(.*)"; - $pattern[0] = "3 >"; + #$pattern[0] = "3 >"; + $pattern[0] = "ok"; $newstate[0] = 1; # state 1, return code and string on stack @@ -637,7 +638,8 @@ sub get_adap_prop { $cmd[1] = ".\r"; $msg[1] = "Status: All supported network types now on stack\n"; #$pattern[1] = "(.*)2 >(.*)"; - $pattern[1] = "2 >"; + #$pattern[1] = "2 >"; + $pattern[1] = "ok"; $newstate[1] = 2; # state 2, data ready to decode @@ -691,6 +693,16 @@ sub get_adap_prop { $timeout, [ qr/$pattern[$state]/i, sub { + if ($state eq 1) { + if ($rconsole->before() =~ /-\d+/) { + nc_msg($verbose, "Status: Error getting adapter property for phandle=$phandle.\n"); + $state = 7; + $rconsole->clear_accum(); + $rc = 1; + return 1; + } + } + nc_msg($verbose, $msg[$state]); $state = $newstate[$state]; $rconsole->clear_accum(); @@ -878,6 +890,15 @@ sub get_mac_addr { $timeout, [qr/$pattern[$state]/=> sub { + if ($state eq 1) { + if ($rconsole->before() =~ /-\d+/) { + nc_msg($verbose, "Status: Error getting MAC address for phandle=$phandle.\n"); + $rconsole->clear_accum(); + $state = 4; + $rc = 1; + return undef; + } + } nc_msg($verbose, $msg[$state]); $state = $newstate[$state]; $rconsole->clear_accum(); @@ -1019,7 +1040,8 @@ sub get_mac_addr { $cmd[0] = "\" ibm,loc-code\" $phandle get-package-property\r"; $msg[0] = "Status: return code and loc-code now on stack\n"; #$pattern[0] = "(.*)3 >(.*)"; - $pattern[0] = "3 >"; + #$pattern[0] = "3 >"; + $pattern[0] = "ok"; $newstate[0] = 1; # cmd(1) is a dot (.). This is a stack manipulation command that removes one @@ -1052,6 +1074,16 @@ sub get_mac_addr { $timeout, [qr/$pattern[$state]/=> sub { + if ($state eq 1) { + if ($rconsole->before() =~ /-\d+/) { + nc_msg($verbose, "Status: Error getting adapter location for phandle=$phandle."); + $rconsole->clear_accum(); + $state = 3; + $rc = 1; + return undef; + } + } + nc_msg($verbose, $msg[$state]); $rconsole->clear_accum(); $state = $newstate[$state]; @@ -1125,10 +1157,19 @@ sub get_mac_addr { return undef if ($rc eq 1); } # Did we find one or more adapters? - - if ($result[3] =~ /(\w*):(.*):(\w*\.\w*\.\w*):/) { - $loc_code = $3; - }else { + my @loc_array = split /\n/,$result[3]; + my $found = 0; + $loc_code = ''; + foreach my $line ( @loc_array ) { + if ($line =~ /(\w*):(.*):([\w|\.|-]*):/) { + $loc_code .= $3; + $found = 1; + } + } + if ($found) { + $loc_code =~ s/\.$//; + return $loc_code; + } else { return undef; } } @@ -3006,6 +3047,21 @@ sub lparnetbootexp $device_type = "physical"; } + if (defined($mac_address)) { + my @newmacs = (); + my @allmacs = split /\|/,$mac_address; + if ( !xCAT::Utils->isAIX() ) { + foreach my $mac_a ( @allmacs ) { + $mac_a = lc($mac_a); + $mac_a =~ s/(\w{2})/$1:/g; + $mac_a =~ s/:$//; + push @newmacs, $mac_a; + } + $mac_address = join("|",@newmacs); + } + } + + if($colon) { nc_msg($verbose, "$adap_type[$i]\:$loc_code\:$mac_address\:$full_path_name_array[$i]\:$ping_result\:$device_type\:\:\:\:\n"); $outputarrayindex++; diff --git a/perl-xCAT/xCAT/PPCmac.pm b/perl-xCAT/xCAT/PPCmac.pm index 43c3a230f..afeb32ba0 100644 --- a/perl-xCAT/xCAT/PPCmac.pm +++ b/perl-xCAT/xCAT/PPCmac.pm @@ -555,6 +555,9 @@ sub getmacs { } else { $type = "virtualio"; } + if ($mac_addr) { + $mac_addr = format_mac($mac_addr); + } my %att = (); $att{'MAC_Address'} = ($mac_addr) ? $mac_addr : "N/A"; @@ -627,9 +630,9 @@ sub getmacs { } foreach ( @$value ) { if ( /^#\s?Type/ ) { - $data.= "\n$_\n"; + $data.= "\n$_\n"; } else { - $data.= format_mac( $_ ); + $data.= "$_\n"; } } @@ -756,7 +759,7 @@ sub getmacs { if ( /^#\s?Type/ ) { $data.= "\n$_\n"; } elsif ( /^ent\s+/ or /^hfi-ent\s+/ ) { - $data.= format_mac( $_ ); + $data.= "$_\n"; } } ##################################### @@ -801,10 +804,8 @@ sub cal_mac { ########################################################################## sub format_mac { - my $data = shift; + my $mac = shift; - $data =~ /^(\S+\s+\S+\s+)(\S+)(\s+.*)$/; - my $mac = $2; ##################################### # Get adapter mac ##################################### @@ -813,6 +814,10 @@ sub format_mac { if ( !xCAT::Utils->isAIX() ) { foreach my $mac_a ( @macs ) { + if (&checkmac($mac_a)) { + push @newmacs, $mac_a; + next; + } ################################# # Delineate MAC with colons ################################# @@ -821,14 +826,30 @@ sub format_mac { $mac_a =~ s/:$//; push @newmacs, $mac_a; } - my $newmac = join("|",@newmacs); - $data =~ s/$mac/$newmac/; + $mac = join("|",@newmacs); } - return( "$data\n" ); + return( "$mac\n" ); } +########################################################################## +# checkmac format +########################################################################## + +sub checkmac { + my $mac = shift; + if ( !xCAT::Utils->isAIX()) { + if ($mac =~ /\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2}/) { + return 1; + } else { + return 0; + } + } else { + return 1; + } +} + ########################################################################## # Write first valid adapter MAC to database @@ -847,6 +868,9 @@ sub writemac { # Find first valid adapter ##################################### foreach ( @$data ) { + unless (&checkmac($_)) { + next; + } if ( /^ent\s+/ or /^hfi-ent\s+/ ) { $value = $_; ##################################### @@ -869,6 +893,9 @@ sub writemac { ##################################### if ( $pingret ne "successful" ) { foreach ( @$data ) { + unless (&checkmac($_)) { + next; + } if ( /^ent\s+/ or /^hfi-ent\s+/ ) { $value = $_; $ping_test = 0; @@ -890,7 +917,7 @@ sub writemac { ##################################### # Get adapter mac ##################################### - $value = format_mac( $value ); + #$value = format_mac( $value ); @fields = split /\s+/, $value; $mac = $fields[2]; From 5cccca9d1c91953e05641f9ae4c1d7d5c14e2cec Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 28 Aug 2013 16:20:01 +0800 Subject: [PATCH 023/110] fix a problem for compiling ppc64 genesis-base --- xCAT-genesis-builder/buildrpm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index cc402c395..a44a773a4 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -12,7 +12,7 @@ DIR=`readlink -f $DIR` # get the input files for dracut in the right place # Fedora 20 ppc64 uses /usr/lib/dracut/modules.d # CentOS 7 probably uses /usr/lib/dracut/modules.d also -if [ -f "/usr/share/dracut/modules.d/97xcat" ] +if [ -e "/usr/share/dracut/modules.d" ] then DRACUTMODDIR=/usr/share/dracut/modules.d/97xcat else From 13b71591e0a539251bc54c182475e289e7e7348a Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 28 Aug 2013 16:39:02 +0800 Subject: [PATCH 024/110] add the qlcnic module into genesis-base, it is for Q-Logic 10Gb Virtual Fabric Adaptor NICs, ibm nx360m4 is equipped with this adapter --- xCAT-genesis-builder/installkernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/installkernel b/xCAT-genesis-builder/installkernel index d5aefc726..60e5c0a05 100755 --- a/xCAT-genesis-builder/installkernel +++ b/xCAT-genesis-builder/installkernel @@ -1,6 +1,6 @@ #!/bin/bash instmods nfs sunrpc -instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf +instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf qlcnic instmods macvlan macvtap 8021q bridge bonding vmxnet3 cpufreq_ondemand acpi-cpufreq powernow-k8 cdc_ether instmods mptctl #LSI firmware management requires this instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys From 3beec6c8b1cffce35cf8bf3200df6a09cea27362 Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 29 Aug 2013 09:31:54 +0800 Subject: [PATCH 025/110] fix two copyright files xCAT-genesis-scripts/debian/copyright and xCAT-OpenStack-baremetal/debian/copyright, should use EPL license --- xCAT-OpenStack-baremetal/debian/copyright | 120 +++++++++++++++------- xCAT-genesis-scripts/debian/copyright | 118 +++++++++++++++------ 2 files changed, 170 insertions(+), 68 deletions(-) diff --git a/xCAT-OpenStack-baremetal/debian/copyright b/xCAT-OpenStack-baremetal/debian/copyright index 152491524..f61d34dfe 100644 --- a/xCAT-OpenStack-baremetal/debian/copyright +++ b/xCAT-OpenStack-baremetal/debian/copyright @@ -1,38 +1,88 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: xcat-openstack-baremetal -Source: +Eclipse Public License - v 1.0 -Files: * -Copyright: - -License: - - - . - +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. -# If you want to use GPL v2 or later for the /debian/* files use -# the following clauses, or change it to suit. Delete these two lines -Files: debian/* -Copyright: 2014 root -License: GPL-2+ - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - . - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - . - You should have received a copy of the GNU General Public License - along with this program. If not, see - . - On Debian systems, the complete text of the GNU General - Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". +1. DEFINITIONS -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. -# Please avoid to pick license terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + + diff --git a/xCAT-genesis-scripts/debian/copyright b/xCAT-genesis-scripts/debian/copyright index 15de46f36..f61d34dfe 100644 --- a/xCAT-genesis-scripts/debian/copyright +++ b/xCAT-genesis-scripts/debian/copyright @@ -1,36 +1,88 @@ -Format: http://dep.debian.net/deps/dep5 -Upstream-Name: xcat-genesis-scripts -Source: +Eclipse Public License - v 1.0 -Files: * -Copyright: - -License: - - - . - +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. -# If you want to use GPL v2 or later for the /debian/* files use -# the following clauses, or change it to suit. Delete these two lines -Files: debian/* -Copyright: 2013 root -License: GPL-2+ - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - . - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - . - You should have received a copy of the GNU General Public License - along with this program. If not, see - . - On Debian systems, the complete text of the GNU General - Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". +1. DEFINITIONS -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + + From ef94ee56422f0c029fbf21d741554ba944ca20ef Mon Sep 17 00:00:00 2001 From: huweihua Date: Thu, 28 Aug 2014 02:21:56 -0400 Subject: [PATCH 026/110] sysclone support p: set target node boot from disk after clone install --- xCAT-server/lib/perl/xCAT/Postage.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index de2425e89..2fb9c9245 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -1858,8 +1858,8 @@ sub getPostScripts $result .= "setbootfromnet\n"; } - # add setbootfromdisk if the nodesetstate is install and arch is ppc64 - if (($nodesetstate) && ($nodesetstate eq "install") && ($arch eq "ppc64")) + # add setbootfromdisk if the nodesetstate is install or sysclone and arch is ppc64 + if (($nodesetstate) && (($nodesetstate eq "install") || ($nodesetstate eq "sysclone")) && ($arch eq "ppc64")) { $result .= "setbootfromdisk\n"; } From d7081292fc2e04bd4cf5acc5e93846f58392b674 Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 29 Aug 2013 15:15:56 +0800 Subject: [PATCH 027/110] fix for 4261: add the getnodesetstat support for grub2 --- xCAT-server/lib/perl/xCAT/SvrUtils.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) mode change 100644 => 100755 xCAT-server/lib/perl/xCAT/SvrUtils.pm diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm old mode 100644 new mode 100755 index 483b80a18..40dc6f33a --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -53,6 +53,7 @@ sub getNodesetStates my @pxenodes = (); my @yabootnodes = (); my @xnbanodes= (); + my @grub2nodes = (); my $tabdata = $tab->getNodesAttribs(\@nodes, ['node', 'netboot']); foreach my $node (@nodes) { @@ -75,6 +76,10 @@ sub getNodesetStates { push(@aixnodes, $node); } + elsif ($nb eq "grub2") + { + push(@grub2nodes, $node); + } } my @retarray; @@ -131,6 +136,18 @@ sub getNodesetStates xCAT::MsgUtils->message('E', $retarray[1]); } } + if (@grub2nodes > 0) + { + require xCAT_plugin::grub2; + @retarray = + xCAT_plugin::grub2::getNodesetStates(\@grub2nodes, $hashref); + if ($retarray[0]) + { + $retcode = $retarray[0]; + $errormsg .= $retarray[1]; + xCAT::MsgUtils->message('E', $retarray[1]); + } + } } return (0, ""); } From d87440ec41111d80cd56cc97f0355b032a861bc8 Mon Sep 17 00:00:00 2001 From: Jia Zhao Date: Thu, 28 Aug 2014 17:27:15 +0800 Subject: [PATCH 028/110] merge from 2.8 branch about name mistake --- xCAT-server/lib/xcat/plugins/profilednodes.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index 846111e0e..59011633c 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -2305,10 +2305,10 @@ sub validate_node_entry{ } # Must specify either MAC, CEC or switch + port. if (exists $node_entry{"mac"} || - exists $node_entry{"switch"} && exists $node_entry{"switchport"} || + exists $node_entry{"switches"} || exists $node_entry{"cec"}){ } else{ - $errmsg .= "MAC address, cec, switch and port is not specified. You must specify the MAC address, CEC name or switch and port.\n"; + $errmsg .= "MAC address, cec, switches is not specified. You must specify the MAC address, CEC name or switches.\n"; } if (! xCAT::NetworkUtils->isValidHostname($node_name)){ From eaf7325a1cc597d7d89c6ec12dd1555d647c2d1f Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 29 Aug 2014 00:30:28 -0700 Subject: [PATCH 029/110] fix defect #4242 In physical rhel7 env,set installnic=ethx can not provision compute node. --- xCAT-server/lib/perl/xCAT/Postage.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index 2fb9c9245..3d7ba772b 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -1864,6 +1864,7 @@ sub getPostScripts $result .= "setbootfromdisk\n"; } + #for redhat 7, append "disableconsistentNICrename" to default postscripts #if "net.ifnames=0" is specified in kcmdline/addkcmdline of node or osimage @@ -1874,7 +1875,7 @@ sub getPostScripts my $nrret = $::GLOBAL_TAB_HASH{noderes}{$node}; my $netboot = $nrret->{'netboot'}; - if( ($os =~ "rhel7*") || ($os =~ "rhels7*") ) + if( (($os =~ "rhel7*") || ($os =~ "rhels7*")) && ($nodesetstate) && ($nodesetstate eq "install") ) { my $nodecfg; if($netboot eq "grub2") From 3eabe15ff318aecc4fe57c9065148b2f4a010b77 Mon Sep 17 00:00:00 2001 From: junxiaw Date: Fri, 29 Aug 2014 00:35:59 -0700 Subject: [PATCH 030/110] modify autotest xCATreg code --- xCAT-server/share/xcat/tools/xCATreg | 175 ++++++++++++++------------- 1 file changed, 91 insertions(+), 84 deletions(-) diff --git a/xCAT-server/share/xcat/tools/xCATreg b/xCAT-server/share/xcat/tools/xCATreg index cc4198d0d..dca1a46ad 100644 --- a/xCAT-server/share/xcat/tools/xCATreg +++ b/xCAT-server/share/xcat/tools/xCATreg @@ -43,6 +43,7 @@ my $branch = 0; my $testconfigfile = "$rootdir/default.conf"; my $configfile = "/regression/default.conf"; my $MN = undef; +my $confdir = "/regression/confdir"; my $management_node = undef; my $CN = undef; my $output = undef; @@ -378,21 +379,23 @@ sub config_test { } } } - &runcmd ("touch default.conf"); - &runcmd ("touch defaultslesppc64.conf"); - &runcmd ("touch defaultrhx8664.conf"); - &runcmd ("touch defaultslesx8664.conf"); - &runcmd ("touch defaultubux8664.conf"); + + &runcmd ("rm -rf $confdir/*"); + &runcmd ("touch $confdir/default.conf"); + &runcmd ("touch $confdir/defaultslesppc64.conf"); + &runcmd ("touch $confdir/defaultrhx8664.conf"); + &runcmd ("touch $confdir/defaultslesx8664.conf"); + &runcmd ("touch $confdir/defaultubux8664.conf"); if(exists $rhppc64config{object}){ foreach my $type (keys %{$rhppc64config{object}}){ foreach my $name (keys %{$rhppc64config{object}{$type}}){ send_msg(2, "OBJECT:$name,TYPE:$type"); - &runcmd( " echo [Object_$type]>>default.conf"); - &runcmd( " echo Name=$name>>default.conf"); + &runcmd( " echo [Object_$type]>>$confdir/default.conf"); + &runcmd( " echo Name=$name>>$confdir/default.conf"); #print "$name,TYPE:$type \n"; foreach my $attr (keys %{$rhppc64config{object}{$type}{$name}}){ send_msg(2, " $attr = $rhppc64config{object}{$type}{$name}{$attr};"); - &runcmd( " echo $attr=$rhppc64config{object}{$type}{$name}{$attr}>>default.conf"); + &runcmd( " echo $attr=$rhppc64config{object}{$type}{$name}{$attr}>>$confdir/default.conf"); } } } @@ -401,12 +404,12 @@ sub config_test { foreach my $type (keys %{$slesppc64config{object}}){ foreach my $name (keys %{$slesppc64config{object}{$type}}){ send_msg(2, "OBJECT:$name,TYPE:$type"); - &runcmd( " echo [Object_$type]>>defaultslesppc64.conf"); - &runcmd( " echo Name=$name>>defaultslesppc64.conf"); + &runcmd( " echo [Object_$type]>>$confdir/defaultslesppc64.conf"); + &runcmd( " echo Name=$name>>$confdir/defaultslesppc64.conf"); #print "$name,TYPE:$type \n"; foreach my $attr (keys %{$slesppc64config{object}{$type}{$name}}){ send_msg(2, " $attr = $slesppc64config{object}{$type}{$name}{$attr};"); - &runcmd( " echo $attr=$slesppc64config{object}{$type}{$name}{$attr}>>defaultslesppc64.conf"); + &runcmd( " echo $attr=$slesppc64config{object}{$type}{$name}{$attr}>>$confdir/defaultslesppc64.conf"); } } } @@ -415,12 +418,12 @@ sub config_test { foreach my $type (keys %{$rhx8664config{object}}){ foreach my $name (keys %{$rhx8664config{object}{$type}}){ send_msg(2, "OBJECT:$name,TYPE:$type"); - &runcmd( " echo [Object_$type]>>defaultrhx8664.conf"); - &runcmd( " echo Name=$name>>defaultrhx8664.conf"); + &runcmd( " echo [Object_$type]>>$confdir/defaultrhx8664.conf"); + &runcmd( " echo Name=$name>>$confdir/defaultrhx8664.conf"); #print "$name,TYPE:$type \n"; foreach my $attr (keys %{$rhx8664config{object}{$type}{$name}}){ send_msg(2, " $attr = $rhx8664config{object}{$type}{$name}{$attr};"); - &runcmd( " echo $attr=$rhx8664config{object}{$type}{$name}{$attr}>>defaultrhx8664.conf"); + &runcmd( " echo $attr=$rhx8664config{object}{$type}{$name}{$attr}>>$confdir/defaultrhx8664.conf"); } } } @@ -429,12 +432,12 @@ sub config_test { foreach my $type (keys %{$slesx8664config{object}}){ foreach my $name (keys %{$slesx8664config{object}{$type}}){ send_msg(2, "OBJECT:$name,TYPE:$type"); - &runcmd( " echo [Object_$type]>>defaultslesx8664.conf"); - &runcmd( " echo Name=$name>>defaultslesx8664.conf"); + &runcmd( " echo [Object_$type]>>$confdir/defaultslesx8664.conf"); + &runcmd( " echo Name=$name>>$confdir/defaultslesx8664.conf"); #print "$name,TYPE:$type \n"; foreach my $attr (keys %{$slesx8664config{object}{$type}{$name}}){ send_msg(2, " $attr = $slesx8664config{object}{$type}{$name}{$attr};"); - &runcmd( " echo $attr=$slesx8664config{object}{$type}{$name}{$attr}>>defaultslesx8664.conf"); + &runcmd( " echo $attr=$slesx8664config{object}{$type}{$name}{$attr}>>$confdir/defaultslesx8664.conf"); } } } @@ -443,12 +446,12 @@ sub config_test { foreach my $type (keys %{$ubux8664config{object}}){ foreach my $name (keys %{$ubux8664config{object}{$type}}){ send_msg(2, "OBJECT:$name,TYPE:$type"); - &runcmd( " echo [Object_$type]>>defaultubux8664.conf"); - &runcmd( " echo Name=$name>>defaultubux8664.conf"); + &runcmd( " echo [Object_$type]>>$confdir/defaultubux8664.conf"); + &runcmd( " echo Name=$name>>$confdir/defaultubux8664.conf"); #print "$name,TYPE:$type \n"; foreach my $attr (keys %{$ubux8664config{object}{$type}{$name}}){ send_msg(2, " $attr = $ubux8664config{object}{$type}{$name}{$attr};"); - &runcmd( " echo $attr=$ubux8664config{object}{$type}{$name}{$attr}>>defaultubux8664.conf"); + &runcmd( " echo $attr=$ubux8664config{object}{$type}{$name}{$attr}>>$confdir/defaultubux8664.conf"); } } } @@ -457,17 +460,17 @@ sub config_test { if(exists $rhppc64config{table}){ foreach my $type (keys %{$rhppc64config{table}}){ send_msg(2, "TABLE:$type"); - &runcmd( " echo [Table_$type]>>default.conf"); + &runcmd( " echo [Table_$type]>>$confdir/default.conf"); #&runcmd( " echo key=$type>>default.conf"); #&runcmd( " echo [Table_site]>>default.conf"); #&runcmd( " echo key=$type>>default.conf"); foreach my $name (keys %{$rhppc64config{table}{$type}}){ send_msg(2, " $rhppc64config{table}{$type}{$name}{__KEY__} = $name"); - &runcmd( " echo $rhppc64config{table}{$type}{$name}{__KEY__}=$name>>default.conf"); + &runcmd( " echo $rhppc64config{table}{$type}{$name}{__KEY__}=$name>>$confdir/default.conf"); foreach my $attr (keys %{$rhppc64config{table}{$type}{$name}}){ if($attr ne '__KEY__'){ send_msg(2, " $attr = $rhppc64config{table}{$type}{$name}{$attr}"); - &runcmd( " echo $attr=$rhppc64config{table}{$type}{$name}{$attr}>>default.conf"); + &runcmd( " echo $attr=$rhppc64config{table}{$type}{$name}{$attr}>>$confdir/default.conf"); } } send_msg(2, "\n"); @@ -477,17 +480,17 @@ sub config_test { if(exists $slesppc64config{table}){ foreach my $type (keys %{$slesppc64config{table}}){ send_msg(2, "TABLE:$type"); - &runcmd( " echo [Table_$type]>>defaultslesppc64.conf"); + &runcmd( " echo [Table_$type]>>$confdir/defaultslesppc64.conf"); #&runcmd( " echo key=$type>>default.conf"); #&runcmd( " echo [Table_site]>>default.conf"); #&runcmd( " echo key=$type>>default.conf"); foreach my $name (keys %{$slesppc64config{table}{$type}}){ send_msg(2, " $slesppc64config{table}{$type}{$name}{__KEY__} = $name"); - &runcmd( " echo $slesppc64config{table}{$type}{$name}{__KEY__}=$name>>defaultslesppc64.conf"); + &runcmd( " echo $slesppc64config{table}{$type}{$name}{__KEY__}=$name>>$confdir/defaultslesppc64.conf"); foreach my $attr (keys %{$slesppc64config{table}{$type}{$name}}){ if($attr ne '__KEY__'){ send_msg(2, " $attr = $slesppc64config{table}{$type}{$name}{$attr}"); - &runcmd( " echo $attr=$slesppc64config{table}{$type}{$name}{$attr}>>defaultslesppc64.conf"); + &runcmd( " echo $attr=$slesppc64config{table}{$type}{$name}{$attr}>>$confdir/defaultslesppc64.conf"); } } send_msg(2, "\n"); @@ -497,17 +500,17 @@ sub config_test { if(exists $rhx8664config{table}){ foreach my $type (keys %{$rhx8664config{table}}){ send_msg(2, "TABLE:$type"); - &runcmd( " echo [Table_$type]>>defaultrhx8664.conf"); + &runcmd( " echo [Table_$type]>>$confdir/defaultrhx8664.conf"); #&runcmd( " echo key=$type>>default.conf"); #&runcmd( " echo [Table_site]>>default.conf"); #&runcmd( " echo key=$type>>default.conf"); foreach my $name (keys %{$rhx8664config{table}{$type}}){ send_msg(2, " $rhx8664config{table}{$type}{$name}{__KEY__} = $name"); - &runcmd( " echo $rhx8664config{table}{$type}{$name}{__KEY__}=$name>>defaultrhx8664.conf"); + &runcmd( " echo $rhx8664config{table}{$type}{$name}{__KEY__}=$name>>$confdir/defaultrhx8664.conf"); foreach my $attr (keys %{$rhx8664config{table}{$type}{$name}}){ if($attr ne '__KEY__'){ send_msg(2, " $attr = $rhx8664config{table}{$type}{$name}{$attr}"); - &runcmd( " echo $attr=$rhx8664config{table}{$type}{$name}{$attr}>>defaultrhx8664.conf"); + &runcmd( " echo $attr=$rhx8664config{table}{$type}{$name}{$attr}>>$confdir/defaultrhx8664.conf"); } } send_msg(2, "\n"); @@ -517,17 +520,17 @@ sub config_test { if(exists $slesx8664config{table}){ foreach my $type (keys %{$slesx8664config{table}}){ send_msg(2, "TABLE:$type"); - &runcmd( " echo [Table_$type]>>defaultslesx8664.conf"); + &runcmd( " echo [Table_$type]>>$confdir/defaultslesx8664.conf"); #&runcmd( " echo key=$type>>default.conf"); #&runcmd( " echo [Table_site]>>default.conf"); #&runcmd( " echo key=$type>>default.conf"); foreach my $name (keys %{$slesx8664config{table}{$type}}){ send_msg(2, " $slesx8664config{table}{$type}{$name}{__KEY__} = $name"); - &runcmd( " echo $slesx8664config{table}{$type}{$name}{__KEY__}=$name>>defaultslesx8664.conf"); + &runcmd( " echo $slesx8664config{table}{$type}{$name}{__KEY__}=$name>>$confdir/defaultslesx8664.conf"); foreach my $attr (keys %{$slesx8664config{table}{$type}{$name}}){ if($attr ne '__KEY__'){ send_msg(2, " $attr = $slesx8664config{table}{$type}{$name}{$attr}"); - &runcmd( " echo $attr=$slesx8664config{table}{$type}{$name}{$attr}>>defaultslesx8664.conf"); + &runcmd( " echo $attr=$slesx8664config{table}{$type}{$name}{$attr}>>$confdir/defaultslesx8664.conf"); } } send_msg(2, "\n"); @@ -537,17 +540,17 @@ sub config_test { if(exists $ubux8664config{table}){ foreach my $type (keys %{$ubux8664config{table}}){ send_msg(2, "TABLE:$type"); - &runcmd( " echo [Table_$type]>>defaultubux8664.conf"); + &runcmd( " echo [Table_$type]>>$confdir/defaultubux8664.conf"); #&runcmd( " echo key=$type>>default.conf"); #&runcmd( " echo [Table_site]>>default.conf"); #&runcmd( " echo key=$type>>default.conf"); foreach my $name (keys %{$ubux8664config{table}{$type}}){ send_msg(2, " $ubux8664config{table}{$type}{$name}{__KEY__} = $name"); - &runcmd( " echo $ubux8664config{table}{$type}{$name}{__KEY__}=$name>>defaultubux8664.conf"); + &runcmd( " echo $ubux8664config{table}{$type}{$name}{__KEY__}=$name>>$confdir/defaultubux8664.conf"); foreach my $attr (keys %{$ubux8664config{table}{$type}{$name}}){ if($attr ne '__KEY__'){ send_msg(2, " $attr = $ubux8664config{table}{$type}{$name}{$attr}"); - &runcmd( " echo $attr=$ubux8664config{table}{$type}{$name}{$attr}>>defaultubux8664.conf"); + &runcmd( " echo $attr=$ubux8664config{table}{$type}{$name}{$attr}>>$confdir/defaultubux8664.conf"); } } send_msg(2, "\n"); @@ -574,10 +577,10 @@ sub config_test { #&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts"); #print "MN is $MN\n";} send_msg(2, "Varible:"); - &runcmd( " echo [System]>>default.conf"); + &runcmd( " echo [System]>>$confdir/default.conf"); foreach my $varname (keys %{$rhppc64config{var}}){ send_msg(2, " $varname = $rhppc64config{var}{$varname}"); - &runcmd( " echo $varname=$rhppc64config{var}{$varname}>>default.conf"); + &runcmd( " echo $varname=$rhppc64config{var}{$varname}>>$confdir/default.conf"); #print "var is $rhppc64config{var}\n"; } } @@ -587,10 +590,10 @@ sub config_test { #&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts"); #print "MN is $MN\n";} send_msg(2, "Varible:"); - &runcmd( " echo [System]>>defaultslesppc64.conf"); + &runcmd( " echo [System]>>$confdir/defaultslesppc64.conf"); foreach my $varname (keys %{$slesppc64config{var}}){ send_msg(2, " $varname = $slesppc64config{var}{$varname}"); - &runcmd( " echo $varname=$slesppc64config{var}{$varname}>>defaultslesppc64.conf"); + &runcmd( " echo $varname=$slesppc64config{var}{$varname}>>$confdir/defaultslesppc64.conf"); #print "var is $slesppc64config{var}\n"; } } @@ -600,10 +603,10 @@ sub config_test { #&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts"); #print "MN is $MN\n";} send_msg(2, "Varible:"); - &runcmd( " echo [System]>>defaultrhx8664.conf"); + &runcmd( " echo [System]>>$confdir/defaultrhx8664.conf"); foreach my $varname (keys %{$rhx8664config{var}}){ send_msg(2, " $varname = $rhx8664config{var}{$varname}"); - &runcmd( " echo $varname=$rhx8664config{var}{$varname}>>defaultrhx8664.conf"); + &runcmd( " echo $varname=$rhx8664config{var}{$varname}>>$confdir/defaultrhx8664.conf"); #print "var is $rhppc64config{var}\n"; } } @@ -613,10 +616,10 @@ sub config_test { #&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts"); #print "MN is $MN\n";} send_msg(2, "Varible:"); - &runcmd( " echo [System]>>defaultslesx8664.conf"); + &runcmd( " echo [System]>>$confdir/defaultslesx8664.conf"); foreach my $varname (keys %{$slesx8664config{var}}){ send_msg(2, " $varname = $slesx8664config{var}{$varname}"); - &runcmd( " echo $varname=$slesx8664config{var}{$varname}>>defaultslesx8664.conf"); + &runcmd( " echo $varname=$slesx8664config{var}{$varname}>>$confdir/defaultslesx8664.conf"); #print "var is $rhppc64config{var}\n"; } } @@ -626,10 +629,10 @@ sub config_test { #&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts"); #print "MN is $MN\n";} send_msg(2, "Varible:"); - &runcmd( " echo [System]>>defaultubux8664.conf"); + &runcmd( " echo [System]>>$confdir/defaultubux8664.conf"); foreach my $varname (keys %{$ubux8664config{var}}){ send_msg(2, " $varname = $ubux8664config{var}{$varname}"); - &runcmd( " echo $varname=$ubux8664config{var}{$varname}>>defaultubux8664.conf"); + &runcmd( " echo $varname=$ubux8664config{var}{$varname}>>$confdir/defaultubux8664.conf"); #print "var is $rhppc64config{var}\n"; } } @@ -800,27 +803,36 @@ sub config_mn { sub gettestinfo { my $mn = shift; my $testenvinfo = undef; -my @osname = runcmd("xdsh $mn uname -a "); -my @release = runcmd("xdsh $mn cat /etc/*release"); -my @osinfo = runcmd("xdsh $mn lsb_release -a"); -if ( $osname [0] =~ /Linux/ && $osname [0] =~ /ppc64/ && $release [1] =~ /Red Hat Enterprise Linux Server release 6.5/){ - print "MN info is redhat ppc 64 "; +my $osinfoconf = "/regression/lsbinfo"; +runcmd("xdsh $mn lsb_release -a > $osinfoconf"); +send_msg(2, "=============gettestinf=============="); +my $os = 2; +my $osenv = 2; +my $osubu = 2; +$os = system("cat $osinfoconf |grep RedHat"); +$osenv = system("cat $osinfoconf |grep ppc64"); +$osubu = system("cat $configfile |grep Ubuntu"); +if (($osenv == 0)&&($os == 0)){ $testenvinfo = "rhppc64"; -}elsif ( $osinfo [2] =~ /SUSE Linux Enterprise Server 11/ && $osinfo [2] =~ /ppc64/){ - print " MN info is sles 11.3 ppc64 "; + print "MN osinfo is $testenvinfo"; +}elsif (($osenv == 0)&&($os == 256)){ $testenvinfo = "slesppc64"; -}elsif ( $osinfo [2] =~ /SUSE Linux Enterprise Server 11/ && $osinfo [2] =~ /x86_64/){ - print " MN info is sles 11.3 x86_64 "; - $testenvinfo = "slesx8664"; -}elsif ( $osinfo [0] =~ /amd64/ && $osinfo [2] =~ /Red Hat Enterprise Linux Server release 6.5/){ - print "MN info is redhat 6.5 x86_64 \n"; + print "MN osinfo is $testenvinfo"; +}elsif (($osenv == 256)&&($os == 0)){ $testenvinfo = "rhx8664"; - -}elsif ( $osinfo [1] =~ /Ubuntu/ && $osinfo [1] =~ /12.04/){ - print "MN info is Ubuntu 12.04 x86_64 \n"; + print "MN osinfo is $testenvinfo"; +}elsif (($osenv == 256)&&($os == 256)){ + $testenvinfo = "slesx8664"; + print "MN osinfo is $testenvinfo"; +}elsif ($osubu == 0){ $testenvinfo = "ubux8664"; -}else - {print "no machine info ";} + print "MN osinfo is $testenvinfo"; +} +else + { + send_msg(0, "no machine info"); + } + send_msg(2, "testenvinfo is $testenvinfo"); return $testenvinfo; } @@ -829,6 +841,8 @@ sub init my $mn = shift; my $MN=$mn; my $envoutput = &gettestinfo($mn); + send_msg(2, "****************************** MNinit is $mn "); + send_msg(2, "==================in init function================"); if ($envoutput eq 'rhppc64'){ my $nodedir=$confkeys{rhpdir}; my $iso=$rhppc64config{var}{ISO}; @@ -843,7 +857,7 @@ sub init print "--get the latest XCAT tarball.......\n"; $res = system("scp -r $nodedir/xcat-dep $MN:/"); &repo(); - system("scp -r rhel6.5.repo $MN:/etc/yum.repos.d/rhel6.5.repo"); + system("scp -r $confdir/rhel6.5.repo $MN:/etc/yum.repos.d/rhel6.5.repo"); system("xdsh $MN perl /xcat-dep/rh6/ppc64/mklocalrepo.sh"); print "--install XCAT .......\n"; system("xdsh $MN rpm --import /iso/mountpoint/RPM-GPG-KEY-redhat-release"); @@ -852,12 +866,10 @@ sub init system("xdsh $MN yum -y install perl-xCAT xCAT-client xCAT-server xCAT"); print "--install XCATTEST .......\n"; system("xdsh $MN yum -y install xCAT-test"); - system("scp -r default.conf $MN:$testconfigfile"); - system("rm -rf default.conf"); - system("rm -rf rhel6.5.repo"); - system("xdsh $MN yum -y install screen"); - system("xdsh $MN yum -y install mysql-server mysql mysql-bench mysql-devel mysql-connector-odbc"); - #system("xdsh $MN sysctl -n net.ipv4.ip_forward=1"); + system("scp -r $confdir/default.conf $MN:$testconfigfile"); + system("xdsh $MN yum -y install screen"); + system("xdsh $MN yum -y install mysql-server mysql mysql-bench mysql-devel mysql-connector-odbc"); + #system("xdsh $MN sysctl -n net.ipv4.ip_forward=1"); $res = system("xdsh $MN source /etc/profile.d/xcat.sh"); #if ($res != 0){ #send_msg(0, "install xCAT failed on rhpmn"); @@ -893,8 +905,7 @@ sub init system("xdsh $MN zypper -n install xCAT"); system("xdsh $MN zypper -n install xCAT-test"); system("xdsh $MN zypper -n install lsb"); - system("scp -r defaultslesppc64.conf $MN:$testconfigfile"); - system("rm -rf defaultslesppc64.conf"); + system("scp -r $confdir/defaultslesppc64.conf $MN:$testconfigfile"); print "--prepare test environment....\n"; print "[OK]\n"; }elsif ($envoutput eq 'rhx8664'){ @@ -912,7 +923,7 @@ sub init print "--get the latest XCAT tarball.......\n"; system("scp -r $nodedir/xcat-dep $MN:/"); &repo(); - system("scp -r rhel6.5.repo $MN:/etc/yum.repos.d/"); + system("scp -r $confdir/rhel6.5.repo $MN:/etc/yum.repos.d/"); system("xdsh $MN perl /xcat-dep/rh6/ppc64/mklocalrepo.sh"); print "--install XCAT .......\n"; system("xdsh $MN yum clean metadata"); @@ -925,9 +936,7 @@ sub init system("xdsh $MN yum -y install screen"); system("xdsh $MN yum -y install mysql-server mysql mysql-bench mysql-devel mysql-connector-odbc"); system("xdsh $MN yum -y install iscsi-initiator-utils bridge-utils kvm perl-Sys-Virt perl-Sys-Virt.x86_64 libvirt.x86_64 qemu-kvm.x86_64 "); - system("scp -r defaultrhx8664.conf $MN:$testconfigfile"); - system("rm -rf defaultrhx8664.conf"); - system("rm -rf rhel6.5.repo"); + system("scp -r $confdir/defaultrhx8664.conf $MN:$testconfigfile"); }elsif ($envoutput eq 'slesx8664'){ my $nodedir=$confkeys{slesxdir}; my $iso=$slesx8664config{var}{ISO}; @@ -954,8 +963,7 @@ sub init system("xdsh $MN zypper -n xCAT-test*"); print "--prepare test environment....\n"; system("xdsh $MN zypper -n install iscsi-initiator-utils bridge-utils kvm perl-Sys-Virt perl-Sys-Virt.x86_64 libvirt.x86_64 qemu-kvm.x86_64"); - system("scp -r defaultslesx8664.conf $MN:$testconfigfile"); - system("rm -rf defaultslesx8664.conf"); + system("scp -r $confdir/defaultslesx8664.conf $MN:$testconfigfile"); print "--prepare vmslestest environment....\n"; print "[OK]\n"; }elsif ($envoutput eq 'ubux8664'){ @@ -992,10 +1000,9 @@ sub init system("xdsh $MN source /etc/profile.d/xcat.sh"); system("xdsh $MN apt-get install xcat-test"); print "--prepare test environment....\n"; - system("scp -r defaultubux8664.conf $MN:$testconfigfile"); + system("scp -r $confdir/defaultubux8664.conf $MN:$testconfigfile"); print "--prepare vmubuntu test environment....\n"; print "[OK]\n";} - system("rm -rf default*.conf"); return 0; } ####################################### @@ -1181,11 +1188,11 @@ sub trim { #repo #################################### sub repo{ - &runcmd( " echo [rhe-6.5-server]>>rhel6.5.repo"); - &runcmd( " echo name=RHEL 6.5 SERVER packages>>rhel6.5.repo"); - &runcmd(" echo baseurl=file:///iso/mountpoint/Server/>>rhel6.5.repo"); - &runcmd(" echo enabled=1>>rhel6.5.repo"); - &runcmd(" echo gpgcheck=1>>rhel6.5.repo"); + &runcmd( " echo [rhe-6.5-server]>>$confdir/rhel6.5.repo"); + &runcmd( " echo name=RHEL 6.5 SERVER packages>>$confdir/rhel6.5.repo"); + &runcmd(" echo baseurl=file:///iso/mountpoint/Server/>>$confdir/rhel6.5.repo"); + &runcmd(" echo enabled=1>>$confdir/rhel6.5.repo"); + &runcmd(" echo gpgcheck=1>>$confdir/rhel6.5.repo"); } From e140fcd04034271fedb1eba4a14ec2ee6597bda1 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 29 Aug 2014 07:29:32 -0400 Subject: [PATCH 031/110] defect 4262 --- xCAT-server/lib/xcat/plugins/osdistro.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/osdistro.pm b/xCAT-server/lib/xcat/plugins/osdistro.pm index beccf7f47..4fc2c3cbc 100644 --- a/xCAT-server/lib/xcat/plugins/osdistro.pm +++ b/xCAT-server/lib/xcat/plugins/osdistro.pm @@ -95,7 +95,6 @@ sub getOSdistroref { return undef; } - # verified this does work on DB2 my @clause=(); @@ -259,7 +258,7 @@ sub rmosdistro #remove the osdistro entry $osdistrotab->delEntries(\%keyhash); $osdistrotab->commit; - $callback->({info=>"rmosdistro: remove $_ success",errorcode=>[0]}); + $callback->({info=>["rmosdistro: remove $_ success"],errorcode=>[0]}) } From eb5655a9e49c5c655b35fb4a86cb371548f1cae3 Mon Sep 17 00:00:00 2001 From: qyin Date: Mon, 1 Sep 2014 10:46:05 +0800 Subject: [PATCH 032/110] fix issue 241844 The added os packages are not installed when reinstall nodes. --- xCAT-server/lib/xcat/plugins/profilednodes.pm | 52 ++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index 59011633c..d309ecdeb 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -809,38 +809,55 @@ Usage: } } + #fix 241844 issue, use local variable to store args_dict value + my $imageprofile = undef; + my $networkprofile = undef; + my $hardwareprofile = undef; + + if(exists $args_dict{'imageprofile'}){ + $imageprofile = $args_dict{'imageprofile'}; + } + + if(exists $args_dict{'networkprofile'}){ + $networkprofile = $args_dict{'networkprofile'}; + } + + if(exists $args_dict{'hardwareprofile'}){ + $hardwareprofile = $args_dict{'hardwareprofile'}; + } + # After checking, all nodes' profile should be same # Get the new profile with specified ones in args_dict my $changeflag = 0; my $profile_groups; my $profile_status; - if(exists $args_dict{'networkprofile'}){ - $profile_groups .= $args_dict{'networkprofile'}.","; - if ($args_dict{'networkprofile'} ne $nodeoldprofiles{'networkprofile'}){ + if($networkprofile){ + $profile_groups .= $networkprofile . ","; + if ($networkprofile ne $nodeoldprofiles{'networkprofile'}){ $changeflag = 1; }else{ xCAT::MsgUtils->message('S', "Specified networkprofile is same with current value, ignore."); - delete($args_dict{'networkprofile'}); + $networkprofile = undef; } } - if(exists $args_dict{'hardwareprofile'}){ - $profile_groups .= $args_dict{'hardwareprofile'}.","; - if ($args_dict{'hardwareprofile'} ne $nodeoldprofiles{'hardwareprofile'}){ + if($hardwareprofile){ + $profile_groups .= $hardwareprofile . ","; + if ($hardwareprofile ne $nodeoldprofiles{'hardwareprofile'}){ $profile_status = 'defined'; $changeflag = 1; }else{ xCAT::MsgUtils->message('S', "Specified hardwareprofile is same with current value, ignore."); - delete($args_dict{'hardwareprofile'}); + $hardwareprofile = undef; } } - if(exists $args_dict{'imageprofile'}){ - $profile_groups .= $args_dict{'imageprofile'}.","; - if ($args_dict{'imageprofile'} ne $nodeoldprofiles{'imageprofile'}){ + if($imageprofile){ + $profile_groups .= $imageprofile . ","; + if ($imageprofile ne $nodeoldprofiles{'imageprofile'}){ $profile_status = 'defined'; $changeflag = 1; }else{ xCAT::MsgUtils->message('S', "Specified imageprofile is same with current value, ignore."); - delete($args_dict{'imageprofile'}); + $imageprofile = undef; } } # make sure there are something changed, otherwise we should quit without any changes. @@ -870,8 +887,8 @@ Usage: # If network profile specified. Need re-generate IPs for all nodess again. # As new design, ignore BMC/FSP NIC while reinstall nodes - if(exists $args_dict{'networkprofile'}){ - my $newNetProfileName = $args_dict{'networkprofile'}; + if($networkprofile){ + my $newNetProfileName = $networkprofile; my $oldNetProfileName = $nodeoldprofiles{'networkprofile'}; my $newNicsRef = xCAT::ProfiledNodeUtils->get_nodes_nic_attrs([$newNetProfileName])->{$newNetProfileName}; @@ -909,10 +926,7 @@ Usage: # hardware profile changed or # image profile changed or # network profile changed. - if ((exists $args_dict{'networkprofile'}) or - (exists $args_dict{'hardwareprofile'}) or - (exists $args_dict{'imageprofile'})){ - + if (($imageprofile) or ($networkprofile) or ($hardwareprofile)){ my $nodetypetab = xCAT::Table->new('nodetype'); my $firstnode = $nodes->[0]; my $profiles = xCAT::ProfiledNodeUtils->get_nodes_profiles([$firstnode], 1); @@ -924,7 +938,7 @@ Usage: # If we have hardware changes, reconfigure everything including BMC. my $chainret = 0; my $chainstr = ""; - if(exists $args_dict{'hardwareprofile'}){ + if($hardwareprofile){ ($chainret, $chainstr) = xCAT::ProfiledNodeUtils->gen_chain_for_profiles($profiles->{$firstnode}, 1); } else { ($chainret, $chainstr) = xCAT::ProfiledNodeUtils->gen_chain_for_profiles($profiles->{$firstnode}, 0); From fda569d34042bead781dbf211b098ec9532c0aef Mon Sep 17 00:00:00 2001 From: immarvin Date: Sun, 31 Aug 2014 20:33:29 -0700 Subject: [PATCH 033/110] fix defect #4263 Some packages in pkglist file are not exist in RHEL7 --- xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist | 2 +- xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist index aee31ff58..3f6a557e3 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist @@ -20,6 +20,6 @@ e2fsprogs bc lsvpd irqbalance -procps +procps-ng parted net-tools diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist index 410cd004c..3e720d729 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist @@ -9,7 +9,7 @@ openssh-clients iputils bc irqbalance -procps +procps-nprocps-ngg wget vim-minimal ntp From 9fae510b2e56a4e5455c4fa6bb5cdb24aba911cc Mon Sep 17 00:00:00 2001 From: immarvin Date: Sun, 31 Aug 2014 20:52:56 -0700 Subject: [PATCH 034/110] correct a typo --- xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist index 3e720d729..87a71d977 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist @@ -9,7 +9,7 @@ openssh-clients iputils bc irqbalance -procps-nprocps-ngg +procps-ng wget vim-minimal ntp From 18a3c268643b43ed3b59570bf8a258859c83fa94 Mon Sep 17 00:00:00 2001 From: ligc Date: Sun, 31 Aug 2014 23:24:42 -0400 Subject: [PATCH 035/110] fix for bug 4265: remove getxcatdocs from PCM build --- buildcore.sh | 7 ++++--- xCAT-client/xCAT-client.spec | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/buildcore.sh b/buildcore.sh index 770bdd58b..3517040e2 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -44,10 +44,11 @@ FRS=/home/frs/project/x/xc/xcat ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack xCAT-SoftLayer xCAT-OpenStack-baremetal" ZVMBUILD="perl-xCAT xCAT-server xCAT-UI" ZVMLINK="xCAT-client xCAT xCATsn" -# xCAT has PCM specific configuration - conserver-xcat, syslinux-xcat +# xCAT and xCATsn have PCM specific configuration - conserver-xcat, syslinux-xcat # xCAT-server has PCM specific configuration - RESTAPI(perl-JSON) -PCMBUILD="xCAT xCAT-server xCATsn" -PCMLINK="perl-xCAT xCAT-client xCAT-buildkit xCAT-genesis-scripts-x86_64" +# xCAT-client has PCM specific configuration - getxcatdocs(perl-JSON) +PCMBUILD="xCAT xCAT-server xCAT-client xCATsn" +PCMLINK="perl-xCAT xCAT-buildkit xCAT-genesis-scripts-x86_64" # Note: for FSM, the FlexCAT rpm is built separately from gsa/git FSMBUILD="perl-xCAT xCAT-client xCAT-server" FSMLINK="" diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index d507ea06b..fc7ffcbb8 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -13,6 +13,8 @@ Prefix: /opt/xcat BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root %define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi) +%define pcm %(if [ "$pcm" = "1" ];then echo 1; else echo 0; fi) +%define notpcm %(if [ "$pcm" = "1" ];then echo 0; else echo 1; fi) # AIX will build with an arch of "ppc" %ifos linux @@ -115,6 +117,14 @@ cp share/xcat/tools/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/tools #cp usr/share/xcat/scripts/setup-local-client.sh $RPM_BUILD_ROOT/usr/share/xcat/scripts/setup-local-client.sh #chmod 755 $RPM_BUILD_ROOT/usr/share/xcat/scripts/setup-local-client.sh +# PCM does not need getxcatdocs +# getxcatdocs causes xCAT-client requires perl-JSON, which is not shipped with PCM +%if %pcm +rm -f $RPM_BUILD_ROOT/%{prefix}/bin/getxcatdocs +rm -f $RPM_BUILD_ROOT/%{prefix}/share/doc/man1/getxcatdocs.1.html +rm -f $RPM_BUILD_ROOT/%{prefix}/share/man/man1/getxcatdocs.1 +%endif + # These links get made in the RPM_BUILD_ROOT/prefix area ln -sf xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/rpower ln -sf xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/rscan From 027d4ff52a5ab53aa4b657bfccb79382d3ad7ad4 Mon Sep 17 00:00:00 2001 From: huweihua Date: Mon, 1 Sep 2014 04:00:47 -0400 Subject: [PATCH 036/110] add some exclude file for support system p --- xCAT/postscripts/syscloneimgupdate | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/syscloneimgupdate b/xCAT/postscripts/syscloneimgupdate index 645ba7925..add1e21be 100755 --- a/xCAT/postscripts/syscloneimgupdate +++ b/xCAT/postscripts/syscloneimgupdate @@ -13,7 +13,27 @@ fi #update the exclude configuration file #do not sync the following files -for filename in /etc/fstab /boot/grub /etc/grub.conf /boot/efi /etc/elilo.conf /xcatpost /etc/xcat /etc/hosts /etc/udev/rules.d /etc/modprobe.d/bond0.conf /etc/modprobe.d/bond1.conf /etc/ssh /etc/sysconfig/syslog /etc/syslog-ng/syslog-ng.conf /opt/xcat /root/.ssh /var/cache /var/lib +for filename in \ + /boot/efi \ + /boot/grub \ + /etc/fstab \ + /etc/grub.conf \ + /etc/lilo.conf \ + /etc/elilo.conf \ + /etc/xcat \ + /etc/yaboot.conf \ + /etc/hosts \ + /etc/udev/rules.d \ + /etc/modprobe.d/bond0.conf \ + /etc/modprobe.d/bond1.conf \ + /etc/ssh \ + /etc/sysconfig/syslog \ + /etc/syslog-ng/syslog-ng.conf \ + /opt/xcat \ + /root/.ssh \ + /var/cache \ + /var/lib \ + /xcatpost do if [ ! -e $filename ];then continue From ab8e64217fdfc409fb83a5d5d164e568ec5ae854 Mon Sep 17 00:00:00 2001 From: huweihua Date: Mon, 1 Sep 2014 04:03:49 -0400 Subject: [PATCH 037/110] move Prep partition flag setting to imgcapture.pm --- xCAT/postscripts/configefi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/configefi b/xCAT/postscripts/configefi index 5ad3c302d..1fc433126 100644 --- a/xCAT/postscripts/configefi +++ b/xCAT/postscripts/configefi @@ -92,14 +92,14 @@ elif [ "$arch" = "ppc64" ]; then dd if=/usr/lib/yaboot/yaboot of=/dev/sda1 bs=4096 # Set 0x41 as the partition type of the first partition - echo A | dd of=/dev/sda bs=1 count=1 seek=450 + # echo A | dd of=/dev/sda bs=1 count=1 seek=450 elif [ -f "/lib/lilo/pmac/yaboot" ]; then # set bootloader echo "dd if=/lib/lilo/pmac/yaboot of=/dev/sda1 bs=4096" dd if=/lib/lilo/pmac/yaboot of=/dev/sda1 bs=4096 # Set 0x41 as the partition type of the first partition - echo A | dd of=/dev/sda bs=1 count=1 seek=450 + # echo A | dd of=/dev/sda bs=1 count=1 seek=450 else echo "there isn't yaboot bootloader" fi From 201fb1871bd49fb74b73e0ca96290a11cc40b287 Mon Sep 17 00:00:00 2001 From: huweihua Date: Mon, 1 Sep 2014 04:08:01 -0400 Subject: [PATCH 038/110] add Prep partition flag setting --- xCAT-server/lib/xcat/plugins/imgcapture.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/imgcapture.pm b/xCAT-server/lib/xcat/plugins/imgcapture.pm index 26e58572f..d679516ac 100644 --- a/xCAT-server/lib/xcat/plugins/imgcapture.pm +++ b/xCAT-server/lib/xcat/plugins/imgcapture.pm @@ -618,6 +618,22 @@ sub sysclone_prepclient { }, $subreq, 0, 1); + my @nodes = ($node); + my $nodetypetab = xCAT::Table->new("nodetype"); + my $nthash = $nodetypetab->getNodesAttribs(\@nodes, ['arch']); + my $tmp = $nthash->{$node}->[0]->{arch}; + if ( $tmp eq 'ppc64'){ + $cmd = qq(if ! cat /etc/systemimager/autoinstallscript.conf |grep 'part num=\\\"1\\\"' |grep 'id=' >/dev/null ;then sed -i 's:\\(.*\\ +):\\1 id=\\\"41\\\" \\2:' /etc/systemimager/autoinstallscript.conf;fi); + $output = xCAT::Utils->runxcmd( + { + command => ["xdsh"], + node => [$node], + arg =>[$cmd] + }, + $subreq, 0, 1); + } + return 0; } From 8a6b60a7699d1e5b25f31a3d8b0c2145098900c5 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 2 Sep 2014 01:54:01 -0700 Subject: [PATCH 039/110] #4262 The type of error message in rmosdistro is not string ref --- xCAT-server/lib/xcat/plugins/osdistro.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/osdistro.pm b/xCAT-server/lib/xcat/plugins/osdistro.pm index 4fc2c3cbc..6b653db50 100644 --- a/xCAT-server/lib/xcat/plugins/osdistro.pm +++ b/xCAT-server/lib/xcat/plugins/osdistro.pm @@ -157,7 +157,7 @@ sub rmosdistro if ($help) { - $callback->({info=>"rmosdistro [{-a|--all}] [-f|--force] [osdistroname] ...",errorcode=>[0]}); + $callback->({info=>["rmosdistro [{-a|--all}] [-f|--force] [osdistroname] ..."],errorcode=>[0]}); return; } @@ -165,7 +165,7 @@ sub rmosdistro { unless(scalar @ARGV) { - $callback->({info=>"please specify osdistroname to remove, or specify \"-a|--all\" to remove all osdistros ",errorcode=>[1]}); + $callback->({info=>["please specify osdistroname to remove, or specify \"-a|--all\" to remove all osdistros "],errorcode=>[1]}); return; } #if any osdistro has been specified,push it into array @@ -175,7 +175,7 @@ sub rmosdistro my $osdistrotab = xCAT::Table->new('osdistro',-create=>1); unless($osdistrotab) { - $callback->({error=>"rmosdistro: failed to open table 'osdistro'!",errorcode=>[1]}); + $callback->({error=>["rmosdistro: failed to open table 'osdistro'!"],errorcode=>[1]}); return; } @@ -202,7 +202,7 @@ sub rmosdistro $osimagetab=xCAT::Table->new('osimage'); unless($osimagetab) { - $callback->({error=>"rmosdistro: failed to open table 'osimage'!",errorcode=>[1]}); + $callback->({error=>["rmosdistro: failed to open table 'osimage'!"],errorcode=>[1]}); $osdistrotab->close(); return; } @@ -217,7 +217,7 @@ sub rmosdistro my $result=&getOSdistroref($osimagetab,$_); if($result) { - $callback->({error=>"rmosdistro: failed to remove $_, it is referenced by osimages:\n$result\nretry with -f option !",errorcode=>[1]}); + $callback->({error=>["rmosdistro: failed to remove $_, it is referenced by osimages:\n$result\nretry with -f option !"],errorcode=>[1]}); next; } } @@ -227,7 +227,7 @@ sub rmosdistro my $result=$osdistrotab->getAttribs(\%keyhash,'dirpaths','basename','majorversion','minorversion','arch'); unless($result) { - $callback->({error=>"rmosdistro: $keyhash{osdistroname} not exist!",errorcode=>[1]}); + $callback->({error=>["rmosdistro: $keyhash{osdistroname} not exist!"],errorcode=>[1]}); next; } @@ -239,7 +239,7 @@ sub rmosdistro system("rm -rf $result->{'dirpaths'}"); if($? != 0) { - $callback->({error=>"rmosdistro: failed to remove $keyhash{osdistroname} directory!",errorcode=>[1]}); + $callback->({error=>["rmosdistro: failed to remove $keyhash{osdistroname} directory!"],errorcode=>[1]}); next; } } From 573fc1790fc54b1563beb4744e98d74515248206 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 2 Sep 2014 10:37:23 -0400 Subject: [PATCH 040/110] Mellanox renamed their driver in later kernels. If new name detected, substitute it --- xCAT-server/share/xcat/netboot/rh/genimage | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 8c4ced961..e142715bf 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -543,6 +543,11 @@ if (@new_order) { @ndrivers = (@new_order, @ndrivers); } +if (-f "$rootimg_dir/lib/modules/$kernelver/kernel/drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko") { + for (@ndrivers) { + s/mlx_en/mlx4_en/; + } +} open($moddeps,"<","$rootimg_dir/lib/modules/$kernelver/modules.dep"); my @moddeps = <$moddeps>; my @checkdeps = @ndrivers; From d8faafb4b43ce83fd9b089ff9a0cb457554357ca Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 3 Sep 2014 01:21:22 -0700 Subject: [PATCH 041/110] add option "password" for rspconfig to change password for default user through IPMI --- xCAT-server/lib/xcat/plugins/ipmi.pm | 55 +++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 6138d0c86..fbfde9964 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -510,7 +510,11 @@ sub on_bmc_connect { } elsif($command eq "rspconfig") { shift @{$sessdata->{extraargs}}; if ($sessdata->{subcommand} =~ /=/) { - setnetinfo($sessdata); + if ($sessdata->{subcommand} =~ /password/) { + setpassword($sessdata); + } else { + setnetinfo($sessdata); + } } else { getnetinfo($sessdata); } @@ -635,6 +639,55 @@ sub resetedbmc { } } +sub setpassword { + my $sessdata = shift; + my $subcommand = $sessdata->{subcommand}; + my $argument; + ($subcommand, $argument) = split(/=/, $subcommand); + my $netfun = 0x06; + my $command = 0x47; + my @data = (); + @data = unpack("C*", $argument); + if ($#data > 19 or $#data < 0) { + xCAT::SvrUtils::sendmsg([1, "The new password is invalid"],$callback,$sessdata->{node},%allerrornodes); + return(1,"The new password is invalid."); + } + $sessdata->{newpassword}=$argument; + my $index = $#data; + while($index < 19) { # Password must be padded with 0 to 20 bytes for IPMI 2.0 + push @data, 0; + $index += 1; + } + unshift @data, 0x02; # byte 2, operation: 0x00 disable user, 0x01 enable user, 0x02 set password, 0x03 test password + unshift @data, 0x01; # byte 1, userID, User ID 1 is permanently associated with User 1, the null user name + $sessdata->{ipmisession}->subcmd(netfn=>$netfun,command=>$command,data=>\@data,callback=>\&password_set,callback_args=>$sessdata); +} + +sub password_set { + my $rsp = shift; + my $sessdata = shift; + if ($rsp->{error}) { + xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes); + return; + } + if ($rsp->{code}) { + if ($codes{$rsp->{code}}) { + xCAT::SvrUtils::sendmsg([1,$codes{$rsp->{code}}],$callback,$sessdata->{node},%allerrornodes); + } else { + xCAT::SvrUtils::sendmsg([1,sprintf("Unknown ipmi error %02xh",$rsp->{code})],$callback,$sessdata->{node},%allerrornodes); + } + return; + } + my $ipmitab = xCAT::Table->new('ipmi'); + if (!$ipmitab) { + xCAT::SvrUtils::sendmsg([1, "Failed to update ipmi table."],$callback,$sessdata->{node},%allerrornodes); + } else { + $ipmitab->setNodeAttribs($sessdata->{node}, {'password'=>$sessdata->{newpassword}}); + xCAT::SvrUtils::sendmsg("Done",$callback,$sessdata->{node},%allerrornodes); + } + return; +} + sub setnetinfo { my $sessdata = shift; my $subcommand = $sessdata->{subcommand}; From ae5320d82bfce226b3f380df91121b60a5b82b10 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 3 Sep 2014 02:04:27 -0700 Subject: [PATCH 042/110] fix bug 4267:Missing includes for Sys::Syslog in /opt/xcat/lib/perl/xCAT_plugin/petitboot.pm --- xCAT-server/lib/xcat/plugins/petitboot.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index dda254b19..09b87062e 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -4,6 +4,7 @@ package xCAT_plugin::petitboot; use File::Path; use Getopt::Long; use xCAT::Table; +use Sys::Syslog; my $globaltftpdir = xCAT::TableUtils->getTftpDir(); From 447b31ee60dc1f9b77cdc104faa6e3b2a2f066a0 Mon Sep 17 00:00:00 2001 From: huweihua Date: Thu, 4 Sep 2014 02:07:02 -0400 Subject: [PATCH 043/110] modify code format error --- xCAT-server/lib/xcat/plugins/imgcapture.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/imgcapture.pm b/xCAT-server/lib/xcat/plugins/imgcapture.pm index d679516ac..5a2ff9946 100644 --- a/xCAT-server/lib/xcat/plugins/imgcapture.pm +++ b/xCAT-server/lib/xcat/plugins/imgcapture.pm @@ -623,8 +623,7 @@ sub sysclone_prepclient { my $nthash = $nodetypetab->getNodesAttribs(\@nodes, ['arch']); my $tmp = $nthash->{$node}->[0]->{arch}; if ( $tmp eq 'ppc64'){ - $cmd = qq(if ! cat /etc/systemimager/autoinstallscript.conf |grep 'part num=\\\"1\\\"' |grep 'id=' >/dev/null ;then sed -i 's:\\(.*\\ -):\\1 id=\\\"41\\\" \\2:' /etc/systemimager/autoinstallscript.conf;fi); + $cmd = qq(if ! cat /etc/systemimager/autoinstallscript.conf |grep 'part num=\\\"1\\\"' |grep 'id=' >/dev/null ;then sed -i 's:\\(.*\\):\\1 id=\\\"41\\\" \\2:' /etc/systemimager/autoinstallscript.conf;fi); $output = xCAT::Utils->runxcmd( { command => ["xdsh"], From 0f4a6745275ca556bf913054bb8c7ca8365468ff Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Fri, 5 Sep 2014 02:10:54 -0700 Subject: [PATCH 044/110] modify genesis to support system P hardware discovery --- xCAT-genesis-builder/xcat-cmdline.sh | 19 +++++++++++++++ xCAT-genesis-scripts/bin/dodiscovery | 35 +++++++++++++++++++++------- xCAT-genesis-scripts/bin/doxcat | 9 +++++++ 3 files changed, 55 insertions(+), 8 deletions(-) diff --git a/xCAT-genesis-builder/xcat-cmdline.sh b/xCAT-genesis-builder/xcat-cmdline.sh index 1188095f5..00aa2556e 100755 --- a/xCAT-genesis-builder/xcat-cmdline.sh +++ b/xCAT-genesis-builder/xcat-cmdline.sh @@ -38,4 +38,23 @@ if grep console=ttyS /proc/cmdline > /dev/null; then while :; do sleep 1; screen -x console < /dev/tty1 > /dev/tty1 2>&1; clear; done & fi while :; do screen -ln < /dev/tty2 > /dev/tty2 2>&1; done & + +# The section below is just for System P LE hardware discovery + +# Need to wait for NIC initialization +sleep 20 +ARCH=`uname -m` +if [ $ARCH == 'ppc64' ]; then + + ALL_NICS=`ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo` + for tmp in $ALL_NICS; do + tmp_data=`ip link show $tmp | grep -v "^ " | grep "UP"` + if [ "$tmp_data" == "" ]; then + ip link set $tmp up + fi + tmp_data="UP" + sleep 1 + done +fi + while :; do screen -L -ln doxcat; done diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index e4c8dd6c0..426b5bb4f 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -71,10 +71,26 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86 MTM=`cat /sys/devices/virtual/dmi/id/product_name|awk -F'[' '{print $2}'|awk -F']' '{print $1}'` SERIAL=`cat /sys/devices/virtual/dmi/id/product_serial` fi + CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l` + grep "model name" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing + echo $line > /tmp/cpumod + done + CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'` + UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /sys/devices/virtual/dmi/id/product_uuid` + elif [ -r /proc/device-tree/model ]; then #POWER - MTM=`cat /proc/device-tree/model |awk -F, '{print $2}'` + #MTM=`cat /proc/device-tree/model |awk -F, '{print $2}'` + MTM=`cat /proc/device-tree/model | sed -e 's/\^.*,//'` + CPUCOUNT=`cat /proc/cpuinfo |grep -e "^cpu\s*:"|wc -l` + grep -e "^cpu\s*:" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing + echo $line > /tmp/cpumod + done + CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'` + SERIAL=`cat /proc/device-tree/system-id` + UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /proc/sys/kernel/random/uuid` + fi -CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l` +#CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l` # The MEMORY will look like this: 32868920 MEMORY=`cat /proc/meminfo |grep MemTotal|awk '{printf "%.0fMB\n", $2/1024}'` @@ -86,11 +102,11 @@ MEMORY=`cat /proc/meminfo |grep MemTotal|awk '{printf "%.0fMB\n", $2/1024}'` # The DISKSIZE will look like this: sdb:250GB,sda:250GB DISKSIZE=`cat /proc/partitions |grep -e "sd.\>" |awk -F' ' '{printf "%s:%.0fGB\n", $4, $3*0.000001024}' |sed 'N;s/\n/,/'` -UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /sys/devices/virtual/dmi/id/product_uuid` -grep "model name" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing - echo $line > /tmp/cpumod -done -CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'` +#UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /sys/devices/virtual/dmi/id/product_uuid` +#grep "model name" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing +# echo $line > /tmp/cpumod +#done +#CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'` echo '' > /tmp/discopacket echo "findme" >> /tmp/discopacket echo "$ARCH" >> /tmp/discopacket @@ -101,7 +117,10 @@ echo "$CPUCOUNT" >> /tmp/discopacket echo "$CPUTYPE" >> /tmp/discopacket echo "$MEMORY" >> /tmp/discopacket echo "$DISKSIZE" >> /tmp/discopacket -echo "$UUID" >> /tmp/discopacket +if [ "$UUID" != "unknown" ]; then + echo "$UUID" >> /tmp/discopacket +fi + if [ "$MTM" != "unknown" ]; then echo "$MTM" >> /tmp/discopacket fi diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 3048dee6f..2820e48be 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -145,6 +145,15 @@ if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then sleep 3 else echo "Setting IP via DHCP..." +# This section is for System P hardware discovery, which won't have a BOOTIF value set + if [ -z "$bootnic" ]; then + ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo` + for tmp1 in $ALLUP_NICS; do + bootnic=$tmp1 + break + done + fi + dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic & #we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce #chances that we'll perform a partial discovery From c79eca69df97e92711af481f85b03a6231babd14 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 5 Sep 2014 10:44:55 -0400 Subject: [PATCH 045/110] Add support for System X M5 generation for firmware inventory --- xCAT-server/lib/xcat/plugins/ipmi.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index fbfde9964..cb43ef678 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2036,7 +2036,7 @@ sub got_bmc_fw_info { my @returnd = (@{$rsp->{data}}); my @a = ($fw_rev2); my $prefix = pack("C*",@returnd[0..3]); - if ($prefix =~ /yuoo/i or $prefix =~ /1aoo/i) { #we have an imm + if ($prefix =~ /yuoo/i or $prefix =~ /1aoo/i or $prefix =~ /tcoo/i) { #we have an imm $isanimm=1; } $mprom = sprintf("%d.%s (%s)",$fw_rev1,decodebcd(\@a),getascii(@returnd)); From 0c77d04e7c6d81a1d1482a5a9837e28e2e78ad2b Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 8 Sep 2014 08:15:09 -0400 Subject: [PATCH 046/110] Defect 4270 --- xCAT/postscripts/hardeths | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/hardeths b/xCAT/postscripts/hardeths index 3c72f3dd0..caa0b63cb 100755 --- a/xCAT/postscripts/hardeths +++ b/xCAT/postscripts/hardeths @@ -1,4 +1,4 @@ -PREFIXMASK#!/bin/sh +#!/bin/sh # pmatch determines if 1st argument string is matched by 2nd argument pattern pmatch () From 40b5891c4a5e51e0e2d17b6c54ab7bedc0c32ffa Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 8 Sep 2014 12:20:14 -0400 Subject: [PATCH 047/110] defect 4254 --- xCAT-client/bin/rcons | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xCAT-client/bin/rcons b/xCAT-client/bin/rcons index c241085c3..78bd8e901 100755 --- a/xCAT-client/bin/rcons +++ b/xCAT-client/bin/rcons @@ -21,7 +21,11 @@ if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" exit 0 fi if [ "$1" = "-v" ]; then - echo "Version 2.8" + echo "Version 2.9" + exit 0 +fi +if [ "$1" = "--version" ]; then + echo "Version 2.9" exit 0 fi From 9dd06c104712dd331f26d287a78f9f781a9cd198 Mon Sep 17 00:00:00 2001 From: mellor Date: Tue, 9 Sep 2014 09:30:14 -0400 Subject: [PATCH 048/110] second pass at new getxcatdocs - convert tables to pandoc, fix image downloads, and more --- xCAT-client/bin/getxcatdocs | 364 +++++++++++++++++++++++++++--------- 1 file changed, 273 insertions(+), 91 deletions(-) diff --git a/xCAT-client/bin/getxcatdocs b/xCAT-client/bin/getxcatdocs index 5ba806aa7..26fb41fcd 100755 --- a/xCAT-client/bin/getxcatdocs +++ b/xCAT-client/bin/getxcatdocs @@ -15,14 +15,16 @@ use strict; use Getopt::Long; use Cwd; use JSON; +use List::Util qw[max]; + # URL for the xCAT Allura wiki API markdown on SourceForge -my $sf_url='http://sourceforge.net/rest'; -my $wiki_url=$sf_url.'/p/xcat/wiki/'; +my $SF_URL='http://sourceforge.net/rest'; +my $WIKI_URL=$SF_URL.'/p/xcat/wiki/'; # Update this list if you group any xcat docs on a separate page such that they # are no longer linked from the main doc page: -my @indexdocs = ('XCAT_Documentation', +my @INDEXDOCS = ('XCAT_Documentation', 'Power_775_Cluster_Documentation', 'Highly_Available_Management_Node', 'Mixed_Cluster_Support', @@ -33,16 +35,23 @@ my $HELP; my $UPLOAD; my $UPLOADONLY; my $IGNOREERRORS; +my $CONTINUE; my $SINGLE_DOC; my $VERBOSE; +my $MDDIR; +my $HTMLDIR; +my $PDFDIR; +my $IMAGEDIR; +my %LOADEDDOCS; + sub verbose { if ($VERBOSE) { print shift, "\n"; } } my $usage = sub { my $exitcode = shift @_; print "Usage: getxcatdocs [-?|-h|--help] \n"; print "Usage: getxcatdocs [-v|--verbose] [-u|--upload] [--uploadonly] [-i|--ignoreerrors] []\n"; - print "Usage: getxcatdocs [-v|--verbose] [-d|--doc single_doc] [-i|--ignoreerrors] []\n"; + print "Usage: getxcatdocs [-v|--verbose] [-c|--continue] [-d|--doc single_doc] [-i|--ignoreerrors] []\n"; exit $exitcode; }; @@ -58,6 +67,7 @@ my $usage = sub { 'v|verbose' => \$VERBOSE, 'u|upload' => \$UPLOAD, 'uploadonly' => \$UPLOADONLY, + 'c|continue' => \$CONTINUE, 'i|ignoreerrors' => \$IGNOREERRORS, 'd|doc=s' => \$SINGLE_DOC )) { $usage->(1); } @@ -66,35 +76,28 @@ my $usage = sub { if ($^O =~ /^aix/i) { die "Error: this command is not yet supported on AIX.\n"; } - my $destdir = scalar(@ARGV) ? $ARGV[0] : '.'; - chdir($destdir) or die "Can not cd to $destdir: $!\n"; + my $DESTDIR = scalar(@ARGV) ? $ARGV[0] : '.'; + chdir($DESTDIR) or die "Can not cd to $DESTDIR: $!\n"; my $json = JSON->new(); if ($SINGLE_DOC) { - my $scurlcmd = "curl -X GET $wiki_url$SINGLE_DOC"; - verbose($scurlcmd); - my $pagecontent = `$scurlcmd`; - if ($? && !$IGNOREERRORS) { die "error encountered in $scurlcmd \n";} - my $pageout = $json->decode($pagecontent); - foreach my $pageatt (@{$pageout->{attachments}}) { - my $swgetcmd = "wget $pageatt->{url}"; - verbose($swgetcmd); - system($swgetcmd); - if ($? && !$IGNOREERRORS) { die "error encountered in $swgetcmd \n";} - } - convert_doc($SINGLE_DOC,$pageout->{text},'.','.','.','.'); + $MDDIR = '.'; + $HTMLDIR = '.'; + $PDFDIR = '.'; + $IMAGEDIR = '.'; + download_doc($SINGLE_DOC); + convert_doc($SINGLE_DOC); exit; } # Download the HTML docs and convert them all to pdfs - if (!$UPLOADONLY) { gethtmldocs('md','html','pdf','images'); } + if (!$UPLOADONLY) { gethtmldocs(); } # tar/compress my $date=`date +%Y%m%d%H%M`; chop $date; my $docname="xcat-docs-snap$date.tar.gz"; - chdir($destdir) or die "Can not cd to $destdir: $!\n"; my $cmd = "tar -zcf $docname html pdf images 2>&1"; verbose($cmd); @@ -114,82 +117,119 @@ my $usage = sub { sub gethtmldocs { - my $mddir = shift; - my $htmldir = shift; - my $pdfdir = shift; - my $imagedir = shift; - my $savedir = getcwd(); - mkdir($mddir); - mkdir($htmldir); - mkdir($pdfdir); - mkdir($imagedir); - #delete all the files in the dirs in case they previously ran this - unlink <$mddir/*>; - unlink <$htmldir/*>; - unlink <$pdfdir/*>; - unlink <$imagedir/*>; - - print "\nDownloading and converting the xCAT wiki document list from $wiki_url ...\n"; - my @doclist; - my %donelist; - foreach my $index (@indexdocs) { - if ( $donelist{$index} ) { next; } - my $indexcmd = "curl -X GET $wiki_url/$index"; - verbose($indexcmd); - my $indexmd = `$indexcmd`; - if ($? && !$IGNOREERRORS) { die "error encountered in $indexcmd \n";} - my $jsout = $json->decode($indexmd); - push @doclist,@{$jsout->{related_artifacts}}; - foreach my $att (@{$jsout->{attachments}}) { - my $iwgetcmd = "wget -P $imagedir/ $att->{url}"; - verbose($iwgetcmd); - system($iwgetcmd); - if ($? && !$IGNOREERRORS) { die "error encountered in $iwgetcmd \n";} - } - convert_doc($index,$jsout->{text},$mddir,$htmldir,$pdfdir,$imagedir); - $donelist{$index}=1; - } - print "\nDownloading and converting the xCAT wiki documentation to $savedir ...\n"; + $MDDIR = 'md'; + $HTMLDIR = 'html'; + $PDFDIR = 'pdf'; + $IMAGEDIR = 'images'; - foreach my $doc (@doclist) { - my $doc_name = $doc; - $doc_name =~ s/\/.*\/(.+)\/$/$1/; - if ( $donelist{$doc_name} ) { next; } - verbose("processing $doc"); - my $doc_url=$sf_url.$doc; - my $curlcmd = "curl -X GET $doc_url"; - verbose($curlcmd); - my $pagecontent = `$curlcmd`; - my $pageout = $json->decode($pagecontent); - foreach my $pageatt (@{$pageout->{attachments}}) { - my $wgetcmd = "wget -P $imagedir/ $pageatt->{url}"; - system($wgetcmd); - if ($? && !$IGNOREERRORS) { die "error encountered in $wgetcmd \n";} - } - convert_doc($doc_name,$pageout->{text},$mddir,$htmldir,$pdfdir,$imagedir); - $donelist{$doc_name}=1; + mkdir($MDDIR); + mkdir($HTMLDIR); + mkdir($PDFDIR); + mkdir($IMAGEDIR); + #delete all the files in the dirs in case they previously ran this + if ($CONTINUE) { + print "CONTINUING with files already in $MDDIR"; + my @mdfiles = glob "$MDDIR/*.md"; + foreach my $mdf (@mdfiles) { + $mdf =~ s/^$MDDIR\///; + $mdf =~ s/\.md//; + $LOADEDDOCS{$mdf}=1; + } + } else { + unlink <$MDDIR/*>; + unlink <$HTMLDIR/*>; + unlink <$PDFDIR/*>; + unlink <$IMAGEDIR/*>; } - - chdir($savedir); + + print "\nDownloading and converting the xCAT wiki document list from $WIKI_URL ...\n"; + foreach my $index (@INDEXDOCS) { + my @related_docs = download_doc($index); + foreach my $docref (@related_docs) { + my $docref_name = $docref; + $docref_name =~ s/\/.*\/(.+)\/$/$1/; + download_doc($docref_name); + } + } + + foreach my $doc (keys %LOADEDDOCS) { + convert_doc($doc); + } + return; } + + +sub download_doc { + my $doc_name = shift; + + if ( $LOADEDDOCS{$doc_name} ) { return; } + verbose("processing $doc_name"); + $LOADEDDOCS{$doc_name}=1; + + my $curlcmd = "curl --retry 5 -X GET $WIKI_URL/$doc_name"; + verbose($curlcmd); + my $docjson = `$curlcmd`; + if ($? && !$IGNOREERRORS) { die "error encountered in $curlcmd \n";} + + my $jsout = $json->decode($docjson); + + foreach my $att (@{$jsout->{attachments}}) { + my $wgetcmd = "wget -P $IMAGEDIR/ $att->{url}"; + verbose($wgetcmd); + system($wgetcmd); + if ($? && !$IGNOREERRORS) { die "error encountered in $wgetcmd \n";} + } + + open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md"; + print MDFILE $jsout->{text}; + close MDFILE; + + return @{$jsout->{related_artifacts}}; +} + + + sub convert_doc { my $doc_name = shift; - my $doc_text = shift; - my $mddir = shift; - my $htmldir = shift; - my $pdfdir = shift; - my $imagedir = shift; + + open(MDFILE, "<$MDDIR/${doc_name}.md") or die "Could not open <$MDDIR/${doc_name}.md"; + my @doc_lines = ; + close MDFILE; + my $doc_text = join('',@doc_lines); + + $doc_text = process_includes($doc_text,0); + + if ($doc_text =~ /begin_xcat_table/) { + open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md"; + print MDFILE $doc_text; + close MDFILE; + + convert_tables($doc_name); + + open(MDFILE, "<$MDDIR/${doc_name}.md") or die "Could not open <$MDDIR/${doc_name}.md"; + @doc_lines = ; + close MDFILE; + $doc_text = join('',@doc_lines); + } ## Make image refs local - $doc_text =~ s/\!\[\]\(.+\/(.+)\.png\)/\!\[\]\(\.\.\/$imagedir\/$1\.png\)/g; - $doc_text =~ s/\!\[\]\(.+\/(.+)\.PNG\)/\!\[\]\(\.\.\/$imagedir\/$1\.PNG\)/g; - $doc_text =~ s/\!\[\]\(.+\/(.+)\.jpg\)/\!\[\]\(\.\.\/$imagedir\/$1\.jpg\)/g; - open(MDFILE, ">$mddir/${doc_name}.md") or die; + $doc_text =~ s/\!\[\]\(.+\/(.+)\.png\)/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.png\)/g; + $doc_text =~ s/\!\[\]\(.+\/(.+)\.PNG\)/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.PNG\)/g; + $doc_text =~ s/\!\[\]\(.+\/(.+)\.jpg\)/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.jpg\)/g; + $doc_text =~ s/\[img src=(.+)\.png\]/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.png\)/g; + $doc_text =~ s/\[img src=(.+)\.PNG\]/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.PNG\)/g; + $doc_text =~ s/\[img src=(.+)\.jpg\]/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.jpg\)/g; + + ## Remove [TOC] entries + $doc_text =~ s/\[TOC\]//g; + + + open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md"; print MDFILE $doc_text; close MDFILE; - my $pandoccmd = "pandoc -s --toc $mddir/${doc_name}.md -o $htmldir/${doc_name}.html"; + my $pandoccmd = "pandoc -s --toc $MDDIR/${doc_name}.md -o $HTMLDIR/${doc_name}.html"; verbose($pandoccmd); system($pandoccmd); if ($? && !$IGNOREERRORS) { die "error encountered in $pandoccmd \n";} @@ -197,18 +237,160 @@ sub convert_doc { # figure out what was going on: # pandoc does different processing if target filetype is html # but all internal refs only work in browser when there is no html filetype - rename "$htmldir/${doc_name}.html","$htmldir/${doc_name}"; + rename "$HTMLDIR/${doc_name}.html","$HTMLDIR/${doc_name}"; - $doc_text =~ s/\!\[\]\(\.\.\/$imagedir\/(.+)\.png\)/\!\[\]\(\.\/$imagedir\/$1\.png\)/g; - $doc_text =~ s/\!\[\]\(\.\.\/$imagedir\/(.+)\.PNG\)/\!\[\]\(\.\/$imagedir\/$1\.PNG\)/g; - $doc_text =~ s/\!\[\]\(\.\.\/$imagedir\/(.+)\.jpg\)/\!\[\]\(\.\/$imagedir\/$1\.jpg\)/g; - open(MDFILE, ">$mddir/${doc_name}.md") or die; + $doc_text =~ s/\!\[\]\(\.\.\/$IMAGEDIR\/(.+)\.png\)/\!\[\]\(\.\/$IMAGEDIR\/$1\.png\)/g; + $doc_text =~ s/\!\[\]\(\.\.\/$IMAGEDIR\/(.+)\.PNG\)/\!\[\]\(\.\/$IMAGEDIR\/$1\.PNG\)/g; + $doc_text =~ s/\!\[\]\(\.\.\/$IMAGEDIR\/(.+)\.jpg\)/\!\[\]\(\.\/$IMAGEDIR\/$1\.jpg\)/g; + open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md"; print MDFILE $doc_text; close MDFILE; - my $pandoccmd2 = "pandoc --toc $mddir/${doc_name}.md -o $pdfdir/${doc_name}.pdf"; + my $pandoccmd2 = "pandoc --toc $MDDIR/${doc_name}.md -o $PDFDIR/${doc_name}.pdf"; verbose($pandoccmd2); system($pandoccmd2); if ($? && !$IGNOREERRORS) { die "error encountered in $pandoccmd2 \n";} } + + +sub process_includes { + my $doc_text = shift; + my $include_nest = shift; + + if ($include_nest++ > 10) { die "nested include processing greater than 10. Infinite recursion???"; } + + while (1) { + if ($doc_text =~ /\[\[(\s*)include (\s*)ref=(\s*)(.+)(\s*)\]\]/) { + my $next_include = $4; + download_doc($next_include); + + open(INCLDFILE, "<$MDDIR/${next_include}.md") or die "Could not open <$MDDIR/${next_include}.md"; + my @include_lines = ; + close INCLDFILE; + +# my $include_text = join('\n', @include_lines); + my $include_text = join('', @include_lines); + $include_text = process_includes($include_text,$include_nest); + + $doc_text =~ s/\[\[(\s*)include (\s*)ref=(\s*)$next_include(\s*)\]\]/$include_text/g; + + } else { + last; + } + } + + return $doc_text; +} + + +sub convert_tables { + my $doc_name=shift; + my $infile="$MDDIR/${doc_name}.md"; + my $outfile=$infile; + + open(MDFILE, "<$infile") or die "Could not open <$infile"; + my @inlines=; + close MDFILE; + my @outlines; + my @tablines; + + my $in_comment=0; + my $xcat_table=0; + my $numcols=1; + my @colwidths=(0); + my $tabcount=0; + + verbose("converting tables in $doc_name"); + foreach my $line (@inlines) { + if ($line =~ /\<\!---/) { $in_comment=1; next; } + if ($in_comment) { + if ($line =~ /begin_xcat_table/) {$xcat_table=1; next;} + if ($xcat_table) { + if ($line =~ /numcols=(\d+)/) { $numcols=$1; next;} + if ($line =~ /colwidths=([\d,]+)/) { @colwidths=split(',',$1); next;} + } + if ($line =~ /end_xcat_table/) { + my $separator = '+'; + foreach my $c (@colwidths) { + if ($c > 0) { $separator .= '-' x $c; } + $separator .= '+'; + } + $separator .= "\n"; + my $headsep = $separator; + $headsep =~ s/-/=/g; + my $rowline = $separator; + $rowline =~ s/-/ /g; + + my $nosep=0; + foreach my $tabline(@tablines) { + if ($tabline =~ /^\s*$/) { next;} + if ($tabline =~ /^\-\-/) { + push (@outlines,$headsep); + $nosep = 1; + next; + } + if ($nosep) { $nosep=0;} else {push (@outlines,$separator);} + $tabline =~ s/^\s*\|//; + my @vals = split (/\|/,$tabline); + my $last_cell_line=0; + my $colnum=0; + my @tabrow; + foreach my $c (@colwidths) { + if ($c > 0) { + my $colval=$vals[$colnum]; + $colval =~ s/(\s*)$//; + my $vallen = length($colval); + my $cell_line=0; + while ($vallen > $c) { + $tabrow[$cell_line++][$colnum] = substr($colval,0,$c); + $vallen -= $c; + $colval = substr($colval,$c,$vallen); + } + $tabrow[$cell_line][$colnum] = substr($colval,0,$vallen); + if ($vallen < $c) { + $tabrow[$cell_line][$colnum] .= " " x ($c-$vallen); + } + $last_cell_line = max($cell_line,$last_cell_line); + } + $colnum++; + } + + my @rowlines; + for (my $i=0;$i<=$last_cell_line;$i++) { + for (my $j=0;$j<=$numcols-1;$j++) { + $rowlines[$i] .= "|"; + if ($tabrow[$i][$j]) { $rowlines[$i] .= $tabrow[$i][$j]; } + else { $rowlines[$i] .= " " x $colwidths[$j]; } + } + $rowlines[$i] .= "|\n"; + } + push (@outlines,@rowlines); + } + push (@outlines,$separator); + + # reset to process next table + @tablines = (); + $xcat_table=0; $numcols=1;@colwidths=(0);next; + } + if ($line =~ /--\>/) {$in_comment=0;next;} + next; + } + if ($xcat_table) { push (@tablines,$line); next; } + + push (@outlines,$line); + next; + } + + open(MD2FILE, ">$outfile") or die "Could not open >$outfile"; + print MD2FILE @outlines; + close MD2FILE; + + return; + + + + + + +} From 7bbc3e8add62e3a9a197c8ecc6d516376cb10f1d Mon Sep 17 00:00:00 2001 From: mellor Date: Tue, 9 Sep 2014 09:39:59 -0400 Subject: [PATCH 049/110] man page updates for a new --continue flag to getxcatdocs --- xCAT-client/pods/man1/getxcatdocs.1.pod | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT-client/pods/man1/getxcatdocs.1.pod b/xCAT-client/pods/man1/getxcatdocs.1.pod index cbe7a1ad4..a0c5729a4 100644 --- a/xCAT-client/pods/man1/getxcatdocs.1.pod +++ b/xCAT-client/pods/man1/getxcatdocs.1.pod @@ -6,7 +6,7 @@ B - downloads the xCAT documentation and converts to HTML and PDF B [B<-?> | B<-h> | B<--help>] B [B<-v> | B<--verbose>] [I] -B [B<-v> | B<--verbose>] [B<-d> | B<--doc> I] [I] +B [B<-v> | B<--verbose>] [B<-c> | B<--continue>] [B<-d> | B<--doc> I] [I] =head1 DESCRIPTION @@ -36,13 +36,17 @@ This command does not run on AIX or Windows. =over 10 +=item B<-?|-h|--help> + +Display usage message. + =item B<-v|--verbose> Run the command in verbose mode. -=item B<-?|-h|--help> +=item B<-c|--continue> -Display usage message. +If a previous run of this command failed (which often happens if you lose your network connection), continue processing using files already downloaded to your markdown directory. =item B<-d|--doc> I From aab450c4deae96fa5495e52ba31c1cc9627b1e15 Mon Sep 17 00:00:00 2001 From: mellor Date: Tue, 9 Sep 2014 10:04:17 -0400 Subject: [PATCH 050/110] added --uploaduser as option and fixed default --- xCAT-client/bin/getxcatdocs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xCAT-client/bin/getxcatdocs b/xCAT-client/bin/getxcatdocs index 26fb41fcd..d57f778d4 100755 --- a/xCAT-client/bin/getxcatdocs +++ b/xCAT-client/bin/getxcatdocs @@ -9,7 +9,7 @@ # Note: do not use the --upload option, unless your machine has authority to write to http://xcat.sourceforge.net/doc/ . # You also need to set $UPLOADUSER to your sourceforge user: -my $UPLOADUSER = 'mellor'; +my $UPLOADUSER = 'bp-sawyers'; use strict; use Getopt::Long; @@ -50,7 +50,7 @@ sub verbose { if ($VERBOSE) { print shift, "\n"; } } my $usage = sub { my $exitcode = shift @_; print "Usage: getxcatdocs [-?|-h|--help] \n"; - print "Usage: getxcatdocs [-v|--verbose] [-u|--upload] [--uploadonly] [-i|--ignoreerrors] []\n"; + print "Usage: getxcatdocs [-v|--verbose] [-u|--upload] [--uploadonly] [-U|--uploaduser sourceforge_id] [-i|--ignoreerrors] []\n"; print "Usage: getxcatdocs [-v|--verbose] [-c|--continue] [-d|--doc single_doc] [-i|--ignoreerrors] []\n"; exit $exitcode; }; @@ -67,6 +67,7 @@ my $usage = sub { 'v|verbose' => \$VERBOSE, 'u|upload' => \$UPLOAD, 'uploadonly' => \$UPLOADONLY, + 'uploaduser' => \$UPLOADUSER, 'c|continue' => \$CONTINUE, 'i|ignoreerrors' => \$IGNOREERRORS, 'd|doc=s' => \$SINGLE_DOC )) From 532c7d618c4addcc24993cde7056263b5d6aa072 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 9 Sep 2014 09:31:32 -0400 Subject: [PATCH 051/110] Recognize Lenovo IMM2 for wvid --- xCAT-server/lib/xcat/plugins/ipmi.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index cb43ef678..f6c02a0ca 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1266,6 +1266,9 @@ sub getrvidparms_with_buildid { my $rsp = shift; my $sessdata = shift; my @build_id = (0,@{$rsp->{data}}); + if ($build_id[1]==0x54 and $build_id[2]==0x43 and $build_id[3]==0x4f and $build_id[4]==0x4f) { ##Lenovo IMM2 + return getrvidparms_imm2($rsp,$sessdata); + } if ($build_id[1]==0x31 and $build_id[2]==0x41 and $build_id[3]==0x4f and $build_id[4]==0x4f) { #Only know how to cope with yuoo builds return getrvidparms_imm2($rsp,$sessdata); } From 541dcf53d33aa8cf892d98af23665297f86022af Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 9 Sep 2014 13:41:19 -0400 Subject: [PATCH 052/110] Handle more invalid characters in SPD model field if encountered --- perl-xCAT/xCAT/SPD.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/SPD.pm b/perl-xCAT/xCAT/SPD.pm index 957f25f54..b2dd84eb0 100755 --- a/perl-xCAT/xCAT/SPD.pm +++ b/perl-xCAT/xCAT/SPD.pm @@ -815,7 +815,7 @@ sub decode_spd { $rethash->{product}->{builddate} = sprintf("Week %x of 20%02x",$spd[323],$spd[324]); } foreach (@spd[329..348]) { - if ($_ & 0b10000000) { + if ($_ > 126 or $_ < 32) { $rethash->{product}->{model}="Malformed SPD"; } } From 088ee8e9cdc514cb5475683a5dd3b67d863aa8e8 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 10 Sep 2014 01:51:06 -0700 Subject: [PATCH 053/110] add an attribute for findme used to check it is running powerNV model --- xCAT-genesis-scripts/bin/dodiscovery | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index 426b5bb4f..3c3929dd8 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -58,6 +58,7 @@ MTM=unknown SERIAL=unknown ARCH=unknown ARCH=`uname -m` #32-bit only is old news +PLATFORM=unknown if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86 PRODNAME=`cat /sys/devices/virtual/dmi/id/product_name` IAMAVM=0 @@ -82,6 +83,7 @@ elif [ -r /proc/device-tree/model ]; then #POWER #MTM=`cat /proc/device-tree/model |awk -F, '{print $2}'` MTM=`cat /proc/device-tree/model | sed -e 's/\^.*,//'` CPUCOUNT=`cat /proc/cpuinfo |grep -e "^cpu\s*:"|wc -l` + PLATFORM=`cat /proc/cpuinfo | grep -e "^platform\s*:" | awk '{print \$3}'` grep -e "^cpu\s*:" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing echo $line > /tmp/cpumod done @@ -127,6 +129,9 @@ fi if [ "$SERIAL" != "unknown" ]; then echo "$SERIAL" >> /tmp/discopacket fi +if [ "$PLATFORM" != "unknown" ]; then + echo "$PLATFORM" >> /tmp/discopacket +fi #so we have some cases where DMI table explictly records every function number, and some where only first function is enumerated #so for each onboard device, we record it. If it is also the first function, we'll seek out other function numbers and append #if that other function number does not show up in its own dmi type 41 record From c66fe0d1310aee856aa5a1c12b4b1fccf366125d Mon Sep 17 00:00:00 2001 From: litingt Date: Wed, 10 Sep 2014 21:30:11 -0400 Subject: [PATCH 054/110] change git directory --- xCAT-server/share/xcat/tools/xCATreg | 4 ++++ 1 file changed, 4 insertions(+) mode change 100644 => 100755 xCAT-server/share/xcat/tools/xCATreg diff --git a/xCAT-server/share/xcat/tools/xCATreg b/xCAT-server/share/xcat/tools/xCATreg old mode 100644 new mode 100755 index dca1a46ad..53d715ede --- a/xCAT-server/share/xcat/tools/xCATreg +++ b/xCAT-server/share/xcat/tools/xCATreg @@ -650,6 +650,8 @@ sub git_update { my $lastcommit; my $commitlog1; my $lastcommitfile; + my $codedir; + $codedir="/regression/code/xcat-core"; my $gitup; $gitup="/tmp/gitup"; @@ -662,6 +664,8 @@ sub git_update { # exit; #} + chdir $codedir; + $res = system("git checkout $branch"); if ($res != 0){ send_msg(0, "git checkout failed"); From 42b0f43780882b1d03d24d48ac3ec0b6ebd3ec1d Mon Sep 17 00:00:00 2001 From: mellor Date: Thu, 11 Sep 2014 02:38:47 -0700 Subject: [PATCH 055/110] support mtms based hardware discovery --- xCAT-server/lib/perl/xCAT/PPC.pm | 38 ++++++++++++++++++++ xCAT-server/lib/xcat/plugins/fsp.pm | 2 +- xCAT-server/lib/xcat/plugins/nodediscover.pm | 2 ++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index 4b382f197..8a53afdeb 100755 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -2138,6 +2138,33 @@ sub parse_args } +sub findme { + my $request = shift; + my $callback = shift; + my $subreq = shift; + my $vpdtab = xCAT::Table->new('vpd'); + if (!defined $request->{'mtm'} or !defined $request->{'serial'}) { + xCAT::MsgUtils->message("S", "Discovery Error: 'mtm' or 'serial' not found."); + return; + } + unless ($vpdtab) { + xCAT::MsgUtils->message("S", "Discovery Error: Could not open table: vpd."); + return; + } + my @attr_array = (); + push @attr_array, "mtm==$request->{mtm}->[0]"; + push @attr_array, "serial==$request->{serial}->[0]"; + + my @nodes = $vpdtab->getAllAttribsWhere(\@attr_array, 'node'); + foreach (@nodes) { + my $req = {%$request}; + $req->{command} = ['discovered']; + $req->{noderange} = [$_->{node}]; + $req->{discoverymethod} = ['mtms']; + $subreq->($req); + %{$req} = (); + } +} ########################################################################## # Process request from xCat daemon ########################################################################## @@ -2153,6 +2180,17 @@ sub process_request { #################################### $package =~ s/xCAT_plugin:://; + #################################### + # Deal with findme request + #################################### + if ($req->{command}->[0] eq 'findme') { + # The arch of the node shall be check first to makesure it is a power machine + if (!defined $req->{'arch'} or $req->{'arch'}->[0] ne 'ppc64') { + return; + } + &findme($req, $callback, $subreq); + return; + } #################################### # Build hash to pass around #################################### diff --git a/xCAT-server/lib/xcat/plugins/fsp.pm b/xCAT-server/lib/xcat/plugins/fsp.pm index 6d29d8c77..605bc82af 100644 --- a/xCAT-server/lib/xcat/plugins/fsp.pm +++ b/xCAT-server/lib/xcat/plugins/fsp.pm @@ -32,7 +32,7 @@ sub handled_commands { rscan => 'nodehm:mgt', getfspcon => 'nodehm:cons', getmulcon => 'fsp', - + findme => 'fsp', }; } diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index aea08954b..f5a8e88ea 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -206,6 +206,8 @@ sub process_request { } if ($request->{arch}->[0] =~ /x86/ and $currboot !~ /pxe/ and $currboot !~ /xnba/) { $nrtab->setNodeAttribs($node,{netboot=>'xnba'}); + } elsif ($request->{arch}->[0] =~ /ppc/ and $request->{platform}->[0] =~ /PowerNV/) { + $nrtab->setNodeAttribs($node,{netboot=>'petitboot'}); } elsif ($request->{arch}->[0] =~ /ppc/ and $currboot !~ /yaboot/) { $nrtab->setNodeAttribs($node,{netboot=>'yaboot'}); } From 9a237c699b65bc1721a3909ec19200409e9848aa Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 11 Sep 2014 13:12:56 -0400 Subject: [PATCH 056/110] Support for auditlog without syslog --- perl-xCAT/xCAT/MsgUtils.pm | 58 +++++++++++++++++++++++--------------- perl-xCAT/xCAT/Schema.pm | 4 ++- 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/perl-xCAT/xCAT/MsgUtils.pm b/perl-xCAT/xCAT/MsgUtils.pm index 6a554d8ae..822606c2f 100644 --- a/perl-xCAT/xCAT/MsgUtils.pm +++ b/perl-xCAT/xCAT/MsgUtils.pm @@ -138,8 +138,9 @@ This program module file, supports the xcat messaging and logging N - Node informational goes to STDOUT S - Message will be logged to syslog ( severe error) Note S can be combined with other flags for example - SE logs message to syslog and is sent to STDERR. - SA logs message to syslog and to the auditlog DB table + SE logs message to syslog and is sent to STDERR. + SA logs message to syslog and to the auditlog DB table. (only xcatd) + A logs message auditlog DB table only. (only for xcatd) V - verbose. This flag is not valid, the calling routine should check for verbose mode before calling the message @@ -175,7 +176,7 @@ This program module file, supports the xcat messaging and logging # Message to Syslog xCAT::MsgUtils->message('S', "Host $host not responding\n"); - # Message to Syslog and auditlog table + # Message to Syslog and auditlog table (only used by xcatd) # see tabdump -d auditlog my $rsp = {}; $rsp->{syslogdata}->[0] = "$host not responding\n"; # for syslog @@ -189,6 +190,18 @@ This program module file, supports the xcat messaging and logging $rsp->{status} -> [0] = $status; xCAT::MsgUtils->message('SA', $rsp); + # Message to only auditlog table (only used by xcatd) + # see tabdump -d auditlog + my $rsp = {}; + $rsp->{userid} ->[0] = $user; + $rsp->{clientname} -> [0] = $client; + $rsp->{clienttype} -> [0] = $clienttype; + $rsp->{command} -> [0] = $command; + $rsp->{noderange} -> [0] = $noderange; + $rsp->{args} -> [0] = $arguments; + $rsp->{status} -> [0] = $status; + xCAT::MsgUtils->message('A', $rsp); + # Message to Log and Syslog xCAT::MsgUtils->message('LS', "Host $host not responding\n"); @@ -197,44 +210,44 @@ This program module file, supports the xcat messaging and logging Use with callback # Message to callback - my $rsp = {}; + my $rsp = {}; $rsp->{data}->[0] = "Job did not run. \n"; xCAT::MsgUtils->message("D", $rsp, $::CALLBACK); - my $rsp = {}; + my $rsp = {}; $rsp->{error}->[0] = "No hosts in node list\n"; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); - my $rsp = {}; - $rsp->{node}->[0]->{name}->[0] ="mynode"; - $rsp->{node}->[0]->{data}->[0] ="mydata"; - xCAT::MsgUtils->message("N", $rsp, $callback); + my $rsp = {}; + $rsp->{node}->[0]->{name}->[0] ="mynode"; + $rsp->{node}->[0]->{data}->[0] ="mydata"; + xCAT::MsgUtils->message("N", $rsp, $callback); - my $rsp = {}; + my $rsp = {}; $rsp->{info}->[0] = "No hosts in node list\n"; xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); - my $rsp = {}; + my $rsp = {}; $rsp->{sinfo}->[0] = "No hosts in node list\n"; xCAT::MsgUtils->message("IS", $rsp, $::CALLBACK); - my $rsp = {}; + my $rsp = {}; $rsp->{warning}->[0] = "No hosts in node list\n"; xCAT::MsgUtils->message("W", $rsp, $::CALLBACK); - my $rsp = {}; + my $rsp = {}; $rsp->{error}->[0] = "Host not responding\n"; xCAT::MsgUtils->message("S", $rsp, $::CALLBACK); # Message to Syslog and callback - my $rsp = {}; + my $rsp = {}; $rsp->{error}->[0] = "Host not responding\n"; xCAT::MsgUtils->message("SE", $rsp, $::CALLBACK); # Message to Syslog and callback - my $rsp = {}; + my $rsp = {}; $rsp->{info}->[0] = "Host not responding\n"; xCAT::MsgUtils->message("SI", $rsp, $::CALLBACK); @@ -274,15 +287,15 @@ sub message my $call_back = shift; # optional my $exitcode = shift; # optional - # should be I,IS, D, E, S, SA ,LS, W , L,N + # should be I,IS, D, E, S, SA,A ,LS, W , L,N # or S(I, D, E, S, W, L,N) # - # if new SA option need to split syslog messages from auditlog entry + # if SA option need to split syslog messages from auditlog entry # my $newrsp; - if ($sev eq 'SA') - { # if SA then need to pull first entry from $rsp - # for syslog, to preserve old interface + if (($sev eq 'SA') || ($sev eq 'A')) + { # if SA ( syslog and auditlog) or A ( only auditlog)then need to pull first entry from $rsp + # for syslog, to preserve old interface $newrsp = $rsp; $rsp = $newrsp->{syslogdata}->[0]; } @@ -449,11 +462,10 @@ sub message } } - # is syslog requested + # is syslog option requested if ($sev =~ /S/) { - # If they want this msg to also go to syslog, do that now eval { openlog("xCAT", "nofatal,pid", "local4"); @@ -474,7 +486,7 @@ sub message # if write to auditlog table requested, if not on service node if (xCAT::Utils->isMN()){ - if ($sev eq 'SA') + if (($sev eq 'SA') || ($sev eq 'A')) { require xCAT::Table; my $auditlogentry; diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 055c2df86..9f220a5ef 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -924,8 +924,10 @@ site => { " -----------------\n". "DATABASE ATTRIBUTES\n". " -----------------\n". + " auditnosyslog: If set to 1, then commands will only be written to the auditlog table". + " Default is to write to both the auditlog table and syslog.\n". " auditskipcmds: List of commands and/or client types that will not be\n". - " written to the auditlog table.\n". + " written to the auditlog table and syslog. See auditnosyslog.\n". " 'ALL' means all cmds will be skipped. If attribute is null, all\n". " commands will be written.\n". " clienttype:web would skip all commands from the web client\n". From 61b8040369280e7c2999bf0e2e8351bc15cac7df Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 11 Sep 2014 13:14:04 -0400 Subject: [PATCH 057/110] Support for auditlog without syslog --- xCAT-server/lib/perl/xCAT/xcatd.pm | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/xcatd.pm b/xCAT-server/lib/perl/xCAT/xcatd.pm index 6dae1b684..61bcef152 100644 --- a/xCAT-server/lib/perl/xCAT/xcatd.pm +++ b/xCAT-server/lib/perl/xCAT/xcatd.pm @@ -29,7 +29,7 @@ This program module file, is a set of utilities used by xCAT daemon. Here is where we check if $peername is allowed to do $request in policy tbl. $peername, if set signifies client has a cert that the xCAT CA accepted. Logs to syslog and auditlog table all user commands, see site.auditskipcmds - attribute. + attribute and auditnosyslog attribute. Arguments: @@ -205,9 +205,15 @@ sub validate { if($peername) { $logst .= " for " . $request->{username}->[0]}; if ($peerhost) { $logst .= " from " . $peerhost }; - # read site.auditskipcmds attribute, + # read site.auditskipcmds and auditnosyslog attributes, # if set skip commands else audit all cmds. - my @skipcmds=($::XCATSITEVALS{auditskipcmds}); #xCAT::Utils->get_site_attribute('auditskipcmds'); + # is auditnosyslog, then only write to auditlog table and not to syslog + my @skipcmds=($::XCATSITEVALS{auditskipcmds}); + my $auditnosyslog=($::XCATSITEVALS{auditnosyslog}); + my $skipsyslog = 0; # default is to write all commands to auditlog and syslog + if (defined($auditnosyslog)) { + $skipsyslog = $auditnosyslog; # take setting from site table, 1 means no syslog + } # if not "ALL" and not a command from site.auditskipcmds # and not getcredentials and not getcredentials , # put in syslog and auditlog @@ -232,9 +238,12 @@ sub validate { @$deferredmsgargs=(); #should be redundant, but just in case if (($request->{command}->[0] ne "getpostscript") && ($request->{command}->[0] ne "getcredentials") && ($skip == 0)) { - # put in audit Table and syslog + # put in audit Table and syslog unless site.noauditsyslog=1 my $rsp = {}; - $rsp->{syslogdata}->[0] = $logst; + + if ($skipsyslog == 0){ # write to syslog and auditlog + $rsp->{syslogdata}->[0] = $logst; # put in syslog data + } if ($peername) { $rsp->{userid} ->[0] = $request->{username}->[0]; } @@ -256,7 +265,11 @@ sub validate { } $rsp->{args} -> [0] =$arglist; $rsp->{status} -> [0] = $status; - @$deferredmsgargs = ("SA",$rsp); + if ($skipsyslog == 0){ # write to syslog and auditlog + @$deferredmsgargs = ("SA",$rsp); + } else{ # only auditlog + @$deferredmsgargs = ("A",$rsp); + } } else { # getpostscript or getcredentials, just syslog unless ($::XCATSITEVALS{skipvalidatelog}) { @$deferredmsgargs=("S",$logst); } } From aff90b34acb0ddd4ad42c1f0648334905baa61af Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 11 Sep 2014 13:39:55 -0400 Subject: [PATCH 058/110] Support for auditlog without syslog --- perl-xCAT/xCAT/MsgUtils.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/perl-xCAT/xCAT/MsgUtils.pm b/perl-xCAT/xCAT/MsgUtils.pm index 822606c2f..71b8ea4cd 100644 --- a/perl-xCAT/xCAT/MsgUtils.pm +++ b/perl-xCAT/xCAT/MsgUtils.pm @@ -297,7 +297,9 @@ sub message { # if SA ( syslog and auditlog) or A ( only auditlog)then need to pull first entry from $rsp # for syslog, to preserve old interface $newrsp = $rsp; + if ($sev eq 'SA'){ # syslog and auditlog $rsp = $newrsp->{syslogdata}->[0]; + } } my $stdouterrf = \*STDOUT; my $stdouterrd = ''; From 1a5de449ef866845e4d89123cb90193d10ccd72a Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 11 Sep 2014 20:52:23 -0700 Subject: [PATCH 059/110] fix defect #4080 investigate RH7 kdump support --- xCAT/postscripts/enablekdump | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/enablekdump b/xCAT/postscripts/enablekdump index 1a17d2e51..3e711afff 100755 --- a/xCAT/postscripts/enablekdump +++ b/xCAT/postscripts/enablekdump @@ -99,8 +99,10 @@ if [ ! -z "$DUMP" ]; then # workaround for RHEL6 # the $KDIP:$KDPATH directory will be used to generate the initrd for kdump service MOUNTPATH="" - if (pmatch $OSVER "*6\.*" ); then + if ((pmatch $OSVER "*6\.*")); then MOUNTPATH="/tmp" + elif (pmatch $OSVER "*7\.*"); then + MOUNTPATH="/mnt" else MOUNTPATH="/var/tmp" fi @@ -214,7 +216,8 @@ EOF fi else if (pmatch $OSVER "rhel7*") || (pmatch $OSVER "rhels7*");then - /bin/mount -o nolock $KDIP:$KDPATH $MOUNTPATH + /bin/mount -o vers=3 $KDIP:$KDPATH $MOUNTPATH + #/bin/mount -o nolock $KDIP:$KDPATH $MOUNTPATH [ -d $MOUNTPATH/var/crash ] || mkdir -p $MOUNTPATH/var/crash echo "nfs $KDIP:$KDPATH" > /etc/kdump.conf echo "default shell" >> /etc/kdump.conf From 6c46d5b75db53b38e2aec4dffc846dcf3c9a9a6b Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 12 Sep 2014 07:29:09 -0400 Subject: [PATCH 060/110] set default value for auditnosyslog on install and init DB --- xCAT-server/sbin/xcatconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 5196c24cb..95723cf2b 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -1063,7 +1063,7 @@ sub is_redhat6sp4 =head3 initDB Will initialize the DB if it does not already exist, also updates with - new data needed or database changes during xCAT update install. + new data needed or database changes during xCAT install. =cut @@ -1210,6 +1210,7 @@ sub initDB $chtabcmds .= "$::XCATROOT/sbin/chtab key=vsftp site.value=n;"; $chtabcmds .= "$::XCATROOT/sbin/chtab key=cleanupxcatpost site.value=no;"; $chtabcmds .= "$::XCATROOT/sbin/chtab key=dhcplease site.value=43200;"; + $chtabcmds .= "$::XCATROOT/sbin/chtab key=auditnosyslog site.value=0;"; #$chtabcmds .= "$::XCATROOT/sbin/chtab key=useflowcontrol site.value=yes;"; # need to fix 4031 if ($::osname eq 'AIX') From a7621d345faf7ed4117489ccf855cef9de4a4fd2 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 12 Sep 2014 07:50:09 -0400 Subject: [PATCH 061/110] defect 4264: fix issue in configib postscript to make it only touch the ifcfg-* files which are passed in from command line params --- xCAT/postscripts/configib | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xCAT/postscripts/configib b/xCAT/postscripts/configib index 682979e7a..4717c1339 100755 --- a/xCAT/postscripts/configib +++ b/xCAT/postscripts/configib @@ -147,9 +147,12 @@ then else dir="/etc/sysconfig/network-scripts" fi - #`rm -f $dir/ifcfg-$nic` 2>&1 1>/dev/null - # nic aliases - `rm -f $dir/ifcfg-ib*` 2>&1 1>/dev/null + + # remove the nic configuration files which are included in $NIC_IBNICS + for nic in echo "$NIC_IBNICS" | tr "," "\n" + do + rm -f $dir/ifcfg-$nic 2>&1 1>/dev/null + done else loop_number=`lsdev | grep "IP over Infiniband Network Interface" | wc -l` num=0 From 66a38f00759784db43c3eca844cffc5bcc752a53 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 12 Sep 2014 09:19:19 -0400 Subject: [PATCH 062/110] Found undocumented attribute in xcatd and added some more info to auditnosyslog --- perl-xCAT/xCAT/Schema.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 9f220a5ef..554be4b36 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -924,7 +924,8 @@ site => { " -----------------\n". "DATABASE ATTRIBUTES\n". " -----------------\n". - " auditnosyslog: If set to 1, then commands will only be written to the auditlog table". + " auditnosyslog: If set to 1, then commands will only be written to the auditlog table.\n". + " This attribute set to 1 and auditskipcmds=ALL means no logging of commands.\n". " Default is to write to both the auditlog table and syslog.\n". " auditskipcmds: List of commands and/or client types that will not be\n". " written to the auditlog table and syslog. See auditnosyslog.\n". @@ -945,6 +946,7 @@ site => { " nodestatus: If set to 'n', the nodelist.status column will not be updated during\n". " the node deployment, node discovery and power operations. The default is to update.\n\n". " skiptables: Comma separated list of tables to be skipped by dumpxCATdb\n\n". + " skipvalidatelog: If set, then getcredential and getpostscript call will not be logged.\n\n". " -------------\n". "DHCP ATTRIBUTES\n". " -------------\n". From 80772ee81ca8bf4613a3eda69ee92e0bfcfbf063 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 12 Sep 2014 09:22:29 -0400 Subject: [PATCH 063/110] missed a path --- xCAT-server/lib/perl/xCAT/xcatd.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/perl/xCAT/xcatd.pm b/xCAT-server/lib/perl/xCAT/xcatd.pm index 61bcef152..fb879db78 100644 --- a/xCAT-server/lib/perl/xCAT/xcatd.pm +++ b/xCAT-server/lib/perl/xCAT/xcatd.pm @@ -271,7 +271,14 @@ sub validate { @$deferredmsgargs = ("A",$rsp); } } else { # getpostscript or getcredentials, just syslog - unless ($::XCATSITEVALS{skipvalidatelog}) { @$deferredmsgargs=("S",$logst); } + if (($request->{command}->[0] eq "getpostscript") + || ($request->{command}->[0] eq "getcredentials")) { + unless ($::XCATSITEVALS{skipvalidatelog}) { @$deferredmsgargs=("S",$logst); } + } else { #other skipped command syslog unless auditnosyslog + if ($skipsyslog == 0){ # write to syslog + @$deferredmsgargs=("S",$logst); + } + } } } # end getbladecons,etc check return $rc; From ae1dde7d9ad7a2c5ebb8a1c4052904485f55ffc0 Mon Sep 17 00:00:00 2001 From: qyin Date: Mon, 15 Sep 2014 15:55:01 +0800 Subject: [PATCH 064/110] Fix: 242668 [Rank6][Vlan] [Switch] [sles]Cannot found secure vlan network after flex up node in cluster within vlan --- xCAT-server/lib/xcat/plugins/profilednodes.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index d309ecdeb..09f72adce 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -1149,10 +1149,13 @@ Usage: # Add reserve nics foreach my $nicname (@reserveNics){ - my $oldip = $nodesNicsRef->{$node}->{$nicname}->{"ip"}; - if ($oldip) { - $nicipsAttr{$node}{nicips} .= $nicname."!".$oldip.","; - } + my $count = index($nicipsAttr{$node}{nicips}, $nicname); + if($count < 0) { + my $oldip = $nodesNicsRef->{$node}->{$nicname}->{"ip"}; + if ($oldip) { + $nicipsAttr{$node}{nicips} .= $nicname."!".$oldip.","; + } + } } } From d0585fe056b7fb50438873d1af5cb4b44412e37f Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 15 Sep 2014 02:41:51 -0700 Subject: [PATCH 065/110] fix defect #4155 [fvt]2.9:could not install xcat use the latest build for no perl(Confluent::Client) --- xCAT-server/debian/dirs | 1 + xCAT-server/debian/install | 1 + xCAT-server/debian/rules | 1 + 3 files changed, 3 insertions(+) diff --git a/xCAT-server/debian/dirs b/xCAT-server/debian/dirs index e9bb97e2d..93ede5a69 100644 --- a/xCAT-server/debian/dirs +++ b/xCAT-server/debian/dirs @@ -22,6 +22,7 @@ opt/xcat/share/xcat/ib/netboot/sles opt/xcat/share/xcat/ib/netboot/rh opt/xcat/lib opt/xcat/lib/perl +opt/xcat/lib/perl/Confluent opt/xcat/lib/perl/xCAT opt/xcat/lib/perl/xCAT_plugin opt/xcat/lib/perl/xCAT_schema diff --git a/xCAT-server/debian/install b/xCAT-server/debian/install index 8ecc00e59..6ad9500c6 100644 --- a/xCAT-server/debian/install +++ b/xCAT-server/debian/install @@ -24,6 +24,7 @@ lib/xcat/plugins/* opt/xcat/lib/perl/xCAT_plugin/ lib/xcat/schema/* opt/xcat/lib/perl/xCAT_schema/ lib/xcat/monitoring/* opt/xcat/lib/perl/xCAT_monitoring/ lib/xcat/dsh/Context/* opt/xcat/xdsh/Context +lib/xcat/Confluent/* lib/perl/Confluent/ lib/xcat/shfunctions opt/xcat/lib etc/init.d/xcatd etc/init.d diff --git a/xCAT-server/debian/rules b/xCAT-server/debian/rules index f3a068123..6955f797d 100644 --- a/xCAT-server/debian/rules +++ b/xCAT-server/debian/rules @@ -60,6 +60,7 @@ binary-arch: chmod 644 $(rootdir)/lib/perl/xCAT_monitoring/samples/* chmod 755 $(rootdir)/lib/perl/xCAT_monitoring/pcp chmod 644 $(rootdir)/lib/perl/xCAT_monitoring/pcp/* + chmod 644 $(rootdir)/lib/perl/Confluent/* chmod 644 $(rootdir)/lib/perl/xCAT_schema/* chmod 755 $(rootdir)/lib/perl/xCAT_schema/samples chmod 644 $(rootdir)/lib/perl/xCAT_schema/samples/* From 7f8b48ba408ea76f926b8cebdc8d08acb2f909ff Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 15 Sep 2014 02:50:34 -0700 Subject: [PATCH 066/110] fix defect #4155 [fvt]2.9:could not install xcat use the latest build for no perl(Confluent::Client) --- xCAT-server/debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/debian/rules b/xCAT-server/debian/rules index 6955f797d..410c07bb6 100644 --- a/xCAT-server/debian/rules +++ b/xCAT-server/debian/rules @@ -60,7 +60,7 @@ binary-arch: chmod 644 $(rootdir)/lib/perl/xCAT_monitoring/samples/* chmod 755 $(rootdir)/lib/perl/xCAT_monitoring/pcp chmod 644 $(rootdir)/lib/perl/xCAT_monitoring/pcp/* - chmod 644 $(rootdir)/lib/perl/Confluent/* + chmod 644 $(rootdir)/lib/perl/Confluent/* chmod 644 $(rootdir)/lib/perl/xCAT_schema/* chmod 755 $(rootdir)/lib/perl/xCAT_schema/samples chmod 644 $(rootdir)/lib/perl/xCAT_schema/samples/* From 83ed138db24a44533a545cd62ecf8e1ce80cc8f3 Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 15 Sep 2014 03:04:57 -0700 Subject: [PATCH 067/110] fix defect #4155 [fvt]2.9:could not install xcat use the latest build for no perl(Confluent::Client) --- xCAT-server/debian/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/debian/install b/xCAT-server/debian/install index 6ad9500c6..37c168c20 100644 --- a/xCAT-server/debian/install +++ b/xCAT-server/debian/install @@ -24,7 +24,7 @@ lib/xcat/plugins/* opt/xcat/lib/perl/xCAT_plugin/ lib/xcat/schema/* opt/xcat/lib/perl/xCAT_schema/ lib/xcat/monitoring/* opt/xcat/lib/perl/xCAT_monitoring/ lib/xcat/dsh/Context/* opt/xcat/xdsh/Context -lib/xcat/Confluent/* lib/perl/Confluent/ +lib/xcat/Confluent/* opt/xcat/lib/perl/Confluent/ lib/xcat/shfunctions opt/xcat/lib etc/init.d/xcatd etc/init.d From fe890637c95d9da6c048595a5f67f5bee30f042a Mon Sep 17 00:00:00 2001 From: qyin Date: Mon, 15 Sep 2014 17:32:28 +0800 Subject: [PATCH 068/110] fix issue 241844 The added os packages are not installed when reinstall nodes. --- xCAT-server/lib/xcat/plugins/profilednodes.pm | 89 ++++++++++++++----- 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index 09f72adce..2f0cc335f 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -1302,26 +1302,50 @@ Usage: my $nodelist = $request->{node}; my $hostname = $nodelist->[0]; - # Validate MAC address - my $recordsref = xCAT::ProfiledNodeUtils->get_allnode_singleattrib_hash('mac', 'mac'); - %allmacs = %$recordsref; - foreach (keys %allmacs){ - my @hostentries = split(/\|/, $_); - foreach my $hostandmac ( @hostentries){ - my ($macstr, $machostname) = split("!", $hostandmac); - $allmacs{$macstr} = 0; + if("__NOMAC__" eq $args_dict{"mac"}) { + # Validate if node is bind on a switch + my $switch_table = xCAT::Table->new("switch"); + my @item = $switch_table->getAttribs({'node' => $hostname}, 'switch', 'port'); + my $item_num = @item; + my $switch_valid = 0; + unless($item[0]) + { + setrsp_errormsg("Failed to replace node <$hostname>. Switch information cannot be retrieved. Ensure that the switch is configured correctly."); + return; + } else { + foreach my $switch_item (@item){ + if($switch_item->{'switch'} && $switch_item->{'port'}){ + $switch_valid = 1; + } + } + } + unless ($switch_valid) + { + setrsp_errormsg("Failed to replace node <$hostname>. Switch information cannot be retrieved. Ensure that the switch is configured correctly."); + return; + } + } else { + #Validate MAC address + my $recordsref = xCAT::ProfiledNodeUtils->get_allnode_singleattrib_hash('mac', 'mac'); + %allmacs = %$recordsref; + foreach (keys %allmacs){ + my @hostentries = split(/\|/, $_); + foreach my $hostandmac ( @hostentries){ + my ($macstr, $machostname) = split("!", $hostandmac); + $allmacs{$macstr} = 0; + } + } + %allmacsupper = (); + foreach (keys %allmacs){ + $allmacsupper{uc($_)} = 0; + } + if (exists $allmacsupper{uc($args_dict{"mac"})}){ + setrsp_errormsg("The specified MAC address $args_dict{'mac'} already exists. You must use a different MAC address."); + return; + } elsif(! xCAT::NetworkUtils->isValidMAC($args_dict{'mac'})) { + setrsp_errormsg("The specified MAC address $args_dict{'mac'} is invalid. You must use a valid MAC address."); + return; } - } - %allmacsupper = (); - foreach (keys %allmacs){ - $allmacsupper{uc($_)} = 0; - } - if (exists $allmacsupper{uc($args_dict{"mac"})}){ - setrsp_errormsg("The specified MAC address $args_dict{'mac'} already exists. You must use a different MAC address."); - return; - } elsif(! xCAT::NetworkUtils->isValidMAC($args_dict{'mac'})){ - setrsp_errormsg("The specified MAC address $args_dict{'mac'} is invalid. You must use a valid MAC address."); - return; } # re-create the chain record as updating mac may means for replacing a new brand hardware... @@ -1341,9 +1365,19 @@ Usage: # Update database records. setrsp_progress("Updating database..."); # MAC table - my $mactab = xCAT::Table->new('mac',-create=>1); - $mactab->setNodeAttribs($hostname, {mac=>$args_dict{'mac'}}); - $mactab->close(); + if("__NOMAC__" eq $args_dict{"mac"}) + { + my $mactab = xCAT::Table->new('mac',-create=>1); + my %keyhash; + $keyhash{'node'} = $hostname; + $mactab->delEntries(\%keyhash); + $mactab->commit(); + $mactab->close(); + } else { + my $mactab = xCAT::Table->new('mac',-create=>1); + $mactab->setNodeAttribs($hostname, {mac=>$args_dict{'mac'}}); + $mactab->close(); + } # DB update: chain table. my $chaintab = xCAT::Table->new('chain', -create=>1); @@ -1370,6 +1404,17 @@ Usage: setrsp_progress("Warning: failed to call kit commands."); } + if("__NOMAC__" eq $args_dict{"mac"}) + { + setrsp_progress("Updating DHCP entries"); + $retref = xCAT::Utils->runxcmd({command=>["makedhcp"], node=>[$hostname], arg=>['-d']}, $request_command, 0, 2); + $retref = {}; + $retstrref = parse_runxcmd_ret($retref); + if ($::RUNCMD_RC != 0){ + setrsp_progress("Warning: failed to call kit commands."); + } + } + setrsp_progress("Re-creating nodes..."); $retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>[$hostname], macflag=>[1]}, $request_command, 0, 2); $retstrref = parse_runxcmd_ret($retref); From f2901b06d0820d42ff08ba4b1a1a2be8288115be Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 15 Sep 2014 07:02:11 -0400 Subject: [PATCH 069/110] fix description --- perl-xCAT/xCAT/Schema.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 554be4b36..acadf67ca 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -946,7 +946,7 @@ site => { " nodestatus: If set to 'n', the nodelist.status column will not be updated during\n". " the node deployment, node discovery and power operations. The default is to update.\n\n". " skiptables: Comma separated list of tables to be skipped by dumpxCATdb\n\n". - " skipvalidatelog: If set, then getcredential and getpostscript call will not be logged.\n\n". + " skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not be logged in syslog.\n\n". " -------------\n". "DHCP ATTRIBUTES\n". " -------------\n". From 2cf01b06b342205e38ce122a34711fcf1c9d077e Mon Sep 17 00:00:00 2001 From: Bruce Potter Date: Mon, 15 Sep 2014 11:53:48 -0400 Subject: [PATCH 070/110] updated xCAT-SoftLayer for rhel --- xCAT-SoftLayer/bin/modifygrub | 58 +++-- xCAT-SoftLayer/bin/pushinitrd | 27 ++- xCAT-SoftLayer/postscripts/configbond | 248 --------------------- xCAT-SoftLayer/postscripts/setdefaultroute | 28 --- xCAT-SoftLayer/xCAT-SoftLayer.spec | 12 +- 5 files changed, 63 insertions(+), 310 deletions(-) delete mode 100755 xCAT-SoftLayer/postscripts/configbond delete mode 100755 xCAT-SoftLayer/postscripts/setdefaultroute diff --git a/xCAT-SoftLayer/bin/modifygrub b/xCAT-SoftLayer/bin/modifygrub index 967509477..03a451c4c 100755 --- a/xCAT-SoftLayer/bin/modifygrub +++ b/xCAT-SoftLayer/bin/modifygrub @@ -63,26 +63,50 @@ sub addKernelParms { # get node ip and add it to the kernel parms my ($nic, $ip, $netmask, $network, $broadcast, $gateway, $mac) = getNodeIpInfo($args); if (!$ip) { die "Error: could not find the NIC that would connect to the xCAT mgmt node's IP (".$args->{mnip}.").\n"; } - # if we are booting genesis, need to add the BOOTIF parm - my $bootif; + + #if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') { if ($args->{kernelpath} =~ m/genesis\.kernel\.x86_64/) { - $bootif = $mac; + # genesis case, add additional parms for sysclone or nodeset shell + my $bootif = $mac; $bootif =~ s/:/-/g; $bootif = "BOOTIF=01-$bootif"; - } - - #todo: if you are running genesis shell (nodeset shell), this if-else will depend on the nodeset done before that. - # really should check for currstate=shell, or something like that - if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') { - # add additional parms for sysclone # DEVICE=eth0 IPADDR=10.0.0.99 NETMASK=255.255.255.0 NETWORK=10.0.0.0 BROADCAST=10.0.0.255 GATEWAY=10.0.0.1 GATEWAYDEV=eth0 #todo: should we also add ETHER_SLEEP=$WAITTIME textmode=1 dns=$mnip ? $args->{kernelparms} .= " $bootif IPADDR=$ip NETMASK=$netmask NETWORK=$network BROADCAST=$broadcast GATEWAY=$gateway HOSTNAME=$nodename DEVICE=$nic GATEWAYDEV=$nic"; } - else { # scripted install - #todo: the parameters for kickstart are likely different - $args->{kernelparms} .= " $bootif hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1"; - # print Dumper($args->{kernelparms}) + else { # scripted install (kickstart or autoyast) + if ($args->{kernelparms} =~ m/autoyast=/) { # sles + # if site.managedaddressmode=static is set, it will put several of these kernel parms on there for us. Do not duplicate in that case. + if ($args->{kernelparms} !~ m/ hostip=/) { $args->{kernelparms} .= " hostip=$ip"; } + if ($args->{kernelparms} !~ m/ netmask=/) { $args->{kernelparms} .= " netmask=$netmask"; } + if ($args->{kernelparms} !~ m/ gateway=/) { $args->{kernelparms} .= " gateway=$gateway"; } + if ($args->{kernelparms} !~ m/ hostname=/) { $args->{kernelparms} .= " hostname=$nodename"; } + if ($args->{kernelparms} !~ m/ dns=/) { $args->{kernelparms} .= " dns=$mnip"; } + # If they set installnic=mac (recommended), the netdevice will already be set to the mac. + # If they explicitly set installnic=, then ksdevice will be set to that and we will not disturb it here. + # Otherwise add netdevice set to the nic we calculated it should be. + if ($args->{kernelparms} !~ m/ netdevice=/) { $args->{kernelparms} .= " netdevice=$nic"; } + $args->{kernelparms} .= " netwait=$WAITTIME textmode=1"; + # print Dumper($args->{kernelparms}) + } + elsif ($args->{kernelparms} =~ m/ks=/) { # rhel/centos + # See https://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-kickstart2-startinginstall.html + # and http://fedoraproject.org/wiki/Anaconda/NetworkIssues for description of kickstart kernel parms + # if site.managedaddressmode=static is set, it will put several of these kernel parms on there for us. Do not duplicate in that case. + if ($args->{kernelparms} !~ m/ ip=/) { $args->{kernelparms} .= " ip=$ip"; } + if ($args->{kernelparms} !~ m/ netmask=/) { $args->{kernelparms} .= " netmask=$netmask"; } + if ($args->{kernelparms} !~ m/ gateway=/) { $args->{kernelparms} .= " gateway=$gateway"; } + if ($args->{kernelparms} !~ m/ hostname=/) { $args->{kernelparms} .= " hostname=$nodename"; } + if ($args->{kernelparms} !~ m/ dns=/) { $args->{kernelparms} .= " dns=$mnip"; } + # If they set installnic=mac (recommended), the ksdevice will already be set to the mac. + # If they explicitly set installnic=, then ksdevice will be set to that and we will not disturb it here. + # Otherwise ksdevice will be set to bootif, and we change it to the nic we calculated it should be. + if ($args->{kernelparms} =~ m/ ksdevice=bootif/) { $args->{kernelparms} =~ s/ ksdevice=bootif/ ksdevice=$nic/; } + elsif ($args->{kernelparms} !~ m/ ksdevice=/) { $args->{kernelparms} .= " ksdevice=$nic"; } + $args->{kernelparms} .= " nicdelay=$WAITTIME linksleep=$WAITTIME textmode=1"; + # print Dumper($args->{kernelparms}) + } + else { die "Error: for scripted installs, only support SLES or RHEL/CentOS as the target OS.\n"; } } } @@ -134,8 +158,10 @@ sub getNodeIpInfo { # so if we are on centos right now, we need to count down to determine the number that sles # will give the nic that we have selected, because it is the sles naming that we care about, # because that is the initrd that will be running in the scripted install case. - # For the sysclone case, genesis doxcat should be changed to use the mac to find the nic. - if (isRedhat()) { + # This works similarly (at least in some case) when rhel is the target OS. + # The preferred way is for the user to set installnic=mac, then we do not need to run this code. + # For the sysclone case, genesis doxcat uses the mac to find the nic. + if (isRedhat() && $args->{kernelparms} !~ m/ ksdevice=\S*:/ && $args->{kernelparms} !~ m/ netdevice=\S*:/) { my @nics = grep(m/^\d+:\s+eth/, @output); my $i = 0; foreach my $line (@nics) { @@ -143,8 +169,8 @@ sub getNodeIpInfo { if (defined($nictmp) && $nictmp eq $realnic) { $realnic = "eth$i"; last; } # got ip, we are done $i++; } + print "Determined that SLES/RHEL will call the install NIC $realnic (it has mac $mac)\n"; } - print "Determined that SLES will call the install NIC $realnic (it has mac $mac)\n"; # finally, find the gateway my $gateway; diff --git a/xCAT-SoftLayer/bin/pushinitrd b/xCAT-SoftLayer/bin/pushinitrd index e3927f10c..8ee1d643a 100755 --- a/xCAT-SoftLayer/bin/pushinitrd +++ b/xCAT-SoftLayer/bin/pushinitrd @@ -4,7 +4,7 @@ # even across vlans (w/o setting up pxe/dhcp broadcast relay). This assumes a working # OS is on the node. This script is primarily meant to be used in the softlayer environment. -#todo: site attr for using static ip? +#todo: work with site.managedaddressmode=static for sles use strict; use Getopt::Long; @@ -19,12 +19,12 @@ my $NOAUTOINST; my $usage = sub { my $exitcode = shift @_; - print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [--dryrun] [-w ] \n\n"; + print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [--dryrun] [-w ] [--noautoinst] \n\n"; if (!$exitcode) { print "Copy the initrd, kernel, params, and static IP info to nodes, so they can net install\n"; print "even across vlans (w/o setting up pxe/dhcp broadcast relay). This assumes a working\n"; print "OS is on the node, that you've run nodeset for these nodes, and that all of the nodes\n"; - print "are using the same osimage.\n"; + print "in this noderange are using the same osimage.\n"; } exit $exitcode; }; @@ -48,7 +48,7 @@ updateGrubOnNodes($noderange, \%bootparms); if ($DRYRUN) { exit(0); } -if ($bootparms{osimageprovmethod} eq 'install' && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); } +if ($bootparms{osimageprovmethod} eq 'install' && $bootparms{osimageosvers}=~ m/^sles/ && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); } if ($bootparms{osimageprovmethod} eq 'sysclone') { copySyscloneFiles(); } @@ -77,11 +77,20 @@ sub getBootParms { $bootparms{kcmdline} =~ s|/install/autoinst/\S+|/install/autoinst/|; # from the nodes provmethod, get the osimage provmethod, so we know the type of install - @output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod"); - chomp($output[0]); - if ($output[0] =~ m/^Could not find/) { die "Error: provmethod $bootparms{provmethod} is set for the node, but there is no osimage definition by that name."; } - my ($junk, $provmethod) = split(/=/, $output[0]); - $bootparms{osimageprovmethod} = $provmethod; + @output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod,osvers"); + foreach my $line (@output) { + chomp($line); + if ($line =~ m/^Could not find/) { die "Error: provmethod $bootparms{provmethod} is set for the node, but there is no osimage definition by that name."; } + if ($line =~ m/ provmethod=/) { + my ($junk, $provmethod) = split(/=/, $line); + $bootparms{osimageprovmethod} = $provmethod; + } + if ($line =~ m/ osvers=/) { + my ($junk, $osvers) = split(/=/, $line); + $bootparms{osimageosvers} = $osvers; + } + } + #print "provmethod=$bootparms{osimageprovmethod}, osvers=$bootparms{osimageosvers}\n"; exit; # get the mgmt node cluster-facing ip addr @output = runcmd('lsdef -t site -ci master'); diff --git a/xCAT-SoftLayer/postscripts/configbond b/xCAT-SoftLayer/postscripts/configbond deleted file mode 100755 index 5d43c3a8a..000000000 --- a/xCAT-SoftLayer/postscripts/configbond +++ /dev/null @@ -1,248 +0,0 @@ -#!/usr/bin/perl - -# xCAT postscript for configuring bonding of nics. -# Usage: configbond bond1 eth1 [eth3] -# -# Note: this postscript currently has some assumptions that are specific to the softlayer environment. -# We only use this to configure bond1, because bond0 gets configured by the node provisioning process. -# (altho this script would work for bond0) - -use strict; -# Check number of args - -my $nargs = $#ARGV + 1; -if (scalar(@ARGV) < 2 || scalar(@ARGV) > 3) { - system("logger -t xcat -p local4.err 'Usage: configbond []'"); - exit 1; -} - -my $bond = shift(@ARGV); -my $nic = $ARGV[0]; -my @devs; -foreach my $a (@ARGV) { push(@devs,split('@',$a)); } # support the new syntax in the xcat configbond postscript -my $nicips = $ENV{NICIPS}; -my $nicnetworks = $ENV{NICNETWORKS}; -my $net_cnt = $ENV{NETWORKS_LINES}; - -#todo: change this script so they dont need to specify nicnetworks -if (!$nicips || !$nicnetworks) { system("logger -t xcat -p local4.err 'configbond: must specify attributes nicips and nicnetworks in the xcat db for this node.'"); exit 1; } - -#todo: these are specific to softlayer. They should be another attribute or argument -my $bondingopts = 'mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1'; - -my $netmask =''; -my $ipaddr = ''; -my $nic_num = ''; -my $subnet = ''; -my $nic_net = ''; -my $net_name = ''; -my @nic_nets = (); # array of networks for this nic -my @nic_ips =(); # array of ipaddresses for this nic -my @networks = (); # array of all networks from networks table. - # { network_name, subnet, netmask } - -system("logger -t xcat -p local4.err 'configbond: Master: $bond'"); -system("logger -t xcat -p local4.err 'configbond: Slaves: @devs'"); -#system("logger -t xcat -p local4.err 'configbond: NIC: $nic'"); -system("logger -t xcat -p local4.err 'configbond: NICNETWORKS: $nicnetworks'"); -system("logger -t xcat -p local4.err 'configbond: NICIPS: $nicips'"); - -# Update modprobe -my $file = "/etc/modprobe.d/$bond.conf"; -if (!open(FILE, ">$file")) { system("logger -t xcat -p local4.err 'configbond: cannot open $file.'"); exit 1; } - -print FILE "alias $bond bonding\n"; -# the bonding options are put in the ifcfg file instead -#print FILE "options $bond mode=balance-rr miimon=100\n"; -close FILE; - -# create array of network info. Needed in case where there are -# more than one ip address per nic and shouldn't be many networks. -my $net_info; -my $cnt = 1; - -while ( $cnt <= $net_cnt ) { - $net_info = $ENV{"NETWORKS_LINE$cnt"}; - $net_info =~ /^netname=([^\|]*)\|\|/; - $net_name = $1; - $net_info =~ /net=([^\|]*)\|\|/; - $subnet = $1; - $net_info =~ /mask=([^\|]*)\|\|/; - $netmask = $1; - push @{ $networks[$cnt-1] }, ($net_name, $subnet, $netmask); - $cnt +=1; -} - -# get network or networks for this nic from NICNETWORKS: -# eth0:1_0_0_0-255_255_0_0|network2,eth1:1_1_0_0 -# create array of networks for this nic -foreach my $nic_networks (split(/,/,$nicnetworks)) { - my @net = (); - if ( $nic_networks =~ /!/ ) { - @net = split(/!/,$nic_networks); - } else { - @net = split(/:/,$nic_networks); - } - if ($net[0] eq $nic) { - @nic_nets = split(/\|/,$net[1]); - last; - } -} - -# get all nic ipaddress from $nicips: i.e. eth0:1.0.0.1|2.0.0.1,eth1:1.1.1.1 -# Then get all ips for this specific nic, i.e. eth0. -foreach my $ips (split(/,/,$nicips)) { - my @ip = (); - if ( $ips =~ /!/ ) { - @ip = split(/!/,$ips); - } else { - @ip = split(/:/,$ips); - } - if ($ip[0] eq $nic ) { - @nic_ips = split(/\|/,$ip[1]); - } -} - - -my $i; -for ($i=0; $i < (scalar @nic_ips) ; $i++ ) { - - # Time to create the interfaces. - # loop through the nic networks, find the matching networks to get the - # subnet and netmask and then create the appropriate ifcfg file for linux - my $specific_nic = $nic; - if ($i > 0) { - $specific_nic = $nic . ":" . ($i); - } - - #todo: support case in which nicnetworks is not specified, find the correct network by calculation - $cnt = 0; - $subnet = ""; - $netmask = ""; - $net_name = ""; - while ( $cnt < $net_cnt ) { - if ( $networks[$cnt][0] eq $nic_nets[$i] ) { - - $subnet = $networks[$cnt][1]; - $netmask = $networks[$cnt][2]; - $cnt = $net_cnt; # found match - get out. - } - else { - $cnt++; - } - } - - # check that there is a subnet and netmask set - if ( !(length($subnet) > 0) || !(length($netmask) > 0) ) { - system("logger -t xcat -p local4.err 'configbond: network subnet or netmask not set.'"); - exit 1; - } - system("logger -t xcat -p local4.err 'configbond: network subnet and netmask: $subnet, $netmask'"); - system("logger -t xcat -p local4.err 'configbond: $specific_nic, $nic_ips[$i]'"); - - # Write the master info to the ifcfg file - if (-d "/etc/sysconfig/network-scripts") { - # rhel/centos/fedora - my $dir = "/etc/sysconfig/network-scripts"; - if (!open(FILE, ">$dir/ifcfg-$bond")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$bond.'"); exit 1; } - - print FILE "DEVICE=$bond\n"; - print FILE "BOOTPROTO=none\n"; - print FILE "IPADDR=$nic_ips[$i]\n"; - print FILE "NETMASK=$netmask\n"; - print FILE "ONBOOT=yes\n"; - print FILE "USERCTL=no\n"; - print FILE qq(BONDING_OPTS="$bondingopts"\n); - close FILE; - - # Configure slaves - my @output = `ip addr show 2>&1`; # to check for existance of the device later - foreach my $dev (@devs) { - # as a convenience, make sure the device exists before adding it to the bond - if (!grep(m/^\d+:\s+$dev:/, @output)) { - system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'"); - unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning - next; - } - - system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'"); - if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; } - print FILE "DEVICE=$dev\n"; - print FILE "BOOTPROTO=none\n"; - print FILE "MASTER=$bond\n"; - print FILE "ONBOOT=yes\n"; - print FILE "SLAVE=yes\n"; - print FILE "USERCTL=no\n"; - close FILE; - } - } - elsif (-d "/etc/sysconfig/network") { - # sles - my $dir = "/etc/sysconfig/network"; - if (!open(FILE, ">$dir/ifcfg-$bond")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$bond.'"); exit 1; } - - print FILE "BOOTPROTO=static\n"; - print FILE "BONDING_MASTER=yes\n"; - print FILE "BONDING_MODULE_OPTS='$bondingopts'\n"; - print FILE "NAME='Bonded Interface'\n"; - print FILE "IPADDR=$nic_ips[$i]\n"; - print FILE "NETMASK=$netmask\n"; - print FILE "STARTMODE=onboot\n"; - print FILE "USERCONTROL=no\n"; - my $devnum = 0; - my @output = `ip addr show 2>&1`; # to check for existance of the device later - foreach my $dev (@devs) { - if (!grep(m/^\d+:\s+$dev:/, @output)) { next; } - print FILE "BONDING_SLAVE_$devnum=$dev\n"; - $devnum++; - } - close FILE; - - # Configure slaves - foreach my $dev (@devs) { - # as a convenience, make sure the device exists before adding it to the bond - if (!grep(m/^\d+:\s+$dev:/, @output)) { - system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'"); - unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning - next; - } - - system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'"); - if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; } - print FILE "BOOTPROTO=none\n"; - print FILE "STARTMODE=hotplug\n"; - close FILE; - } - } - else { - # do not recognize this distro - system("logger -t xcat -p local4.err 'configbond: network directory is not either the Red Hat or SuSE format.'"); - exit 1; - } - - # Apply the changes. Since we are only doing bond1 right now, lets not restart the whole network - # so we dont disrupt the installnic connection. Instead we just need to bring down the slave nics, - # and then bring up the bond nic. - #runcmd("service network restart"); - foreach my $dev (@devs) { - runcmd("ifdown $dev"); - } - runcmd("ifdown $bond"); # in case it was already up - runcmd("ifup $bond"); # note: this wont reload the bonding kernel module, so we are depending on the provisioning process to already have set the correct bonding options - system("logger -t xcat -p local4.info 'configbond: successfully configured $specific_nic.'"); - -} -exit 0; - -sub runcmd { - my $cmd = shift @_; - $cmd .= ' 2>&1'; - my @output = `$cmd`; - my $rc = $? >> 8; - if ($rc) { - system("logger -t xcat -p local4.err 'configeth: command $cmd failed with rc $rc: " . join('',@output) . "'"); - my $errout= "configeth: command $cmd failed with rc $rc."; - `echo $errout`; - exit $rc; - } -} diff --git a/xCAT-SoftLayer/postscripts/setdefaultroute b/xCAT-SoftLayer/postscripts/setdefaultroute deleted file mode 100755 index 7e574ca4c..000000000 --- a/xCAT-SoftLayer/postscripts/setdefaultroute +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# set the default route of the node to the ip address and nic passed in -# this should be added to the postbootscripts, NOT postscripts - -gateway="$1" -nic="$2" - -# set it temporarily -echo "ip route replace to default via $gateway dev $nic" -ip route replace to default via $gateway dev $nic - -# set it permanently -#todo: this is only for sles right now -file=/etc/sysconfig/network/routes -if grep -q -E '^default ' $file; then - # replace the default route that is already in there - sed -i 's/^default .*$/default '$gateway' - -/' $file -else - # no default route yet, append to file - echo "default $gateway - -" >>$file -fi - -# While we are here, clean up the network wait hack, if it is still there. -# (It was added during scripted install, because autoyast will not use the bond -# configuration for 1 part of the process.) Do not know a better place to clean -# this up. -sed -i '/Waiting to reach xCAT mgmt node/d' /etc/init.d/network \ No newline at end of file diff --git a/xCAT-SoftLayer/xCAT-SoftLayer.spec b/xCAT-SoftLayer/xCAT-SoftLayer.spec index c5886c787..2d03a5d4a 100644 --- a/xCAT-SoftLayer/xCAT-SoftLayer.spec +++ b/xCAT-SoftLayer/xCAT-SoftLayer.spec @@ -48,7 +48,7 @@ xCAT-SoftLayer provides Utilities to make xCAT work in a SoftLayer environment. rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/install -mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts +#mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1 mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1 @@ -59,8 +59,8 @@ cp -p -R share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/ cp -d bin/* $RPM_BUILD_ROOT/%{prefix}/bin chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/* -cp -d postscripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts -chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts/* +#cp -d postscripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts +#chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts/* cp -d si-post-install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install/* @@ -84,9 +84,3 @@ rm -rf $RPM_BUILD_ROOT %post # We are shipping the postscripts in a sysclone dir and then copying them to /install/postscripts here, # because we want to allow base xcat to eventually ship them and not conflict on the file name/path -# But base xcat now has a newer/better configbond written in bash, so if that is there do not overwrite it. -head /install/postscripts/configbond | grep -q -E '^#! */bin/bash' -if [[ $? != 0 ]]; then - # the new configbond from xcat 2.8.5 is not there, so copy ours - cp -f /%{prefix}/share/xcat/sysclone/postscripts/* /install/postscripts -fi From a4ac5c5187094f18a1d96abcefb2003a886cd689 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Mon, 15 Sep 2014 22:52:27 -0400 Subject: [PATCH 071/110] add lskit/addkit/rmkit/lskitcomp/addkitcomp/rmkitcomp/chkkitcomp/lskitdeployparam --- xCAT-client/debian/xcat-client.links | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-client/debian/xcat-client.links b/xCAT-client/debian/xcat-client.links index 26c86715a..ac2487e23 100644 --- a/xCAT-client/debian/xcat-client.links +++ b/xCAT-client/debian/xcat-client.links @@ -88,4 +88,12 @@ opt/xcat/bin/xcatclient opt/xcat/bin/lshwconn opt/xcat/bin/xcatclientnnr opt/xcat/sbin/makeroutes opt/xcat/bin/xcatclientnnr opt/xcat/sbin/snmove opt/xcat/bin/xcatclientnnr opt/xcat/bin/lsxcatd +opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskit +opt/xcat/bin/xcatclientnnr opt/xcat/bin/addkit +opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmkit +opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskitcomp +opt/xcat/bin/xcatclientnnr opt/xcat/bin/addkitcomp +opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmkitcomp +opt/xcat/bin/xcatclientnnr opt/xcat/bin/chkkitcomp +opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskitdeployparam opt/xcat/bin/xcatclient opt/xcat/bin/postage From 9d628fb636bca93cb633fbe81c62cdcac3f79fe2 Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 15 Sep 2014 21:00:26 -0700 Subject: [PATCH 072/110] fix defect #4155 [fvt]2.9:could not install xcat use the latest build for no perl(Confluent::Client) --- xCAT-server/debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/debian/control b/xCAT-server/debian/control index 1fa5e7349..2d7b5b865 100644 --- a/xCAT-server/debian/control +++ b/xCAT-server/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.7.2 Package: xcat-server Architecture: all -Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl +Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl,libjson-perl Description: Server and configuration utilities of the xCAT management project xCAT-server provides the core server and configuration management components of xCAT. This package should be installed on your management server From 252da58c7842b6c976ed68351d383a59f7a2969b Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 16 Sep 2014 02:26:10 -0400 Subject: [PATCH 073/110] fix for bug 4272: do not check php rpm, check file existence instead --- xCAT-UI/xCAT-UI.spec | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/xCAT-UI/xCAT-UI.spec b/xCAT-UI/xCAT-UI.spec index d16f9a1d4..d866c741a 100644 --- a/xCAT-UI/xCAT-UI.spec +++ b/xCAT-UI/xCAT-UI.spec @@ -101,15 +101,13 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/webportal # Inspect whether PHP related RPM packages are installed %ifos linux if [ -e "/etc/redhat-release" ]; then - rpm -q php >/dev/null - if [ $? != 0 ]; then + if [ ! -e "/etc/httpd/conf.d/php.conf" ]; then echo "" echo "Error! php has not been installed. Please run 'yum install php' before installing xCAT-UI."; exit -1; fi else # SUSE - rpm -q apache2-mod_php5 php5 >/dev/null - if [ $? != 0 ]; then + if [ ! -e "/etc/apache2/conf.d/php5.conf" ]; then echo "" echo "Error! apache2-mod_php5 and php5 have not been installed. Please run 'zypper install apache2-mod_php5 php5' before installing xCAT-UI." exit -1; From 6ec8d4c4e3ec715371d866a42553f6628a884ed3 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Tue, 16 Sep 2014 02:25:08 -0400 Subject: [PATCH 074/110] ubu power LE arch is ppc64el,ubu kit componet basename xxx-compute --- xCAT-buildkit/bin/buildkit | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 6b45d3ea9..5bf67c86f 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -1147,6 +1147,13 @@ sub edit_bldkitconf my $osarch=`uname -p`; my $kitcomponent_basename = $kitname."_compute"; + if ($debianflag==1) { + if($osarch == "ppc64le"){ + $osarch="ppc64el"; + } + $kitcomponent_basename = $kitname."-compute"; + } + for (@lines) { s/<<>>/$kitname/; s/<<>>/$kitrepoid/; From e0bbf7b1dbdac740aa8bd1e67a97781e5510e13f Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 17 Sep 2014 02:36:52 -0400 Subject: [PATCH 075/110] Code change to support SL6 --- xCAT-server/share/xcat/netboot/SL/compute.SL6.pkglist | 2 +- xCAT-server/share/xcat/netboot/SL/dracut/xcat-premount.sh | 1 + xCAT-server/share/xcat/netboot/SL/dracut/xcat-updateflag | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 120000 xCAT-server/share/xcat/netboot/SL/dracut/xcat-premount.sh create mode 120000 xCAT-server/share/xcat/netboot/SL/dracut/xcat-updateflag diff --git a/xCAT-server/share/xcat/netboot/SL/compute.SL6.pkglist b/xCAT-server/share/xcat/netboot/SL/compute.SL6.pkglist index a2ac48243..bebd8ee0a 120000 --- a/xCAT-server/share/xcat/netboot/SL/compute.SL6.pkglist +++ b/xCAT-server/share/xcat/netboot/SL/compute.SL6.pkglist @@ -1 +1 @@ -../rh/compute.rhels6.pkglist \ No newline at end of file +../rh/compute.rhels6.x86_64.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/SL/dracut/xcat-premount.sh b/xCAT-server/share/xcat/netboot/SL/dracut/xcat-premount.sh new file mode 120000 index 000000000..862e21b2e --- /dev/null +++ b/xCAT-server/share/xcat/netboot/SL/dracut/xcat-premount.sh @@ -0,0 +1 @@ +../../rh/dracut/xcat-premount.sh \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/SL/dracut/xcat-updateflag b/xCAT-server/share/xcat/netboot/SL/dracut/xcat-updateflag new file mode 120000 index 000000000..ba998cfb2 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/SL/dracut/xcat-updateflag @@ -0,0 +1 @@ +../../rh/dracut/xcat-updateflag \ No newline at end of file From 8557d86359855960a79e3d3c4a59f1ac46127082 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Wed, 17 Sep 2014 04:03:46 -0400 Subject: [PATCH 076/110] fix absolute filename in Packages that make otherpkgs intall deb package fail --- xCAT-buildkit/bin/buildkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 5bf67c86f..2f02f447f 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -776,7 +776,7 @@ sub kit_buildrepo1 return 1; } } - if ( system("dpkg-scanpackages $repodir > $repodir/Packages") ) { + if ( system("cd $repo;dpkg-scanpackages . > Packages") ) { print "Error building the repository meta-data with the dpkg-scanpackages command \n"; return 1; } From d041294800b5b7ab38ce3f4c48638aa50503bd08 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 17 Sep 2014 01:21:34 -0700 Subject: [PATCH 077/110] modify rscan test case part one --- .../autotest/testcase/restapi/node/cases0 | 119 +++++++++--------- xCAT-test/autotest/testcase/rscan/cases0 | 2 +- 2 files changed, 60 insertions(+), 61 deletions(-) diff --git a/xCAT-test/autotest/testcase/restapi/node/cases0 b/xCAT-test/autotest/testcase/restapi/node/cases0 index 1920a0da7..a1308afe4 100644 --- a/xCAT-test/autotest/testcase/restapi/node/cases0 +++ b/xCAT-test/autotest/testcase/restapi/node/cases0 @@ -8,7 +8,7 @@ start:node_post2 description: node_post2 cmd:restapitest -m POST -r /nodes/node1 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' check:rc==403 -cmdcheck:restapitest -o '{"errorcode":"1","error":["\nA definition for 'node1' already exists."]}' -O =~ +cmdcheck:restapitest -o '{"errorcode":"1"}' -O == end @@ -36,7 +36,7 @@ end start:node_delete description: node_delete -cmd:restapitest -m GET -r /nodes/node1 +cmd:restapitest -m DELETE -r /nodes/node1 check:rc==200 end @@ -51,7 +51,7 @@ start:node_get2 description: node_get2 cmd:restapitest -m GET -r /nodes/node1 check:rc==403 -cmdcheck:restapitest -o '{"errorcode":"1","error":["Could not find an object named 'node1' of type 'node'."]}' -O =~ +cmdcheck:restapitest -o '{"errorcode":"1"}' -O == end start:node_post3_for_get_test @@ -67,7 +67,6 @@ check:rc==200 cmdcheck:restapitest -o '{"node1":{"netboot":"yaboot"}}' -O == end -###########此次需先添加networks表和hosts表的net和ip属性 start:node_makehosts description: node_makehosts cmd:restapitest -m POST -r /nodes/node1/host @@ -121,70 +120,70 @@ end start:node_scan description: node_scan -cmd:restapitest -m GET -r /nodes/e108m6hmc02/subnodes +cmd:restapitest -m GET -r /nodes/__GETNODEATTR($$CN,hcp)__ check:rc==200 -cmdcheck:restapitest -o '{"Vc68m4hsp01":{"parent":"Server-9119-590-SN02C5F9E"}}' -O == +cmdcheck:restapitest -o '{"__GETNODEATTR($$CN,hcp)__":"ANY"}' -O == end start:node_power_get description: node_power_get -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/power +cmd:restapitest -m GET -r /nodes/$$CN/power check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"power":"ANY"}}' -O == +cmdcheck:restapitest -o '{"$$CN":{"power":"ANY"}}' -O == end start:node_power_put -description: node_power_put -cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/power -d '{"action":"on"}' +description: node_power_reset +cmd:restapitest -m PUT -r /nodes/$$CN/power -d '{"action":"reset"}' check:rc==200 end -start:node_energy_put -description: node_energy_put -cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/energy -d '{"cappingstatus":"on"}' -check:rc==200 -end +#start:node_energy_put +#description: node_energy_put +#cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/energy -d '{"cappingstatus":"on"}' +#check:rc==200 +#end -start:node_energy_get -description: node_energy_get -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy -check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"on"}}' -O == -end +#start:node_energy_get +#description: node_energy_get +#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy +#check:rc==200 +#cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"on"}}' -O == +#end -start:node_energy_get_attr -description: node_energy_get_attr -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy/cappingmaxmin,cappingstatus -check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"ANY"}}' -O == -end +#start:node_energy_get_attr +#description: node_energy_get_attr +#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy/cappingmaxmin,cappingstatus +#check:rc==200 +#cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"ANY"}}' -O == +#end -start:node_get_attr -description: node_get_attr -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/sp/community -check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"SP SNMP Community":"public"}}' -O == -end +#start:node_get_attr +#description: node_get_attr +#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/sp/community +#check:rc==200 +#cmdcheck:restapitest -o '{"Vc68m5sn01":{"SP SNMP Community":"public"}}' -O == +#end -start:node_put_attr -description: node_put_attr -cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/sp/community -d '{"value":"mycommunity"}'' -check:rc==200 -end +#start:node_put_attr +#description: node_put_attr +#cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/sp/community -d '{"value":"mycommunity"}'' +#check:rc==200 +#end -start:node_put_nextboot -description: node_put_nextboot -cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/nextboot -d '{"order":"net"}' -check:rc==201 -end +#start:node_put_nextboot +#description: node_put_nextboot +#cmd:restapitest -m PUT -r /nodes/$$CN/nextboot -d '{"order":"net"}' +#check:rc==201 +#end -start:node_get_nextboot -description: node_get_nextboot -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/nextboot -check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"nextboot":"net"}}' -O == -end +#start:node_get_nextboot +#description: node_get_nextboot +#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/nextboot +#check:rc==200 +#cmdcheck:restapitest -o '{"Vc68m5sn01":{"nextboot":"net"}}' -O == +#end start:node_put_bootstate description: node_put_bootstate @@ -194,9 +193,9 @@ end start:node_get_bootstate description: node_get_bootstate -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/bootstate +cmd:restapitest -m GET -r /nodes/$$CN/bootstate check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"bootstat":"boot"}}' -O == +cmdcheck:restapitest -o '{"$$CN":{"bootstat":"ANY"}}' -O == end start:node_get_vitals @@ -208,9 +207,9 @@ end start:node_get_vitals_attr description: node_get_vitals_attr -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/vitals/fanspeed +cmd:restapitest -m GET -r /nodes/$$CN/vitals/all check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"Fan 1A Tach":"3219 RPM"}}' -O == +cmdcheck:restapitest -o '{"$$CN":{"System Temperature":"ANY"}}' -O == end start:node_get_inventory @@ -227,16 +226,16 @@ check:rc==200 cmdcheck:restapitest -o '{"Vc68m5sn01":{"System Description":"System x3650 M4"}}' -O == end -start:node_get_eventlog -description: node_get_eventlog -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/eventlog -check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"eventlog":"ANY"}}' -O == -end +#start:node_get_eventlog +#description: node_get_eventlog +#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/eventlog +#check:rc==200 +#cmdcheck:restapitest -o '{"Vc68m5sn01":{"eventlog":"ANY"}}' -O == +#end start:node_post_nodecopy description: node_post_nodecopy -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/nodecopy -d '{"src":["/tmp/f1","/tmp/f2"],"target":"/tmp"}' +cmd:restapitest -m POST -r /nodes/$$CN/nodecopy -d '{"src":["/etc/hosts","/etc/resolv.conf"],"target":"/tmp"}' check:rc==201 end diff --git a/xCAT-test/autotest/testcase/rscan/cases0 b/xCAT-test/autotest/testcase/rscan/cases0 index c6e4f64a7..96484408e 100644 --- a/xCAT-test/autotest/testcase/rscan/cases0 +++ b/xCAT-test/autotest/testcase/rscan/cases0 @@ -29,7 +29,7 @@ cmd:rscan __GETNODEATTR(testnode,hcp)__ -w check:rc==0 check:output=~lpar\s+\w+\s+\d+\s+\w{4}-\w{3}\s+\w{7}\s+[\w|-]+ check:output=~cec\s+[\w|-]+\s+\w{4}-\w{3}\s+\w{7} -check:output=~hmc\s+__GETNODEATTR($$CN,hcp)__\s+\w{4}-\w{3}\s+\w{7} +check:output=~hmc\s+__GETNODEATTR($$CN,hcp)__+\s+\w{4}-\w{3}\s+\w{7} cmd:lsdef -l $$CN check:rc==0 check:output=~hcp=__GETNODEATTR($$CN,hcp)__ From b855150aee0bcd4c85c971d1f9afbc200d5debaf Mon Sep 17 00:00:00 2001 From: mellor Date: Wed, 17 Sep 2014 02:12:37 -0700 Subject: [PATCH 078/110] support -s PBMC for lsslp --- xCAT-server/lib/xcat/plugins/lsslp.pm | 32 +++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/lsslp.pm b/xCAT-server/lib/xcat/plugins/lsslp.pm index 14ba0d96d..af033a1d8 100755 --- a/xCAT-server/lib/xcat/plugins/lsslp.pm +++ b/xCAT-server/lib/xcat/plugins/lsslp.pm @@ -160,6 +160,7 @@ my %globalhwtype = ( cec => $::NODETYPE_CEC, cmm => $::NODETYPE_CMM, imm2 => $::NODETYPE_IMM2, + pbmc => "pbmc", ); my %globalnodetype = ( fsp => $::NODETYPE_PPC, @@ -170,6 +171,7 @@ my %globalnodetype = ( ivm => $::NODETYPE_PPC, cmm => $::NODETYPE_MP, lpar =>"$::NODETYPE_PPC,$::NODETYPE_OSI", + pbmc => $::NODETYPE_PPC, ); my %globalmgt = ( fsp => "fsp", @@ -182,6 +184,7 @@ my %globalmgt = ( cmm => "blade", imm2 => "blade", hmc => "hmc", + pbmc => "ipmi", ); my %globalid = ( fsp => "cid", @@ -249,7 +252,8 @@ sub parse_args { RSA => HARDWARE_SERVICE.":".SERVICE_RSA.":", CMM => HARDWARE_SERVICE.":".SERVICE_CMM, IMM2 => HARDWARE_SERVICE.":".SERVICE_IMM2, - MM => HARDWARE_SERVICE.":".SERVICE_MM.":" + MM => HARDWARE_SERVICE.":".SERVICE_MM.":", + PBMC => HARDWARE_SERVICE.":".SERVICE_FSP ); ############################################# # Responds with usage statement @@ -1116,6 +1120,16 @@ sub parse_responses { trace( $request, "Discover node $atthash{hostname}: type is $atthash{type},\ mtm is $atthash{mtm},sn is $atthash{serial}, ip is $atthash{ip},\ mac is $atthash{mac}, otherinterfaces is $atthash{otherinterfaces}" ); + } elsif (($type eq SERVICE_FSP) && ($option_s eq "PBMC")) { + my %tmphash; + $atthash{type} = "pbmc"; + $atthash{mtm} = ${$attributes->{'machinetype-model'}}[0]; + $atthash{serial} = ${$attributes->{'serial-number'}}[0]; + $atthash{ip} = ${$searchmacs{$rsp}}{peername}; + $atthash{url} = ${$searchmacs{$rsp}}{payload}; + $atthash{hostname} = 'Server-'.$atthash{mtm}.'-SN'.$atthash{serial}; + $outhash{'Server-'.$atthash{mtm}.'-SN'.$atthash{serial}} = \%atthash; + }elsif (($type eq SERVICE_FSP) && (${$attributes->{'machinetype-model'}}[0] =~ /^7895|1457|7954/ )) { # Skip this entry if "-s CEC" was specified - we do not list FSP entries for Flex when only CECs were requested next unless ($option_s ne "CEC"); @@ -1179,7 +1193,7 @@ sub parse_responses { otherinterfaces is $tmphash1{otherinterfaces}" ); } } - }else { + }else { #begin to define fsp and bpa my %tmphash; $tmphash{type} = ($type eq SERVICE_BPA) ? TYPE_BPA : TYPE_FSP; @@ -1447,6 +1461,7 @@ sub xCATdB { my %hostshash; my %machash; my %mphash; + my %ipmihash; foreach my $nodeentry ( keys %$outhash ) { my $type = ${$outhash->{$nodeentry}}{type}; my $model = ${$outhash->{$nodeentry}}{mtm}; @@ -1479,6 +1494,13 @@ sub xCATdB { $nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}}; $hostshash{$hostname} = {otherinterfaces=>$otherif} if ($type =~ /fsp|bpa/); $machash{$hostname} = {mac=>$mac} if ($type =~ /^fsp|bpa$/); + } elsif ( $type =~ /^pbmc$/) { + $nodelisthash{$hostname} = {groups=>$groups, hidden=>$hidden}; + $ppchash{$hostname} = {nodetype=>$globalhwtype{$type}}; + $vpdhash{$hostname} = {mtm=>$model, serial=>$serial}; + $nodehmhash{$hostname} = {mgt=>$globalmgt{$type}}; + $nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}}; + $ipmihash{$hostname} = {bmc=>$ip}; } elsif ( $type =~ /^(rsa|mm)$/ ) { my @data = ($type, $model, $serial, $side, $ip, $frameid, $cageid, $parent, $mac); xCAT::PPCdb::add_systemX( $type, $hostname, \@data ); @@ -1512,7 +1534,7 @@ sub xCATdB { $dbhash{hosts} = \%hostshash, if (%hostshash); $dbhash{mac} = \%machash, if (%machash); $dbhash{mp} = \%mphash, if (%mphash); - + $dbhash{ipmi} = \%ipmihash, if (%ipmihash); for my $tab (keys %dbhash) { my $db = xCAT::Table->new($tab); @@ -1553,6 +1575,8 @@ sub format_stanza { $result .= "$hostname:\n\tobjtype=node\n"; if ($type =~ /^cmm$/){ $result .= "\tmpa=${$outhash->{$name}}{hostname}\n"; + } elsif ($type =~ /^pbmc$/) { + $result .= "\tbmc=${$outhash->{$name}}{ip}\n"; }else{ $result .= "\thcp=${$outhash->{$name}}{hostname}\n"; } @@ -1571,7 +1595,7 @@ sub format_stanza { if ($type =~ /^fsp|bpa|cec$/ and exists(${$outhash->{$name}}{parent})) { $result .= "\tparent=${$outhash->{$name}}{parent}\n"; } - unless ($type =~ /^frame|cec$/){ + unless ($type =~ /^frame|cec$/ or !exists(${$outhash->{$name}}{mac})){ $result .= "\tmac=${$outhash->{$name}}{mac}\n"; } if ($type =~ /^fsp|bpa$/){ From 7d84551ce5249df0e3b7b5ae901165d0ddccfb1b Mon Sep 17 00:00:00 2001 From: baiyuan Date: Wed, 17 Sep 2014 05:57:28 -0400 Subject: [PATCH 079/110] fix syntax error in postinst and preinst --- xCAT-buildkit/share/xcat/kits/debian_template/preinst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-buildkit/share/xcat/kits/debian_template/preinst b/xCAT-buildkit/share/xcat/kits/debian_template/preinst index a0b2977c5..6232bd33d 100644 --- a/xCAT-buildkit/share/xcat/kits/debian_template/preinst +++ b/xCAT-buildkit/share/xcat/kits/debian_template/preinst @@ -20,7 +20,7 @@ case "$1" in ;; upgrade) - if [ -f /tmp/<<>> ] + if [ -f /tmp/<<>> ]; then <<>> fi ;; From 47d8713482b97b98413b9cce5765f38c350b5604 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Wed, 17 Sep 2014 05:57:59 -0400 Subject: [PATCH 080/110] fix syntax error in postinst --- xCAT-buildkit/share/xcat/kits/debian_template/postinst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-buildkit/share/xcat/kits/debian_template/postinst b/xCAT-buildkit/share/xcat/kits/debian_template/postinst index 54d566f4e..d12542954 100644 --- a/xCAT-buildkit/share/xcat/kits/debian_template/postinst +++ b/xCAT-buildkit/share/xcat/kits/debian_template/postinst @@ -21,7 +21,7 @@ set -e case "$1" in configure) <<>> - if [ -f /tmp/<<>> ] + if [ -f /tmp/<<>> ]; then <<>> rm /tmp/<<>> fi From 1eb7f10e2e4f98bd2498cfd69d353cd925b97d5c Mon Sep 17 00:00:00 2001 From: root Date: Wed, 17 Sep 2014 20:06:11 -0700 Subject: [PATCH 081/110] modify xdcp test case part one --- xCAT-test/autotest/testcase/xdcp/cases0 | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/xdcp/cases0 b/xCAT-test/autotest/testcase/xdcp/cases0 index 102e14c1d..fb97776c9 100644 --- a/xCAT-test/autotest/testcase/xdcp/cases0 +++ b/xCAT-test/autotest/testcase/xdcp/cases0 @@ -1,7 +1,6 @@ start:xdcp_h cmd:xdcp -h check:rc==0 -check:output=~Usage end start:xdcp_V From af98c573fbc3e788875769ef7546cd5b2097dd19 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 17 Sep 2014 20:08:35 -0700 Subject: [PATCH 082/110] modify xdcp test case part one --- xCAT-test/autotest/testcase/copycds/cases0 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-test/autotest/testcase/copycds/cases0 b/xCAT-test/autotest/testcase/copycds/cases0 index 2bc29ee4a..be409c351 100644 --- a/xCAT-test/autotest/testcase/copycds/cases0 +++ b/xCAT-test/autotest/testcase/copycds/cases0 @@ -1,6 +1,6 @@ start:copycds_iso os:Linux -cmd:umount /mnt/xcat +#cmd:umount /mnt/xcat cmd:copycds $$ISO check:rc==0 check:output=~Copying media to /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__ @@ -11,7 +11,7 @@ end start:copycds_n os:Linux -cmd:umount /mnt/xcat +#cmd:umount /mnt/xcat cmd:copycds -n __GETNODEATTR($$CN,os)__ $$ISO check:rc==0 check:output=~Copying media to /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__ @@ -22,7 +22,7 @@ end start:copycds_a os:Linux -cmd:umount /mnt/xcat +#cmd:umount /mnt/xcat cmd:copycds -a __GETNODEATTR($$CN,arch)__ $$ISO check:rc==0 check:output=~Copying media to /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__ @@ -33,7 +33,7 @@ end start:copycds_n_a os:Linux -cmd:umount /mnt/xcat +#cmd:umount /mnt/xcat cmd:copycds -n __GETNODEATTR($$CN,os)__ -a __GETNODEATTR($$CN,arch)__ $$ISO check:rc==0 check:output=~Copying media to /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__ @@ -44,14 +44,14 @@ end start:copycds_a_err os:Linux -cmd:umount /mnt/xcat +#cmd:umount /mnt/xcat cmd:copycds -a 386 $$ISO check:output=~Error end start:copycds_n_err os:Linux -cmd:umount /mnt/xcat +#cmd:umount /mnt/xcat cmd:copycds -n aix $$ISO check:rc!=0 check:output=~Error From d12e49efe30e3b8ccc8f9f4e9cea6fc222db9bc7 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 18 Sep 2014 01:16:33 -0700 Subject: [PATCH 083/110] remove temp files in the git --- xCAT-OpenStack-baremetal/debian/files | 2 - .../xcat-openstack-baremetal.debhelper.log | 201 ------------------ 2 files changed, 203 deletions(-) delete mode 100644 xCAT-OpenStack-baremetal/debian/files delete mode 100644 xCAT-OpenStack-baremetal/debian/xcat-openstack-baremetal.debhelper.log diff --git a/xCAT-OpenStack-baremetal/debian/files b/xCAT-OpenStack-baremetal/debian/files deleted file mode 100644 index 0bf4353c0..000000000 --- a/xCAT-OpenStack-baremetal/debian/files +++ /dev/null @@ -1,2 +0,0 @@ -xcat-openstack-baremetal_2.8.4-1_all.deb admin extra -xcat-openstack-baremetal_2.8.4-1_all.deb admin extra diff --git a/xCAT-OpenStack-baremetal/debian/xcat-openstack-baremetal.debhelper.log b/xCAT-OpenStack-baremetal/debian/xcat-openstack-baremetal.debhelper.log deleted file mode 100644 index a151b91a0..000000000 --- a/xCAT-OpenStack-baremetal/debian/xcat-openstack-baremetal.debhelper.log +++ /dev/null @@ -1,201 +0,0 @@ -dh_installdirs -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb From 425f741435e94904538024a23c05eb27c53991e9 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 18 Sep 2014 01:19:02 -0700 Subject: [PATCH 084/110] remove temp file fron git --- xCAT-rmc/debian/files | 1 - 1 file changed, 1 deletion(-) delete mode 100644 xCAT-rmc/debian/files diff --git a/xCAT-rmc/debian/files b/xCAT-rmc/debian/files deleted file mode 100644 index 0cd53ffdc..000000000 --- a/xCAT-rmc/debian/files +++ /dev/null @@ -1 +0,0 @@ -xcat-rmc_2.5.0-1_all.deb admin extra From ec400ad4b457648dd9d6fb5f17a92570f26fa710 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Thu, 18 Sep 2014 05:35:23 -0400 Subject: [PATCH 085/110] add pkg1 sample for debian kit to let default buildkit.conf work --- .../source_packages/sample/pkg1/pkg1_1-2_all.deb | Bin 0 -> 1788 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 xCAT-buildkit/share/xcat/kits/kit_template/source_packages/sample/pkg1/pkg1_1-2_all.deb diff --git a/xCAT-buildkit/share/xcat/kits/kit_template/source_packages/sample/pkg1/pkg1_1-2_all.deb b/xCAT-buildkit/share/xcat/kits/kit_template/source_packages/sample/pkg1/pkg1_1-2_all.deb new file mode 100644 index 0000000000000000000000000000000000000000..4a445c94a1b13491779824d2427f787d13f3dddc GIT binary patch literal 1788 zcmai#X*3&%8iqrvOsEDmjawv9LOUd(mRdt8wZwLfy$Dib9fWI3w6#@LYYQd1Sc0P3 zs_3;elv_$%L`!Nfp-n7PMa6FPF7tPu^PTsc?|kR|_nh;=4RDcufkq&Iye|P4rshis z!$royU@&z}b#?Rw4P6Z#7z};1|3B5yXl+eR80={NhYv^ti3a(FhY=&gLy$yVBr+iW zulrh>7yj%+GerPD5CpEUO@b%Tr-WBazMmsbiqndK66+~&%D@nop;eDO+Of1AvY(InTO<91l+x^#gJ5gRDj50Cy;e35#^N3s>FLokg z4LCR7^}KS=CVM?l+vtX6>%|#1$&L|>sn`ZaVEKc|GoxL#T?ZNpaG=|9#PKa57 zenH|*>%aWYyxzh`XV-E~H+VSgtkGpG5~snsmyU2*7poS{@mgB>2;BcHRjPwl!VrlD z{drCLGZO?tOi~1Sy&}|{o1TfDG_mn{l8Lj{%HnMP<4by%0e5OPX;?4Vbu*`K`kB(< zz_xtlVL=k&HfOK4S<&af+eEx~es>v_-v7_v4Xb7iKPLq*G)~wm?`56lAL_1KY@eoe z?6n`q*A}#PQ?vr7o$E(B7DplY5FlMEKTUmsZ(jA%<54C4mEng>{NP2WtbHZrV(W7u zBj~DNm!=jL{X@;Dz25V6(GJW>C6Pi;Q6Cx}M!h{TK00tEkWy{@!rh^T>T48AOqopc z7U~b#7&3vjEK9mSORq~%6we0_UE<_BKRqwTvC{9MmYo{rZf@V`+yawcS-OHGE{VWX zz<;iM zai~u9My^MjBxR)w`Rff>qG2|Q21V%G<#~8=oFJGvxU-9k?)cwR6()40So&5&Jdy89 zwu77!kZ;s!*TU4+14^k%2-Z$Pa_cI2!1SNdiUAD_(7qAJD zfRoM*V*DDv&v*KIu)kO=YlI1$&Fhy#NcuL*!)}g?QtVLEAqTkE=akJtb_wk@n?IGB zHQHL z4=j?Fw89m*fmawNY9;Bb=J6t5B)P9vTDsH%k1OdmgtpcZ^agW^1PT{Ma zirX&4_rFc7Xe;!(e;0V7Tf#a30uP}^^)BGdW$de;77-BIo~$0drClwL{oejDVe#L* znrTePHE}bJESXw<_<(z?TuABR`!|zf%egL&*A&AH-0=o?roHZG7)OcE0ML~Y8D*|( zx{{wFi56-GG%GdP1zHjDu^?F9urswNLuD&f^)gSp#MrKWuvh8hPcx)2iF>HWA9+yM z4TelrtaUd+57L`RmFx&qDq-=bK&y}9uJi#HD5z*&Qa#% zVskfDy_xb;Z##>FvObXhMO0oTHq^d{@cnqL*fxom$1VtaCJ}aCU30V!#(>3|nTb|qf1ll`G*qqhNk;;zDZqAhV=W+k>{G?Tu;uZl zgAw{0pX9#yAnL$;W$!kP%y2IkZ-w8;dW#}y6JJ&EN4h6Eddf&;vR(>n`}>)r9bda7 zWM;vb+u+GGOF_AJO_q)y8C56E=!xI7yGK>twPg>*kb~BLrau?>w(w>sbiwvie^E^I zb Date: Thu, 18 Sep 2014 20:01:37 -0700 Subject: [PATCH 086/110] remove the lsslp defined pbmc node from the found nodes --- xCAT-server/lib/perl/xCAT/PPC.pm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) mode change 100755 => 100644 xCAT-server/lib/perl/xCAT/PPC.pm diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm old mode 100755 new mode 100644 index 8a53afdeb..e32ac42c9 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -2155,11 +2155,28 @@ sub findme { push @attr_array, "mtm==$request->{mtm}->[0]"; push @attr_array, "serial==$request->{serial}->[0]"; - my @nodes = $vpdtab->getAllAttribsWhere(\@attr_array, 'node'); + my @tmp_nodes = $vpdtab->getAllAttribsWhere(\@attr_array, 'node'); + my @nodes = (); + my %nodes_hash = (); + foreach (@tmp_nodes) { + $nodes_hash{$_->{node}} = '1'; + } + @nodes = keys (%nodes_hash); + # remove the pbmc node defined by lsslp from the node groups + my $ppctab = xCAT::Table->new('ppc'); + if ($ppctab) { + my $ppchash = $ppctab->getNodesAttribs(\@nodes, ['node', 'nodetype']); + foreach (@nodes) { + if (defined($ppchash->{$_}->[0]) && defined($ppchash->{$_}->[0]->{'nodetype'}) && $ppchash->{$_}->[0]->{'nodetype'} eq 'pbmc') { + delete $nodes_hash{$_}; + } + } + @nodes = keys (%nodes_hash); + } foreach (@nodes) { my $req = {%$request}; $req->{command} = ['discovered']; - $req->{noderange} = [$_->{node}]; + $req->{noderange} = [$_]; $req->{discoverymethod} = ['mtms']; $subreq->($req); %{$req} = (); From ba706470d0765ee289689229985efad533cdee3b Mon Sep 17 00:00:00 2001 From: mellor Date: Fri, 19 Sep 2014 07:50:53 -0700 Subject: [PATCH 087/110] support rspconfig ip/netmask/gateway for Power LE machine --- xCAT-server/lib/xcat/plugins/ipmi.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index f6c02a0ca..a6334f063 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -789,12 +789,25 @@ sub setnetinfo { else { return(1,"configuration of $subcommand is not implemented currently"); } + unless ($sessdata->{netinfo_setinprogress}) { + $sessdata->{netinfo_setinprogress} = '1'; + $sessdata->{ipmisession}->subcmd(netfn=>$netfun, command=>0x01, data=>[$channel_number,0x0,0x1], callback=>\&setnetinfo,callback_args=>$sessdata); + } my $command = shift @cmd; $sessdata->{ipmisession}->subcmd(netfn=>$netfun,command=>$command,data=>\@cmd,callback=>\&netinfo_set,callback_args=>$sessdata); } sub netinfo_set { my $rsp = shift; my $sessdata = shift; + if ($sessdata->{netinfo_setinprogress}) { + my $channel_number = $sessdata->{ipmisession}->{currentchannel}; + delete $sessdata->{netinfo_setinprogress}; + $sessdata->{rsp}->{error} = $rsp->{error}; + $sessdata->{rsp}->{code} = $rsp->{code}; + $sessdata->{ipmisession}->subcmd(netfn=>0x0c, command=>0x01, data=>[$channel_number,0x0,0x0], callback=>\&netinfo_set,callback_args=>$sessdata); + } else { + $rsp = $sessdata->{rsp}; + } if ($rsp->{error}) { xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes); return; @@ -886,6 +899,7 @@ sub getnetinfo_response { my $rsp = shift; my $sessdata = shift; my $subcommand = $sessdata->{subcommand}; + $subcommand =~ s/=.*//; $sessdata->{subcommand} = shift @{$sessdata->{extraargs}}; if ($rsp->{error}) { xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes); From 1407d0044ef8a16ed9d81f79a556c0d19fe7e354 Mon Sep 17 00:00:00 2001 From: mellor Date: Fri, 19 Sep 2014 08:00:13 -0700 Subject: [PATCH 088/110] Do clean up things for Power LE hardware discovery --- xCAT-server/lib/perl/xCAT/PPC.pm | 63 ++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index e32ac42c9..8699034a0 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -2157,6 +2157,7 @@ sub findme { my @tmp_nodes = $vpdtab->getAllAttribsWhere(\@attr_array, 'node'); my @nodes = (); + my $pbmc_node; my %nodes_hash = (); foreach (@tmp_nodes) { $nodes_hash{$_->{node}} = '1'; @@ -2169,6 +2170,7 @@ sub findme { foreach (@nodes) { if (defined($ppchash->{$_}->[0]) && defined($ppchash->{$_}->[0]->{'nodetype'}) && $ppchash->{$_}->[0]->{'nodetype'} eq 'pbmc') { delete $nodes_hash{$_}; + $pbmc_node = $_; } } @nodes = keys (%nodes_hash); @@ -2181,6 +2183,67 @@ sub findme { $subreq->($req); %{$req} = (); } + &cleanup_for_powerLE_hardware_discovery($nodes[-1], $pbmc_node, $subreq); +} + +sub cleanup_for_powerLE_hardware_discovery { + my $host_node = shift; + my $pbmc_node = shift; + my $subreq = shift; + my $ipmitab = xCAT::Table->new("ipmi"); + unless($ipmitab) { + xCAT::MsgUtils->message("S", "Discovery Error: can not open ipmi table."); + return; + } + my @nodes = ($host_node, $pbmc_node); + my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['node', 'bmc', 'username', 'password']); + if ($ipmihash) { + my $new_bmc_ip = $ipmihash->{$host_node}->[0]->{bmc}; + my $new_bmc_password = $ipmihash->{$host_node}->[0]->{password}; + + xCAT::MsgUtils->message("S", "Discover info: configure ip:$new_bmc_ip for pbmc_node:$pbmc_node."); + if($new_bmc_ip) { + xCAT::Utils->runxcmd( + { + command => ["rspconfig"], + node => ["$pbmc_node"], + arg => [ "ip=$new_bmc_ip" ], + }, + $subreq, 0,1); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("S", "Discovery Error: configure IP address failed for FSP."); + return; + } + xCAT::Utils->runxcmd( + { + command => ["chdef"], + node => ["$pbmc_node"], + arg => [ "bmc=$new_bmc_ip" ], + }, + $subreq, 0,1); + } + xCAT::MsgUtils->message("S", "Discovery info: configure password:$new_bmc_password for pbmc_node:$pbmc_node."); + if ($new_bmc_password) { + xCAT::Utils->runxcmd( + { + command => ["rspconfig"], + node => ["$pbmc_node"], + arg => [ "password=$new_bmc_password" ], + }, + $subreq, 0,1); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("S", "Discovery Error: configure password failed for FSP."); + return; + } + } + xCAT::MsgUtils->message("S", "Discovery info: remove pbmc_node:$pbmc_node."); + xCAT::Utils->runxcmd( + { + command => ["rmdef"], + node => ["$pbmc_node"], + }, + $subreq, 0,1); + } } ########################################################################## # Process request from xCat daemon From a5dceadccf89209b1137be9bb579cd094584a7d7 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Mon, 22 Sep 2014 04:09:22 -0400 Subject: [PATCH 089/110] NEW_kit_addpkgs support debian --- xCAT-buildkit/bin/buildkit | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 2f02f447f..53b7662c4 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -776,8 +776,8 @@ sub kit_buildrepo1 return 1; } } - if ( system("cd $repo;dpkg-scanpackages . > Packages") ) { - print "Error building the repository meta-data with the dpkg-scanpackages command \n"; + if ( system("cd $repodir;dpkg-scanpackages . > Packages") ) { + print "Error building the repository meta-data with the dpkg-scanpackages command \n"; return 1; } } @@ -1145,6 +1145,7 @@ sub edit_bldkitconf my ($osbasename,$osmore) = split(/\,/, $osinfo); my ($osmajorversion,$osminorversion) = split(/\./, $osmore); my $osarch=`uname -p`; + my $kitcomponent_basename = $kitname."_compute"; if ($debianflag==1) { @@ -3594,9 +3595,13 @@ sub NEW_kit_addpkgs if ($kp->{isexternalpkg} eq 'yes') { my $ext_filename = $kp->{filename}; my $ext_reponames = $kp->{kitreponame}; - - my $files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename); - + my $files; + if($debianflag){ + $files = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirlist, $ext_filename); + } + else { + $files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename); + } if (!defined($files) ) { print "Error: The product package file $ext_filename was not found in the package directory(s) @pkgdirlist.\n"; # Cleanup From 25ffc91f0f44561e6f7a984c790207b54cb5a0d9 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Mon, 22 Sep 2014 04:24:00 -0400 Subject: [PATCH 090/110] find latest deb pkg --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 120 +++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index 18d7df37c..a410e1b6d 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -160,6 +160,7 @@ sub find_latest_pkg my @rpms; my %foundrpm; + # need to check each pkgdir for the rpm(s) # - if more than one match need to pick latest # find all the matches in all the directories @@ -223,6 +224,125 @@ sub find_latest_pkg } } +#-------------------------------------------------------------------------- +=head3 find_latest_pkg_deb + + Find the latest deb package give the deb name and a list of + possible package locations. + + Arguments: + - a list of package directories + - the name of the deb + Returns: + - \@founddeblist + - undef + Example: + my $newrpm = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirs, $debname); + Comments: + +=cut +#-------------------------------------------------------------------------- +sub find_latest_pkg_deb +{ + my ($class, $pkgdirs, $debname) = @_; + my @pkgdirlist = @$pkgdirs; + + my @debs; + my %founddeb; + + + # need to check each pkgdir for the deb(s) + # - if more than one match need to pick latest + # find all the matches in all the directories + foreach my $debdir (@pkgdirlist) { + my $ffile = $debdir."/".$debname; + + if ( system("/bin/ls $ffile > /dev/null 2>&1") ){ + # if not then skip to next dir + next; + } else { + # if so then get the details and add it to the %founddeb hash + my $cmd = "/bin/ls $ffile 2>/dev/null"; + my $output = `$cmd`; + my @deblist = split(/\n/, $output); + + if ( scalar(@deblist) == 0) { + next; + } + + foreach my $r (@deblist) { + my $basename = `dpkg -I $r* |grep Package|awk '{print \$2}'`; + chomp $basename; + + my $version = `dpkg -I $r* |grep Version|awk '{print \$2}'`; + print "$basename:$version"; + + $founddeb{$basename}{$r}{version}=$version; + } + } + } + + # for each unique deb basename + foreach my $r (keys %founddeb ) { + # if more than one with same basename then find the latest + my $latestmatch=""; + foreach my $fdeb (keys %{$founddeb{$r}} ) { + # if we already found a match in some other dir + if ($latestmatch) { + # then we need to figure out which is the newest + # if the $fdeb is newer than use it + if ( xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, ">", $founddeb{$r}{$latestmatch}{version}) ) { + $latestmatch = $fdeb; + } + + } else { + $latestmatch = $fdeb; + } + } + push(@debs, $latestmatch); + } + + if (scalar(@debs)) { + return \@debs; + } else { + return undef; + } +} + + +#------------------------------------------------------------------------------ + + +=head3 testVersion_deb + + Compare version1 and version2 according to the operator and + return 1 0 or 0. + + Arguments: + $version1 + $operator + $version2 + Returns: + 1 or 0 + Example: + + Comments: + The return value is generated with the Require query + +=cut + +#----------------------------------------------------------------------------- +sub testVersion_deb +{ + my ($class, $version1, $operator, $version2) = @_; + + my $result =`dpkg --compare-versions $version1 $operator $version2`; + + return $result; + +} + + #------------------------------------------------------------------------------ From 547cbd42179454e161e86f3de5769cb7719c6e76 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 22 Sep 2014 10:28:08 -0400 Subject: [PATCH 091/110] add xmlapi test cases, they do not need to ship with rpm --- xCAT-test/xmlapi/README | 55 ++++++++++++++++++ xCAT-test/xmlapi/Table.pm.routines | 13 +++++ xCAT-test/xmlapi/delEntriesreq | 11 ++++ xCAT-test/xmlapi/delEntriesreq2 | 17 ++++++ xCAT-test/xmlapi/delEntriesreq3 | 7 +++ xCAT-test/xmlapi/deltblreq | 35 ++++++++++++ xCAT-test/xmlapi/getAllEntries | 37 ++++++++++++ xCAT-test/xmlapi/getAllEntries.save1 | 37 ++++++++++++ xCAT-test/xmlapi/getAllEntriesreq | 5 ++ xCAT-test/xmlapi/getAllEntriesreq.save | 5 ++ xCAT-test/xmlapi/getAllEntriesreq.save1 | 5 ++ xCAT-test/xmlapi/getAttribsreq | 10 ++++ xCAT-test/xmlapi/getAttribsreq.old | 8 +++ xCAT-test/xmlapi/getAttribsreq2 | 11 ++++ xCAT-test/xmlapi/getNodeAttribs | 50 ++++++++++++++++ xCAT-test/xmlapi/getNodeAttribs1 | 50 ++++++++++++++++ xCAT-test/xmlapi/getNodesAttribsreq | 8 +++ xCAT-test/xmlapi/getNodesAttribsreq1 | 7 +++ xCAT-test/xmlapi/getNodesAttribsreq2 | 7 +++ xCAT-test/xmlapi/getTablesAllNodeAttribsreq | 9 +++ xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 | 14 +++++ xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 | 13 +++++ xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 | 36 ++++++++++++ xCAT-test/xmlapi/getTablesAllRowAttribsreq | 12 ++++ xCAT-test/xmlapi/getTablesNodesAttribsreq | 9 +++ xCAT-test/xmlapi/getTablesNodesAttribsreq1 | 13 +++++ xCAT-test/xmlapi/getTablesNodesAttribsreq2 | 9 +++ xCAT-test/xmlapi/noderange | 14 +++++ xCAT-test/xmlapi/noderangereq | 5 ++ xCAT-test/xmlapi/noderangereq.save | 5 ++ xCAT-test/xmlapi/noderangereq.save1 | 5 ++ xCAT-test/xmlapi/readtblreq | 34 +++++++++++ xCAT-test/xmlapi/readtblreq.node | 34 +++++++++++ xCAT-test/xmlapi/setAttribs | 17 ++++++ xCAT-test/xmlapi/setAttribsreq | 12 ++++ xCAT-test/xmlapi/setAttribsreq1 | 13 +++++ xCAT-test/xmlapi/setAttribsreq2 | 13 +++++ xCAT-test/xmlapi/setNodeAttribs | 19 +++++++ xCAT-test/xmlapi/setNodesAttribsreq | 14 +++++ xCAT-test/xmlapi/setNodesAttribsreq1 | 14 +++++ xCAT-test/xmlapi/setNodesAttribsreq1.1 | 21 +++++++ xCAT-test/xmlapi/setNodesAttribsreq1.new | 14 +++++ xCAT-test/xmlapi/setNodesAttribsreq2 | 17 ++++++ xCAT-test/xmlapi/setNodesAttribsreq3 | 19 +++++++ xCAT-test/xmlapi/xmldriver | 40 +++++++++++++ xCAT-test/xmlapi/xmldriver.old | 60 ++++++++++++++++++++ xCAT-test/xmlapi/xmldriver.org | 43 ++++++++++++++ xCAT-test/xmlapi/xmlrequest.org | 6 ++ xCAT-test/xmlapi/xmlresponse | 9 +++ 49 files changed, 921 insertions(+) create mode 100644 xCAT-test/xmlapi/README create mode 100644 xCAT-test/xmlapi/Table.pm.routines create mode 100644 xCAT-test/xmlapi/delEntriesreq create mode 100644 xCAT-test/xmlapi/delEntriesreq2 create mode 100644 xCAT-test/xmlapi/delEntriesreq3 create mode 100644 xCAT-test/xmlapi/deltblreq create mode 100644 xCAT-test/xmlapi/getAllEntries create mode 100644 xCAT-test/xmlapi/getAllEntries.save1 create mode 100644 xCAT-test/xmlapi/getAllEntriesreq create mode 100644 xCAT-test/xmlapi/getAllEntriesreq.save create mode 100644 xCAT-test/xmlapi/getAllEntriesreq.save1 create mode 100644 xCAT-test/xmlapi/getAttribsreq create mode 100644 xCAT-test/xmlapi/getAttribsreq.old create mode 100644 xCAT-test/xmlapi/getAttribsreq2 create mode 100644 xCAT-test/xmlapi/getNodeAttribs create mode 100644 xCAT-test/xmlapi/getNodeAttribs1 create mode 100644 xCAT-test/xmlapi/getNodesAttribsreq create mode 100644 xCAT-test/xmlapi/getNodesAttribsreq1 create mode 100644 xCAT-test/xmlapi/getNodesAttribsreq2 create mode 100644 xCAT-test/xmlapi/getTablesAllNodeAttribsreq create mode 100644 xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 create mode 100644 xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 create mode 100644 xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 create mode 100644 xCAT-test/xmlapi/getTablesAllRowAttribsreq create mode 100644 xCAT-test/xmlapi/getTablesNodesAttribsreq create mode 100644 xCAT-test/xmlapi/getTablesNodesAttribsreq1 create mode 100644 xCAT-test/xmlapi/getTablesNodesAttribsreq2 create mode 100644 xCAT-test/xmlapi/noderange create mode 100644 xCAT-test/xmlapi/noderangereq create mode 100644 xCAT-test/xmlapi/noderangereq.save create mode 100644 xCAT-test/xmlapi/noderangereq.save1 create mode 100644 xCAT-test/xmlapi/readtblreq create mode 100644 xCAT-test/xmlapi/readtblreq.node create mode 100644 xCAT-test/xmlapi/setAttribs create mode 100644 xCAT-test/xmlapi/setAttribsreq create mode 100644 xCAT-test/xmlapi/setAttribsreq1 create mode 100644 xCAT-test/xmlapi/setAttribsreq2 create mode 100644 xCAT-test/xmlapi/setNodeAttribs create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq1 create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq1.1 create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq1.new create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq2 create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq3 create mode 100755 xCAT-test/xmlapi/xmldriver create mode 100755 xCAT-test/xmlapi/xmldriver.old create mode 100644 xCAT-test/xmlapi/xmldriver.org create mode 100644 xCAT-test/xmlapi/xmlrequest.org create mode 100644 xCAT-test/xmlapi/xmlresponse diff --git a/xCAT-test/xmlapi/README b/xCAT-test/xmlapi/README new file mode 100644 index 000000000..4d770945b --- /dev/null +++ b/xCAT-test/xmlapi/README @@ -0,0 +1,55 @@ +xCAT has an XML input interface to the xCAT tables. The routines are in tabutils.pm and map to the +Table.pm routines by the same name. These routines were written for PCM but are also used in the restapi. They are not a documented api. +For the restapi, check the following for how and which routines are used. +xCAT-server/xCAT-wsapi/xcatws.cgi at all the functions between tablenodehdl() and tablerowdelhdl(). + + getAllEntries => "tabutils", + getNodesAttribs => "tabutils", + getTablesAllNodeAttribs => "tabutils", + getTablesNodesAttribs => "tabutils", + getTablesAllRowAttribs => "tabutils", + setNodesAttribs => "tabutils", + delEntries => "tabutils", + getAttribs => "tabutils", + setAttribs => "tabutils", + NodeRange => "tabutils", + +If you vi /opt/xcat/lib/perl/xCAT_plugin/tabutils.pm, and search for example "sub getAllEntries", you will see documented in the routines comments to input XML format requried and the output XML sent. + +To test these routines, I put together a driver program pcmdriver, that generates the test XML and sends it and displays the returned output. + + +For example: +vi xmldriver in this directory + +You will see + + $ENV{'XCATXMLTRACE'}=1; +my $XML=`cat /.../xmlapi/getTablesAllRowAttribsreq`; +my $data=$XML; + +$ENV{'XCATSHOWXML'}=1; + +xCAT::Client::submit_request($data, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; + +If you vi getTablesAllRowAttribsreq, you will see the following. This is an XML request to get the all rows from the passwd table the attributes username and rack. These is one of these XML request files for all +possible input to the routines in the directory. + +XCATXMLTRACE is exported to show the XML that is being sent to xcatd. XCATSHOWXML is exported to display the XML returned to the client. + +To get the XML request you must not be running in XCATBYPASS mode, you can get the reponse in XCATBYPASS mode. + + +PCM +getTablesAllRowAttribs + +passwd +username +
+ +rack +rackname +
+
+ diff --git a/xCAT-test/xmlapi/Table.pm.routines b/xCAT-test/xmlapi/Table.pm.routines new file mode 100644 index 000000000..83336e081 --- /dev/null +++ b/xCAT-test/xmlapi/Table.pm.routines @@ -0,0 +1,13 @@ +sub setNodeAttribs +sub addNodeAttribs +sub setAttribs +sub setAttribsWhere +sub setNodesAttribs +sub getNodesAttribs +sub getNodeAttribs +sub getAllEntries +sub getAllAttribsWhere +sub getAllNodeAttribs +sub getAllAttribs +sub delEntries +sub getAttribs diff --git a/xCAT-test/xmlapi/delEntriesreq b/xCAT-test/xmlapi/delEntriesreq new file mode 100644 index 000000000..f1d01807a --- /dev/null +++ b/xCAT-test/xmlapi/delEntriesreq @@ -0,0 +1,11 @@ + +PCM +delEntries + + nodelist + + compute1,lissa + down + +
+
diff --git a/xCAT-test/xmlapi/delEntriesreq2 b/xCAT-test/xmlapi/delEntriesreq2 new file mode 100644 index 000000000..4958726c3 --- /dev/null +++ b/xCAT-test/xmlapi/delEntriesreq2 @@ -0,0 +1,17 @@ + +PCM +delEntries + + nodelist + + compute1,lissa + down + +
+ + nodelist + + compute2 + +
+
diff --git a/xCAT-test/xmlapi/delEntriesreq3 b/xCAT-test/xmlapi/delEntriesreq3 new file mode 100644 index 000000000..373df9f7c --- /dev/null +++ b/xCAT-test/xmlapi/delEntriesreq3 @@ -0,0 +1,7 @@ + +PCM +delEntries + + nodelist +
+
diff --git a/xCAT-test/xmlapi/deltblreq b/xCAT-test/xmlapi/deltblreq new file mode 100644 index 000000000..6030b4ce4 --- /dev/null +++ b/xCAT-test/xmlapi/deltblreq @@ -0,0 +1,35 @@ + +PCM +deltbl +tablename
+key1 +value1 +noderange2 +. +. +. +or ALL +attribute1 +attribute2 +. +. +. +attributeN +
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/getAllEntries b/xCAT-test/xmlapi/getAllEntries new file mode 100644 index 000000000..30d39721c --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntries @@ -0,0 +1,37 @@ +# Reads all entries from the input Table + +PCM +getAllEntries +tablename
+
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/getAllEntries.save1 b/xCAT-test/xmlapi/getAllEntries.save1 new file mode 100644 index 000000000..30d39721c --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntries.save1 @@ -0,0 +1,37 @@ +# Reads all entries from the input Table + +PCM +getAllEntries +tablename
+
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/getAllEntriesreq b/xCAT-test/xmlapi/getAllEntriesreq new file mode 100644 index 000000000..cbb3b83ac --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntriesreq @@ -0,0 +1,5 @@ + +PCM +getAllEntries +switch
+
diff --git a/xCAT-test/xmlapi/getAllEntriesreq.save b/xCAT-test/xmlapi/getAllEntriesreq.save new file mode 100644 index 000000000..5f20af2d8 --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntriesreq.save @@ -0,0 +1,5 @@ + +PCM +getAllEntries +nodelist
+
diff --git a/xCAT-test/xmlapi/getAllEntriesreq.save1 b/xCAT-test/xmlapi/getAllEntriesreq.save1 new file mode 100644 index 000000000..5f20af2d8 --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntriesreq.save1 @@ -0,0 +1,5 @@ + +PCM +getAllEntries +nodelist
+
diff --git a/xCAT-test/xmlapi/getAttribsreq b/xCAT-test/xmlapi/getAttribsreq new file mode 100644 index 000000000..de8172e18 --- /dev/null +++ b/xCAT-test/xmlapi/getAttribsreq @@ -0,0 +1,10 @@ + +PCM +getAttribs +site
+ + domain + +value +comments +
diff --git a/xCAT-test/xmlapi/getAttribsreq.old b/xCAT-test/xmlapi/getAttribsreq.old new file mode 100644 index 000000000..bee39d797 --- /dev/null +++ b/xCAT-test/xmlapi/getAttribsreq.old @@ -0,0 +1,8 @@ + +PCM +getAttribs +site
+domain +value +comments +
diff --git a/xCAT-test/xmlapi/getAttribsreq2 b/xCAT-test/xmlapi/getAttribsreq2 new file mode 100644 index 000000000..a4029372d --- /dev/null +++ b/xCAT-test/xmlapi/getAttribsreq2 @@ -0,0 +1,11 @@ + +PCM +getAttribs +networks
+ + 11.35.0.0 + 255.255.0.0 + +netname +dhcpserver +
diff --git a/xCAT-test/xmlapi/getNodeAttribs b/xCAT-test/xmlapi/getNodeAttribs new file mode 100644 index 000000000..7eabc87d1 --- /dev/null +++ b/xCAT-test/xmlapi/getNodeAttribs @@ -0,0 +1,50 @@ +# Reads the table input for the noderange and returns list of attributes +# requested + +PCM +getNodeAttribs +tablename
+noderange +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN +
+ +nodename1 + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. +nodenameN + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + + + + + + diff --git a/xCAT-test/xmlapi/getNodeAttribs1 b/xCAT-test/xmlapi/getNodeAttribs1 new file mode 100644 index 000000000..7eabc87d1 --- /dev/null +++ b/xCAT-test/xmlapi/getNodeAttribs1 @@ -0,0 +1,50 @@ +# Reads the table input for the noderange and returns list of attributes +# requested + +PCM +getNodeAttribs +tablename
+noderange +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN +
+ +nodename1 + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. +nodenameN + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + + + + + + diff --git a/xCAT-test/xmlapi/getNodesAttribsreq b/xCAT-test/xmlapi/getNodesAttribsreq new file mode 100644 index 000000000..fcc79224c --- /dev/null +++ b/xCAT-test/xmlapi/getNodesAttribsreq @@ -0,0 +1,8 @@ + +PCM +getNodesAttribs +nodelist
+blade01-blade02 +groups +status +
diff --git a/xCAT-test/xmlapi/getNodesAttribsreq1 b/xCAT-test/xmlapi/getNodesAttribsreq1 new file mode 100644 index 000000000..a2a2dd491 --- /dev/null +++ b/xCAT-test/xmlapi/getNodesAttribsreq1 @@ -0,0 +1,7 @@ + +PCM +getNodesAttribs +nodelist
+blade01-blade02 +ALL +
diff --git a/xCAT-test/xmlapi/getNodesAttribsreq2 b/xCAT-test/xmlapi/getNodesAttribsreq2 new file mode 100644 index 000000000..a2a2dd491 --- /dev/null +++ b/xCAT-test/xmlapi/getNodesAttribsreq2 @@ -0,0 +1,7 @@ + +PCM +getNodesAttribs +nodelist
+blade01-blade02 +ALL +
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq new file mode 100644 index 000000000..ba523421c --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq @@ -0,0 +1,9 @@ + +PCM +getTablesAllNodeAttribs + +nodelist +groups +comments +
+
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 new file mode 100644 index 000000000..943cd0439 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 @@ -0,0 +1,14 @@ + +PCM +getTablesAllNodeAttribs + +nodetype +os +nodetype +
+ +nodelist +groups +status +
+
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 new file mode 100644 index 000000000..350ba547b --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 @@ -0,0 +1,13 @@ + +PCM +getTablesAllNodeAttribs + +nodetype +os +nodetype +
+ +nodelist +ALL +
+
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 new file mode 100644 index 000000000..4dece144e --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 @@ -0,0 +1,36 @@ + +PCM +getTablesAllNodeAttribs + +nodetype +ALL +
+ +nodelist +ALL +
+ +noderes +ALL +
+ +postscripts +ALL +
+ +mac +ALL +
+ +mp +ALL +
+ +nodehm +ALL +
+ +mpa +ALL +
+
diff --git a/xCAT-test/xmlapi/getTablesAllRowAttribsreq b/xCAT-test/xmlapi/getTablesAllRowAttribsreq new file mode 100644 index 000000000..cb06e9beb --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllRowAttribsreq @@ -0,0 +1,12 @@ + +PCM +getTablesAllRowAttribs + +passwd +username +
+ +rack +rackname +
+
diff --git a/xCAT-test/xmlapi/getTablesNodesAttribsreq b/xCAT-test/xmlapi/getTablesNodesAttribsreq new file mode 100644 index 000000000..c4862f5d3 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesNodesAttribsreq @@ -0,0 +1,9 @@ + +PCM +getTablesNodesAttribs +test + +nodelist +ALL +
+
diff --git a/xCAT-test/xmlapi/getTablesNodesAttribsreq1 b/xCAT-test/xmlapi/getTablesNodesAttribsreq1 new file mode 100644 index 000000000..923444bb3 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesNodesAttribsreq1 @@ -0,0 +1,13 @@ + +PCM +getTablesNodesAttribs +test + +nodelist +ALL +
+ +nodetype +nodetype +
+
diff --git a/xCAT-test/xmlapi/getTablesNodesAttribsreq2 b/xCAT-test/xmlapi/getTablesNodesAttribsreq2 new file mode 100644 index 000000000..d85e7be03 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesNodesAttribsreq2 @@ -0,0 +1,9 @@ + +PCM +getTablesNodesAttribs +test + +noderes +ALL +
+
diff --git a/xCAT-test/xmlapi/noderange b/xCAT-test/xmlapi/noderange new file mode 100644 index 000000000..91f850065 --- /dev/null +++ b/xCAT-test/xmlapi/noderange @@ -0,0 +1,14 @@ +# Reads the table input for the noderange and returns list of attributes +# requested + +PCM +NodeRange +compute1-compute2 + + +node1 +. +. +. +noden + diff --git a/xCAT-test/xmlapi/noderangereq b/xCAT-test/xmlapi/noderangereq new file mode 100644 index 000000000..2b6131df8 --- /dev/null +++ b/xCAT-test/xmlapi/noderangereq @@ -0,0 +1,5 @@ + +PCM +NodeRange +compute1-compute2 + diff --git a/xCAT-test/xmlapi/noderangereq.save b/xCAT-test/xmlapi/noderangereq.save new file mode 100644 index 000000000..2b6131df8 --- /dev/null +++ b/xCAT-test/xmlapi/noderangereq.save @@ -0,0 +1,5 @@ + +PCM +NodeRange +compute1-compute2 + diff --git a/xCAT-test/xmlapi/noderangereq.save1 b/xCAT-test/xmlapi/noderangereq.save1 new file mode 100644 index 000000000..2b6131df8 --- /dev/null +++ b/xCAT-test/xmlapi/noderangereq.save1 @@ -0,0 +1,5 @@ + +PCM +NodeRange +compute1-compute2 + diff --git a/xCAT-test/xmlapi/readtblreq b/xCAT-test/xmlapi/readtblreq new file mode 100644 index 000000000..4b9d2346f --- /dev/null +++ b/xCAT-test/xmlapi/readtblreq @@ -0,0 +1,34 @@ + +PCM +readtbl +tablename
+noderange1 +noderange2 +. +. +. +or ALL +attribute1 +attribute2 +. +. +. +attributeN +
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/readtblreq.node b/xCAT-test/xmlapi/readtblreq.node new file mode 100644 index 000000000..4b9d2346f --- /dev/null +++ b/xCAT-test/xmlapi/readtblreq.node @@ -0,0 +1,34 @@ + +PCM +readtbl +tablename
+noderange1 +noderange2 +. +. +. +or ALL +attribute1 +attribute2 +. +. +. +attributeN +
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/setAttribs b/xCAT-test/xmlapi/setAttribs new file mode 100644 index 000000000..6ce815a27 --- /dev/null +++ b/xCAT-test/xmlapi/setAttribs @@ -0,0 +1,17 @@ + +PCM +setAttribs +tablename
+ +value1 +value2 For multiple key tables + + + value1 + value2 + +
+ + + + diff --git a/xCAT-test/xmlapi/setAttribsreq b/xCAT-test/xmlapi/setAttribsreq new file mode 100644 index 000000000..739822823 --- /dev/null +++ b/xCAT-test/xmlapi/setAttribsreq @@ -0,0 +1,12 @@ + +PCM +setAttribs +site
+ + domain + + + pok.com + This is a test + +
diff --git a/xCAT-test/xmlapi/setAttribsreq1 b/xCAT-test/xmlapi/setAttribsreq1 new file mode 100644 index 000000000..4f5daeeaa --- /dev/null +++ b/xCAT-test/xmlapi/setAttribsreq1 @@ -0,0 +1,13 @@ + +PCM +setAttribs +networks
+ + 10.0.1.0 + 255.255.255.0 + + + 10.0.1.254 + +
+ diff --git a/xCAT-test/xmlapi/setAttribsreq2 b/xCAT-test/xmlapi/setAttribsreq2 new file mode 100644 index 000000000..04b0f63d3 --- /dev/null +++ b/xCAT-test/xmlapi/setAttribsreq2 @@ -0,0 +1,13 @@ + +PCM +setAttribs +networks
+ + 10.0.1.0 + 255.255.255.0 + + + mynet + 10.0.1.254 + +
diff --git a/xCAT-test/xmlapi/setNodeAttribs b/xCAT-test/xmlapi/setNodeAttribs new file mode 100644 index 000000000..45f4cbf39 --- /dev/null +++ b/xCAT-test/xmlapi/setNodeAttribs @@ -0,0 +1,19 @@ + +PCM +setNodeAttribs +tablename
+noderange +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN +
+ + + + diff --git a/xCAT-test/xmlapi/setNodesAttribsreq b/xCAT-test/xmlapi/setNodesAttribsreq new file mode 100644 index 000000000..1fa4d38f6 --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq @@ -0,0 +1,14 @@ + +PCM +setNodesAttribs +blade01-blade02 + + + nodelist + + all,compute,lissa + This is a another test + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq1 b/xCAT-test/xmlapi/setNodesAttribsreq1 new file mode 100644 index 000000000..ebaece6cc --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq1 @@ -0,0 +1,14 @@ + +PCM +setNodesAttribs1 +blade01-blade02 + + + nodelist + + all,compute,lissa,newtest + This is a another testtest + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq1.1 b/xCAT-test/xmlapi/setNodesAttribsreq1.1 new file mode 100644 index 000000000..79b45ffec --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq1.1 @@ -0,0 +1,21 @@ + +PCM +setNodesAttribs +blade01-blade02 + + + nodelist + + lissa + This is a another testx + +
+ + nodetype + + Redhat2 + This is a another testy + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq1.new b/xCAT-test/xmlapi/setNodesAttribsreq1.new new file mode 100644 index 000000000..35856d42c --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq1.new @@ -0,0 +1,14 @@ + +PCM +setNodesAttribs1 +blade01-blade02 + + + nodelist + + all,compute + This is a test + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq2 b/xCAT-test/xmlapi/setNodesAttribsreq2 new file mode 100644 index 000000000..665213e45 --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq2 @@ -0,0 +1,17 @@ + +PCM +setNodesAttribs + + ppc
+ + + fsp1 + 1 + + + cec1 + + +
+
+ diff --git a/xCAT-test/xmlapi/setNodesAttribsreq3 b/xCAT-test/xmlapi/setNodesAttribsreq3 new file mode 100644 index 000000000..e82933b40 --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq3 @@ -0,0 +1,19 @@ + +PCM +setNodesAttribs +compute2 + + + nodelist + + allxxx + +
+ + nodetype + + Redhat20 + +
+
+
diff --git a/xCAT-test/xmlapi/xmldriver b/xCAT-test/xmlapi/xmldriver new file mode 100755 index 000000000..c355b976c --- /dev/null +++ b/xCAT-test/xmlapi/xmldriver @@ -0,0 +1,40 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN +{ + $::XCATROOT = + $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} + : -d '/opt/xcat' ? '/opt/xcat' + : '/usr'; +} +use lib "$::XCATROOT/lib/perl"; +use strict; +use File::Basename; +use Cwd; +use Socket; +use XML::Simple; +require xCAT::MsgUtils; +use xCAT::Utils; +require xCAT::Client; +my $bname = basename($0); + +#----------------------------------------------------------------------------- + +=head1 pcmdriver - test XMLapi to Table.pm ( via tabutils.pm) + + +=cut + +#----------------------------------------------------------------------------- +# Main + + $ENV{'XCATXMLTRACE'}=1; +my $XML=`cat /root/lissa/xmlapi/getTablesAllRowAttribsreq`; + +my $data=$XML; + +$ENV{'XCATSHOWXML'}=1; + +xCAT::Client::submit_request($data, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; + diff --git a/xCAT-test/xmlapi/xmldriver.old b/xCAT-test/xmlapi/xmldriver.old new file mode 100755 index 000000000..581d5f400 --- /dev/null +++ b/xCAT-test/xmlapi/xmldriver.old @@ -0,0 +1,60 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN +{ + $::XCATROOT = + $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} + : -d '/opt/xcat' ? '/opt/xcat' + : '/usr'; +} +use lib "$::XCATROOT/lib/perl"; +use strict; +use File::Basename; +use Cwd; +use Socket; +use XML::Simple; +require xCAT::MsgUtils; +use xCAT::Utils; +require xCAT::Client; +my $bname = basename($0); + +#----------------------------------------------------------------------------- + +=head1 pcmdriver - test XMLapi for PCM + + +=cut + +#----------------------------------------------------------------------------- +# Main + + $ENV{'XCATXMLTRACE'}=1; +my $XML=`cat /root/lissa/PCM/api/getTablesAllRowAttribsreq`; +#my $XML=`cat /root/lissa/PCM/api/getAllEntriesreq `; +#my $XML=`cat /root/lissa/PCM/api/setNodesAttribsreq `; +#y $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq1`; +#my $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq2`; +#my $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq3`; +#my $XML=`cat /root/lissa/PCM/api/getTablesNodesAttribsreq`; +#my $XML=`cat /root/lissa/PCM/api/getTablesNodesAttribsreq2`; +#my $XML=`cat /root/lissa/PCM/api/getTablesNodesAttribsreq1`; +#my $XML=`cat /root/lissa/PCM/api/setNodesAttribsreq1.1 `; +#my $XML=`cat /root/lissa/PCM/api/getNodesAttribsreq1 `; +#y $XML=`cat /root/lissa/PCM/api/getNodesAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/getNodesAttribsreq2 `; +#my $XML=`cat /root/lissa/PCM/api/setNodesAttribsreq3 `; +#my $XML=`cat /root/lissa/PCM/api/delEntriesreq `; +#my $XML=`cat /root/lissa/PCM/api/delEntriesreq3 `; +#my $XML=`cat /root/lissa/PCM/api/getAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/getAttribsreq2 `; +#my $XML=`cat /root/lissa/PCM/api/setAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/noderangereq `; + +my $data=$XML; + +$ENV{'XCATSHOWXML'}=1; + +xCAT::Client::submit_request($data, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; + diff --git a/xCAT-test/xmlapi/xmldriver.org b/xCAT-test/xmlapi/xmldriver.org new file mode 100644 index 000000000..dbc4bbc5e --- /dev/null +++ b/xCAT-test/xmlapi/xmldriver.org @@ -0,0 +1,43 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN +{ + $::XCATROOT = + $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} + : -d '/opt/xcat' ? '/opt/xcat' + : '/usr'; +} +use lib "$::XCATROOT/lib/perl"; +use strict; +use File::Basename; +use Cwd; +use Socket; + +#use Data::Dumper; +use Getopt::Long; +require xCAT::MsgUtils; +require xCAT::DSHCLI; +use xCAT::Utils; +use xCAT::RemoteShellExp; +require xCAT::PCMClient; +my $bname = basename($0); + +#----------------------------------------------------------------------------- + +=head1 pcmdriver - test XMLapi for PCM + + +=cut + +#----------------------------------------------------------------------------- +# Main + + +my $XML=`cat /root/lissa/PCM/api/getAllEntriesreq `; +my $data=$XML; + + + +xCAT::PCMClient::submit_request($data, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; + diff --git a/xCAT-test/xmlapi/xmlrequest.org b/xCAT-test/xmlapi/xmlrequest.org new file mode 100644 index 000000000..3a1dac456 --- /dev/null +++ b/xCAT-test/xmlapi/xmlrequest.org @@ -0,0 +1,6 @@ + +cli +nodels +/svn/xcat-core/2.6/perl-xCAT/xCAT +service + diff --git a/xCAT-test/xmlapi/xmlresponse b/xCAT-test/xmlapi/xmlresponse new file mode 100644 index 000000000..da2dce15a --- /dev/null +++ b/xCAT-test/xmlapi/xmlresponse @@ -0,0 +1,9 @@ + + +rhsn + + +rhsn + + + From f39c0f46a1890dbaf80051a5402125918f7f4593 Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 22 Sep 2014 19:09:11 -0700 Subject: [PATCH 092/110] enhance for MTM based p8 hardware discovery --- perl-xCAT/xCAT/Utils.pm | 64 +++++++++++++++++ xCAT-server/lib/perl/xCAT/PPC.pm | 73 +++----------------- xCAT-server/lib/xcat/plugins/nodediscover.pm | 4 ++ 3 files changed, 79 insertions(+), 62 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index a284eb806..f8efb5dd0 100755 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -4232,4 +4232,68 @@ sub disableservice{ xCAT::Utils->runcmd($cmd, -1); return $::RUNCMD_RC; } + +sub cleanup_for_powerLE_hardware_discovery { + my $host_node = shift; + if( $host_node =~ /xCAT::Utils/) + { + $host_node=shift; + } + my $pbmc_node = shift; + my $subreq = shift; + my $ipmitab = xCAT::Table->new("ipmi"); + unless($ipmitab) { + xCAT::MsgUtils->message("S", "Discovery Error: can not open ipmi table."); + return; + } + my @nodes = ($host_node, $pbmc_node); + my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['node', 'bmc', 'username', 'password']); + if ($ipmihash) { + my $new_bmc_ip = $ipmihash->{$host_node}->[0]->{bmc}; + my $new_bmc_password = $ipmihash->{$host_node}->[0]->{password}; + + xCAT::MsgUtils->message("S", "Discovery info: configure password for pbmc_node:$pbmc_node."); + `rspconfig $pbmc_node password=$new_bmc_password`; + #if ($new_bmc_password) { + # xCAT::Utils->runxcmd( + # { + # command => ["rspconfig"], + # node => ["$pbmc_node"], + # arg => [ "password=$new_bmc_password" ], + # }, + # $subreq, 0,1); + # if ($::RUNCMD_RC != 0) { + # xCAT::MsgUtils->message("S", "Discovery Error: configure password failed for FSP."); + # return; + # } + #} + + xCAT::MsgUtils->message("S", "Discover info: configure ip:$new_bmc_ip for pbmc_node:$pbmc_node."); + `rspconfig $pbmc_node ip=$new_bmc_ip`; + #if($new_bmc_ip) { + # xCAT::Utils->runxcmd( + # { + # command => ["rspconfig"], + # node => ["$pbmc_node"], + # arg => [ "ip=$new_bmc_ip" ], + # }, + # $subreq, 0,1); + # if ($::RUNCMD_RC != 0) { + # xCAT::MsgUtils->message("S", "Discovery Error: configure IP address failed for FSP."); + # return; + # } + #} + xCAT::MsgUtils->message("S", "Discovery info: remove pbmc_node:$pbmc_node."); + `rmdef $pbmc_node`; + #xCAT::Utils->runxcmd( + # { + # command => ["rmdef"], + # node => ["$pbmc_node"], + # }, + # $subreq, 0,1); + } +} + + + 1; diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index 8699034a0..95063a76c 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -2175,76 +2175,25 @@ sub findme { } @nodes = keys (%nodes_hash); } - foreach (@nodes) { + my $nodenum = $#nodes; + if ($nodenum < 0) { + xCAT::MsgUtils->message("S", "Discovery Error: Could not find any node."); + return; + } elsif ($nodenum > 0) { + xCAT::MsgUtils->message("S", "Discovery Error: More than one node were found."); + return; + } + { my $req = {%$request}; $req->{command} = ['discovered']; - $req->{noderange} = [$_]; + $req->{noderange} = [$nodes[0]]; + $req->{pbmc_node} = [$pbmc_node]; $req->{discoverymethod} = ['mtms']; $subreq->($req); %{$req} = (); } - &cleanup_for_powerLE_hardware_discovery($nodes[-1], $pbmc_node, $subreq); } -sub cleanup_for_powerLE_hardware_discovery { - my $host_node = shift; - my $pbmc_node = shift; - my $subreq = shift; - my $ipmitab = xCAT::Table->new("ipmi"); - unless($ipmitab) { - xCAT::MsgUtils->message("S", "Discovery Error: can not open ipmi table."); - return; - } - my @nodes = ($host_node, $pbmc_node); - my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['node', 'bmc', 'username', 'password']); - if ($ipmihash) { - my $new_bmc_ip = $ipmihash->{$host_node}->[0]->{bmc}; - my $new_bmc_password = $ipmihash->{$host_node}->[0]->{password}; - - xCAT::MsgUtils->message("S", "Discover info: configure ip:$new_bmc_ip for pbmc_node:$pbmc_node."); - if($new_bmc_ip) { - xCAT::Utils->runxcmd( - { - command => ["rspconfig"], - node => ["$pbmc_node"], - arg => [ "ip=$new_bmc_ip" ], - }, - $subreq, 0,1); - if ($::RUNCMD_RC != 0) { - xCAT::MsgUtils->message("S", "Discovery Error: configure IP address failed for FSP."); - return; - } - xCAT::Utils->runxcmd( - { - command => ["chdef"], - node => ["$pbmc_node"], - arg => [ "bmc=$new_bmc_ip" ], - }, - $subreq, 0,1); - } - xCAT::MsgUtils->message("S", "Discovery info: configure password:$new_bmc_password for pbmc_node:$pbmc_node."); - if ($new_bmc_password) { - xCAT::Utils->runxcmd( - { - command => ["rspconfig"], - node => ["$pbmc_node"], - arg => [ "password=$new_bmc_password" ], - }, - $subreq, 0,1); - if ($::RUNCMD_RC != 0) { - xCAT::MsgUtils->message("S", "Discovery Error: configure password failed for FSP."); - return; - } - } - xCAT::MsgUtils->message("S", "Discovery info: remove pbmc_node:$pbmc_node."); - xCAT::Utils->runxcmd( - { - command => ["rmdef"], - node => ["$pbmc_node"], - }, - $subreq, 0,1); - } -} ########################################################################## # Process request from xCat daemon ########################################################################## diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index f5a8e88ea..d8b3c1c32 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -353,6 +353,10 @@ sub process_request { $callback->({error=> ["The node [$node] should have a correct IP address which belongs to the management network."], errorcode=>["1"]}); return; } + if (defined ($request->{pbmc_node})) { + my $pbmc_node = $request->{pbmc_node}->[0]; + xCAT::Utils->cleanup_for_powerLE_hardware_discovery($node, $pbmc_node, $doreq); + } my $restartstring = "restart"; if (scalar @forcenics > 0) { From 92d313bb20829a57737e45eda1d61d407ed143c1 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Mon, 22 Sep 2014 23:11:15 -0400 Subject: [PATCH 093/110] change ubu arch in validate_os --- xCAT-buildkit/bin/buildkit | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 53b7662c4..983f4eb79 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -1872,6 +1872,11 @@ sub validate_os my ($osbasename,$osmore) = split(/\,/, $osinfo); my ($osmajorversion,$osminorversion) = split(/\./, $osmore); my $osarch=`uname -p`; + if ($debianflag==1) { + if($osarch == "ppc64le"){ + $osarch="ppc64el"; + } + } chomp($osarch); $osinfo =~ s/\,//; my $repo_osinfo = "$repo->{osbasename}$repo->{osmajorversion}"; From 5576b8b1f41c8209b54fcfe2a201ac391406ca90 Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 22 Sep 2014 20:35:18 -0700 Subject: [PATCH 094/110] enhance for finding bootnic in genesis --- xCAT-genesis-scripts/bin/doxcat | 20 +++++++++++++++++--- xCAT-server/lib/xcat/plugins/nodediscover.pm | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 2820e48be..7d6203531 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -146,10 +146,24 @@ if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then else echo "Setting IP via DHCP..." # This section is for System P hardware discovery, which won't have a BOOTIF value set + tries=0 + while [ $tries -lt 5 ]; do + if [ -z "$bootnic" ]; then + ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo` + for tmp1 in $ALLUP_NICS; do + bootnic=$tmp1 + break + done + else + break + fi + sleep 2 + tries=$(($tries+1)) + done if [ -z "$bootnic" ]; then - ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo` - for tmp1 in $ALLUP_NICS; do - bootnic=$tmp1 + ALL_NICS=`ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo` + for tmp in $ALL_NICS; do + bootnic=$tmp break done fi diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index d8b3c1c32..4dd348e36 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -353,7 +353,7 @@ sub process_request { $callback->({error=> ["The node [$node] should have a correct IP address which belongs to the management network."], errorcode=>["1"]}); return; } - if (defined ($request->{pbmc_node})) { + if (defined ($request->{pbmc_node}) and defined($request->{pbmc_node}->[0]) ) { my $pbmc_node = $request->{pbmc_node}->[0]; xCAT::Utils->cleanup_for_powerLE_hardware_discovery($node, $pbmc_node, $doreq); } From 7edce8ec57889c02da97b7b0310df6cf6119f752 Mon Sep 17 00:00:00 2001 From: huweihua Date: Tue, 23 Sep 2014 04:36:31 -0400 Subject: [PATCH 095/110] add pkglist for sysclone on sles 11 and p system --- .../xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist | 1 + 1 file changed, 1 insertion(+) create mode 100644 xCAT-server/share/xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist diff --git a/xCAT-server/share/xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist new file mode 100644 index 000000000..691b8e05a --- /dev/null +++ b/xCAT-server/share/xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/sles11/ppc64/systemimager-client From 0fa2dbd486798809958d96c7b46b12bb77b8489b Mon Sep 17 00:00:00 2001 From: huweihua Date: Tue, 23 Sep 2014 04:38:37 -0400 Subject: [PATCH 096/110] add otherpkgs.pkglist for sysclone on rh6+p, rh7+x, rh7+p --- .../xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist | 1 + .../xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist | 1 + .../xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist | 1 + 3 files changed, 3 insertions(+) create mode 100644 xCAT-server/share/xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist create mode 100644 xCAT-server/share/xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist create mode 100644 xCAT-server/share/xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist new file mode 100644 index 000000000..6d3bbd5dd --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh6/ppc64/systemimager-client diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist new file mode 100644 index 000000000..a10301209 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh7/ppc64/systemimager-client diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist new file mode 100644 index 000000000..5b8feb497 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh7/x86_64/systemimager-client From fc8b2cc4eb16093aef07722919cffe24f753b7cc Mon Sep 17 00:00:00 2001 From: baiyuan Date: Tue, 23 Sep 2014 06:39:08 -0400 Subject: [PATCH 097/110] prep deb support in buildrepo --- xCAT-buildkit/bin/buildkit | 132 ++++++++++++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 3 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 983f4eb79..68ca2384d 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -776,6 +776,7 @@ sub kit_buildrepo1 return 1; } } + # if ( system("dpkg-scanpackages $repodir > $repodir/Packages") ) { if ( system("cd $repodir;dpkg-scanpackages . > Packages") ) { print "Error building the repository meta-data with the dpkg-scanpackages command \n"; return 1; @@ -1872,12 +1873,13 @@ sub validate_os my ($osbasename,$osmore) = split(/\,/, $osinfo); my ($osmajorversion,$osminorversion) = split(/\./, $osmore); my $osarch=`uname -p`; + chomp($osarch); + if ($debianflag==1) { if($osarch == "ppc64le"){ $osarch="ppc64el"; } } - chomp($osarch); $osinfo =~ s/\,//; my $repo_osinfo = "$repo->{osbasename}$repo->{osmajorversion}"; if (defined($repo->{osminorversion})){ @@ -2420,14 +2422,45 @@ sub build_kitcomp_debian{ } } + #run the dpkg-buildpackage command my $curdir = $::workdir; my $cmd = "rm -Rf $debbuilddir"; system($cmd); mkpath($debbuilddir); - #Create debian directory for this kit component - if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; } + $::VALID_PRER_COMPONENT = 0; + + if ( !$::PREREQUISITE ) { + if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall} ) { + + #Create debian directory for this kit component + + if ( &gen_kitcomp_debdir_prep($comp,\%repo) ) { return 1; } + $::VALID_PRER_COMPONENT = 1; + # build prep deb + my $prep_compversion = $comp->{version} . "-" . $comp->{release}; + my $prep_buildstring = "Prep Kit component build package."; + my $prep_debbuilddir = $::workdir."/debbuild/"."prep-".$comp->{kitcompname}; + my $prep_debianbuildcmd = "cd $prep_debbuilddir;dch -v $prep_compversion -b -c debian/changelog $prep_buildstring;dpkg-buildpackage -uc -us"; + + if ( system($prep_debianbuildcmd) ) { + print "Error running \"dpkg-buildpackage -uc -us\" command for kit component prep-$comp->{kitcompname} meta package\n"; + return 1; + } + } + #Create debian directory for this kit component + + if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; } + + } else { + #Create debian directory for this kit component + + if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; } + + } + + if (defined($comp->{non_native_pkgs}) ) { my $sourcedir = $::workdir."/source_packages"; @@ -2469,6 +2502,99 @@ sub build_kitcomp_debian{ return 0; } + +#----------------------------------------------------------------------------- + +=head3 gen_kitcomp_debdir_prep + + + +=cut + +#----------------------------------------------------------------------------- +sub gen_kitcomp_debdir_prep{ + my $comp = shift; + my $repo = shift; + my $scriptdir = $::workdir."/scripts/"; + my $combuilddir = $::workdir."/debbuild/"."prep-".$comp->{kitcompname}; + + #copy the debian dir template to the build path + mkpath("$combuilddir/debian"); + my $cmd = "cp -Rf " . $::XCATSHARE . "/kits/debian_template/* $combuilddir/debian/"; + system($cmd); + + my $kitname = $::bldkit_config->{kit}{entries}[0]->{basename}; + my $kitcompname = "prep-".$comp->{kitcompname}; + my $upgradeflag = "pre-".$comp->{basename} . ".tmp"; + + my ($prescript,$postscript,$preupscript,$postupscript,$preunscript,$postunscript,$nonnativepkgs) = ''; + if (defined($comp->{preinstall})) { + $prescript = &load_script("$scriptdir$comp->{preinstall}"); + } + if (defined($comp->{preupgrade})) { + $preupscript = &load_script("$scriptdir$comp->{preupgrade}"); + } + if (defined($comp->{preuninstall})) { + $preunscript = &load_script("$scriptdir$comp->{preuninstall}"); + } + + #replace all special sub string in all files under debian + unless (opendir(DH, "${combuilddir}/debian/")){ + print "Can not open the xCAT Kit Component debian dir: ${combuilddir}/debian/"; + return 1; + } + + foreach (readdir(DH)){ + my $file = "${combuilddir}/debian/$_"; + if ( -d $file){ + next; + } + + unless ( open ( FH, "<", $file )){ + print "Error attempting to open the xCAT Kit Component ${kitcompname}'s debian template file $file.\n"; + close(DH); + return 1; + } + + if ($::VERBOSE){ + print "Reading the xCAT Kit Component ${kitcompname}'s debian template file $file. \n"; + } + my @lines = ; + close(FH); + my $prep_comp_name="prep-".$comp->{basename}; + for(@lines) { + chomp; + s/<<>>/$prep_comp_name/; + s/<<>>/$comp->{ospkgdeps}/; + s/<<>>/$comp->{kitpkgdeps}/; + s/<<>>/$comp->{kitcompdeps}/; + s/<<>>/$comp->{description}/; + s/<<>>/$upgradeflag/; + s/<<>>/$prescript/; + s/<<>>/$postscript/; + s/<<>>/$preupscript/; + s/<<>>/$postupscript/; + s/<<>>/$preunscript/; + s/<<>>/$postunscript/; + + } + my $joined_lines = join("\n", @lines); + @lines = split(/\\n/,$joined_lines); + + open (FH, ">", $file); + if ($::VERBOSE){ + print "Created kitcomponent ${kitcompname}'s build file under debian dir $file"; + } + print FH @lines; + close(FH); + } + closedir(DH); + + return 0; +} + + + #----------------------------------------------------------------------------- =head3 gen_kitcomp_debdir From 4100dd77e4158be3a1ae63429572fb0317e8c7e4 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 23 Sep 2014 10:44:56 -0400 Subject: [PATCH 098/110] Add capability for plugins to supply a description in update_tables_with_templates --- xCAT-server/lib/perl/xCAT/SvrUtils.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm index 40dc6f33a..e2bef10eb 100755 --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -713,6 +713,9 @@ sub update_tables_with_templates osarch=>$arch, synclists=>$synclistfile, osdistroname=>$osdistroname); + if ($args{description}) { + $tb_cols{description} = $args{description}; + } $osimagetab->setAttribs(\%key_col, \%tb_cols); if ($osname =~ /^win/) { From ec61ef27da6d3dcf6fa50dfeb019d13b21d40948 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Tue, 23 Sep 2014 22:47:52 -0400 Subject: [PATCH 099/110] add metadeb and all support --- xCAT-buildkit/bin/buildkit | 94 +++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 38 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 68ca2384d..ff1a456dd 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -764,20 +764,20 @@ sub kit_buildrepo1 } } - # Build kitcomponent metapackages + # Build kitcomponent preppackages and metapackages if ( $debianflag ){ foreach my $kc (@{$::bldkit_config->{kitcomponent}{entries}}) { if ($repoid ne $kc->{kitrepoid}) { next; } my $debname = "$repodir/".&comppkgname($kc); if (-r $debname) { next; } - if ($::VERBOSE) { print "building kitcomponent metapackage for $kc->{basename} \n";} + if ($::VERBOSE) { print "building kitcomponent package for $kc->{basename} \n";} if (&build_kitcomp_debian($kc)) { print "Error building kitcomponent metapackage for $kc->{basename} \n"; return 1; } } - # if ( system("dpkg-scanpackages $repodir > $repodir/Packages") ) { - if ( system("cd $repodir;dpkg-scanpackages . > Packages") ) { + + if ( system("cd $repodir;dpkg-scanpackages . > Packages") ) { print "Error building the repository meta-data with the dpkg-scanpackages command \n"; return 1; } @@ -2429,15 +2429,15 @@ sub build_kitcomp_debian{ system($cmd); mkpath($debbuilddir); - $::VALID_PRER_COMPONENT = 0; + $::VALID_PREP_COMPONENT = 0; if ( !$::PREREQUISITE ) { if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall} ) { - #Create debian directory for this kit component + #Create debian directory for this kit component preppackage if ( &gen_kitcomp_debdir_prep($comp,\%repo) ) { return 1; } - $::VALID_PRER_COMPONENT = 1; + $::VALID_PREP_COMPONENT = 1; # build prep deb my $prep_compversion = $comp->{version} . "-" . $comp->{release}; my $prep_buildstring = "Prep Kit component build package."; @@ -2449,14 +2449,14 @@ sub build_kitcomp_debian{ return 1; } } - #Create debian directory for this kit component + #Create debian directory for this kit component metapackage - if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; } + if ( &gen_kitcomp_debdir($comp,\%repo,'METADEB') ) { return 1; } } else { #Create debian directory for this kit component - if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; } + if ( &gen_kitcomp_debdir($comp,\%repo,'ALL') ) { return 1; } } @@ -2566,16 +2566,16 @@ sub gen_kitcomp_debdir_prep{ chomp; s/<<>>/$prep_comp_name/; s/<<>>/$comp->{ospkgdeps}/; - s/<<>>/$comp->{kitpkgdeps}/; - s/<<>>/$comp->{kitcompdeps}/; + s/<<>>//; + s/<<>>//; s/<<>>/$comp->{description}/; s/<<>>/$upgradeflag/; s/<<>>/$prescript/; - s/<<>>/$postscript/; + s/<<>>//; s/<<>>/$preupscript/; - s/<<>>/$postupscript/; + s/<<>>//; s/<<>>/$preunscript/; - s/<<>>/$postunscript/; + s/<<>>//; } my $joined_lines = join("\n", @lines); @@ -2607,6 +2607,7 @@ sub gen_kitcomp_debdir_prep{ sub gen_kitcomp_debdir{ my $comp = shift; my $repo = shift; + my $level = shift; my $scriptdir = $::workdir."/scripts/"; my $combuilddir = $::workdir."/debbuild/".$comp->{kitcompname}; @@ -2620,29 +2621,38 @@ sub gen_kitcomp_debdir{ my $upgradeflag = $comp->{basename} . ".tmp"; my ($prescript,$postscript,$preupscript,$postupscript,$preunscript,$postunscript,$nonnativepkgs) = ''; - if (defined($comp->{preinstall})) { - $prescript = &load_script("$scriptdir$comp->{preinstall}"); - } - if (defined($comp->{postinstall})) { - $postscript = &load_script("$scriptdir$comp->{postinstall}"); - } - if (defined($comp->{preupgrade})) { - $preupscript = &load_script("$scriptdir$comp->{preupgrade}"); - } - if (defined($comp->{postupgrade})) { - $postupscript = &load_script("$scriptdir$comp->{postupgrade}"); - } - if (defined($comp->{preuninstall})) { - $preunscript = &load_script("$scriptdir$comp->{preuninstall}"); - } - if (defined($comp->{postuninstall})) { - $postunscript = &load_script("$scriptdir$comp->{postuninstall}"); - } - if (defined($comp->{non_native_pkgs})) { - $nonnativepkgs = "\n"; - $nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; - $nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; + + if ($level eq 'METADEB' || $level eq 'ALL') + { + if (defined($comp->{postinstall})) { + $postscript = &load_script("$scriptdir$comp->{postinstall}"); + } + + if (defined($comp->{postupgrade})) { + $postupscript = &load_script("$scriptdir$comp->{postupgrade}"); + } + if (defined($comp->{postuninstall})) { + $postunscript = &load_script("$scriptdir$comp->{postuninstall}"); + } + if (defined($comp->{non_native_pkgs})) { + $nonnativepkgs = "\n"; + $nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; + $nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; + } } + if ($level eq 'ALL') + { + if (defined($comp->{preinstall})) { + $prescript = &load_script("$scriptdir$comp->{preinstall}"); + } + if (defined($comp->{preupgrade})) { + $preupscript = &load_script("$scriptdir$comp->{preupgrade}"); + } + if (defined($comp->{preuninstall})) { + $preunscript = &load_script("$scriptdir$comp->{preuninstall}"); + } + } + #replace all special sub string in all files under debian unless (opendir(DH, "${combuilddir}/debian/")){ @@ -2667,12 +2677,20 @@ sub gen_kitcomp_debdir{ } my @lines = ; close(FH); + my $prepcomp="prep-".$comp->{basename}; for(@lines) { chomp; s/<<>>/$comp->{basename}/; s/<<>>/$comp->{ospkgdeps}/; s/<<>>/$comp->{kitpkgdeps}/; - s/<<>>/$comp->{kitcompdeps}/; + if ( $::VALID_PREP_COMPONENT ) { + s/<<>>/$comp->{kitcompdeps},$prepcomp/; + } + else + { + s/<<>>/$comp->{kitcompdeps}/; + } + s/<<>>/$comp->{description}/; s/<<>>/$upgradeflag/; s/<<>>/$prescript/; From ac34247aba1ffb6fc1a0d858ac87898b77a6b2f8 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 24 Sep 2014 03:14:32 -0400 Subject: [PATCH 100/110] defect 4726: cold reset bmc for specific firmware in the end of bmcsetup to make bmc take effect. --- xCAT-genesis-scripts/bin/bmcsetup | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xCAT-genesis-scripts/bin/bmcsetup b/xCAT-genesis-scripts/bin/bmcsetup index 195c32159..d0590abc8 100755 --- a/xCAT-genesis-scripts/bin/bmcsetup +++ b/xCAT-genesis-scripts/bin/bmcsetup @@ -387,6 +387,21 @@ if [ ! "$IPMIVER" == "1.5" ]; then if [ $TRIES -gt $TIMEOUT ]; then echo "ERROR"; else echo "OK"; fi fi +# Reset the BMC for the x3755 M4 (8722), otherwise the BMC will not be pingable after running of bmcsetup +XPROD=`ipmitool mc info|grep "^Product ID"|awk '{print $4}'` +if [ "$XPROD" = "309" ] ; then + echo "Resetting BMC ..." + ipmitool mc reset cold + echo "Waiting for the BMC to appear ..." + sleep 15 + TRIES=0 + while ! ipmitool lan print $LANCHAN > /dev/null; do + sleep 3 + let TRIES=TRIES+1 + if [ $TRIES -gt $TIMEOUT ]; then break; fi + done +fi + # update the node status to 'bmcready' for parm in `cat /proc/cmdline`; do key=`echo $parm|awk -F= '{print $1}'` From d8eeeb306b7a4d5f8a71b8bc0019376efbd3c4de Mon Sep 17 00:00:00 2001 From: baiyuan Date: Wed, 24 Sep 2014 04:19:33 -0400 Subject: [PATCH 101/110] fix dpkg compare version op --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index a410e1b6d..551950c7f 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -291,7 +291,7 @@ sub find_latest_pkg_deb if ($latestmatch) { # then we need to figure out which is the newest # if the $fdeb is newer than use it - if ( xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, ">", $founddeb{$r}{$latestmatch}{version}) ) { + if ( xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, "gt", $founddeb{$r}{$latestmatch}{version}) ) { $latestmatch = $fdeb; } From ee1a1574c361ce85b30c04b118c12fe611607bf9 Mon Sep 17 00:00:00 2001 From: mellor Date: Wed, 24 Sep 2014 02:38:54 -0700 Subject: [PATCH 102/110] generate default netboot configure file for p8 hardware discovery --- xCAT-server/lib/xcat/plugins/dhcp.pm | 3 +++ xCAT-server/lib/xcat/plugins/mknb.pm | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index e86bb20d3..1a427824d 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -2416,6 +2416,9 @@ sub addnet push @netent, " } else if option client-architecture = 00:02 { #ia64\n "; push @netent, " filename \"elilo.efi\";\n"; + push @netent, + " } else if option client-architecture = 00:0e { #OPAL-v3\n "; + push @netent, " option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/default\";\n"; push @netent, " } else if substring(filename,0,1) = null { #otherwise, provide yaboot if the client isn't specific\n "; push @netent, " filename \"/yaboot\";\n"; diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index bdb2bcd17..381b95af0 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -117,6 +117,7 @@ sub process_request { system("ssh-keygen -t rsa -f $tempdir/etc/ssh_host_rsa_key -C '' -N ''"); system("ssh-keygen -t dsa -f $tempdir/etc/ssh_host_dsa_key -C '' -N ''"); } + my $initrd_file = undef; my $lzma_exit_value=1; if ($invisibletouch) { my $done=0; @@ -129,18 +130,25 @@ sub process_request { unlink ("$tftpdir/xcat/genesis.fs.$arch.lzma"); } else { $done = 1; + $initrd_file = "$tftpdir/xcat/genesis.fs.$arch.lzma"; } } if (not $done) { $callback->({data=>["Creating genesis.fs.$arch.gz in $tftpdir/xcat"]}); system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/genesis.fs.$arch.gz"); + $initrd_file = "$tftpdir/xcat/genesis.fs.$arch.gz"; } } else { $callback->({data=>["Creating nbfs.$arch.gz in $tftpdir/xcat"]}); system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/nbfs.$arch.gz"); + $initrd_file = "$tftpdir/xcat/nbfs.$arch.gz"; } system ("rm -rf $tempdir"); + unless ($initrd_file) { + $callback->({data=>["Creating filesystem file in $tftpdir/xcat failed"]}); + return; + } my $hexnets = xCAT::NetworkUtils->my_hexnets(); my $normnets = xCAT::NetworkUtils->my_nets(); my $consolecmdline; @@ -170,7 +178,7 @@ sub process_request { chmod(0644,"$tftpdir/pxelinux.0"); } } elsif ($arch =~ /ppc/) { - mkpath("$tftpdir/etc"); + mkpath("$tftpdir/pxelinux.cfg/p/"); } my $dopxe=0; foreach (keys %{$normnets}) { @@ -262,11 +270,11 @@ sub process_request { close($cfgfile); } elsif ($arch =~ /ppc/) { open($cfgfile,">","$tftpdir/etc/".lc($_)); - print $cfgfile "timeout=5\n"; - print $cfgfile " label=xcat\n"; - print $cfgfile " image=xcat/nbk.$arch\n"; - print $cfgfile " initrd=xcat/nbfs.$arch.gz\n"; - print $cfgfile ' append="quiet xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\"\n"; + print $cfgfile "default xCAT\n"; + print $cfgfile " label xCAT\n"; + print $cfgfile " kernel http://".$hexnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n"; + print $cfgfile " initrd http://".$hexnets->{$_}.":80/$initrd_file\n"; + print $cfgfile ' append "quiet xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\"\n"; close($cfgfile); } } From 08e0ce42f0fc8a83db2e1b6d03b33abd4e67af25 Mon Sep 17 00:00:00 2001 From: mellor Date: Wed, 24 Sep 2014 02:41:55 -0700 Subject: [PATCH 103/110] correct the default configuration file for p8 hardware discovery --- xCAT-server/lib/xcat/plugins/mknb.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 381b95af0..a8874cf67 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -269,7 +269,7 @@ sub process_request { print $cfgfile " APPEND initrd=xcat/nbfs.$arch.gz quiet xcatd=".$hexnets->{$_}.":$xcatdport $consolecmdline\n"; close($cfgfile); } elsif ($arch =~ /ppc/) { - open($cfgfile,">","$tftpdir/etc/".lc($_)); + open($cfgfile,">", "$tftpdir/pxelinux.cfg/p/default"); print $cfgfile "default xCAT\n"; print $cfgfile " label xCAT\n"; print $cfgfile " kernel http://".$hexnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n"; From d29aea3c017a10caaf5c27f62ad94e09599bd198 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Wed, 24 Sep 2014 06:46:59 -0400 Subject: [PATCH 104/110] add get_latest_version_deb --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 90 +++++++++++++++++++- 1 file changed, 87 insertions(+), 3 deletions(-) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index 551950c7f..cf2254abd 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -134,6 +134,87 @@ sub get_latest_version } } +#-------------------------------------------------------------------------- +=head3 get_latest_version_deb + + Find the latest version in a list of debs with the same basename + + Arguments: + - the repo location + - a list of debs with the same basename + Returns: + - name of deb + - undef + Example: + my $new_d = xCAT::BuildKitUtils->get_latest_version($repodir, \@rpmlist); + Comments: + +=cut +#-------------------------------------------------------------------------- +sub get_latest_version_deb +{ + my ($class, $repodir, $debs) = @_; + + my @deblist = @$debs; + + my %localversions_hash = (); + my $file_name; + my %founddeb; + my $latest; + my $i = 0; + foreach my $deb (@deblist) + { + + # include path + my $fulldebpath = "$repodir/$deb*"; + chomp $deb; + # get the basename, version, and release for this deb + print "dpkg -I $repodir/$deb |grep Package|awk '{print \$2}'"; + my $basenamedeb = `dpkg -I $repodir/$deb |grep Package|awk '{print \$2}'`; + chomp $basenamedeb; + + my $versiondeb = `dpkg -I $repodir/$deb |grep Version|awk '{print \$2}'`; + chomp $versiondeb; + + $founddeb{$basenamedeb}{$deb}{version}=$versiondeb; + + $i++; + } + if ($i == 0) + { + print "error\n"; + return undef; + } + + + foreach my $r (keys %founddeb ) { + # if more than one with same basename then find the latest + my $latestmatch=""; + foreach my $fdeb (keys %{$founddeb{$r}} ) { + # if we already found a match in some other dir + if ($latestmatch) { + # then we need to figure out which is the newest + # if the $fdeb is newer than use iti + if ( ! xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, 'gt', $founddeb{$r}{$latestmatch}{version}) ) { + $latestmatch = $fdeb; + } + + } else { + $latestmatch = $fdeb; + } + } + $latest=$latestmatch; + + } + if ($i == 0) + { + print "Error: Could not determine the latest version for the following list of debs: @deblist\n"; + return undef; + } else { + return ($latest); + } +} + #-------------------------------------------------------------------------- =head3 find_latest_pkg @@ -235,6 +316,7 @@ sub find_latest_pkg - the name of the deb Returns: - \@founddeblist + - undef Example: my $newrpm = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirs, $debname); @@ -275,7 +357,7 @@ sub find_latest_pkg_deb chomp $basename; my $version = `dpkg -I $r* |grep Version|awk '{print \$2}'`; - print "$basename:$version"; + chomp $version; $founddeb{$basename}{$r}{version}=$version; } @@ -291,7 +373,7 @@ sub find_latest_pkg_deb if ($latestmatch) { # then we need to figure out which is the newest # if the $fdeb is newer than use it - if ( xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, "gt", $founddeb{$r}{$latestmatch}{version}) ) { + if ( ! xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, 'gt', $founddeb{$r}{$latestmatch}{version}) ) { $latestmatch = $fdeb; } @@ -335,7 +417,9 @@ sub find_latest_pkg_deb sub testVersion_deb { my ($class, $version1, $operator, $version2) = @_; - + if ($::VERBOSE) { + print "dpkg --compare-versions $version1 $operator $version2 \n"; + } my $result =`dpkg --compare-versions $version1 $operator $version2`; return $result; From b0eff0cf94eb64c54eec60ba1785a3fdc19871a7 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 24 Sep 2014 07:12:23 -0400 Subject: [PATCH 105/110] fix build of http://xcat.sourceforge.net/man5/xcatdb.5.html --- perl-xCAT/db2man | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/db2man b/perl-xCAT/db2man index f05cfb5b5..43190a9d6 100755 --- a/perl-xCAT/db2man +++ b/perl-xCAT/db2man @@ -266,7 +266,7 @@ See http://www.perl.com/doc/manual/html/pod/perlre.html for information on perl As of xCAT 2.8.1, you can use a modified version of the regular expression support described in the previous section. You do not need to enter the node information (1st part of the expression), it will be derived from the input nodename. You only need to supply the 2nd part of the expression to determine the value to give the attribute. For examples, see -https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Listing_and_Modifying_the_Database#Easy_Regular_expressions +https://sourceforge.net/p/xcat/wiki/Listing_and_Modifying_the_Database/#easy-regular-expressions =head1 OBJECT DEFINITIONS From 7ae2e3d8f38883d62b26c82328d3ccb82c415a68 Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 24 Sep 2014 22:58:51 -0400 Subject: [PATCH 106/110] change the xCAT-genesis-base version from 2.8 to 2.9 --- xCAT-genesis-builder/xCAT-genesis-base.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index c4e537d96..64dafcb51 100755 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -1,4 +1,4 @@ -%define version 2.8 +%define version 2.9 %ifarch i386 i586 i686 x86 %define tarch x86 %endif From b06aa3afb06842e1e9a36d51931a110102e15949 Mon Sep 17 00:00:00 2001 From: mellor Date: Wed, 24 Sep 2014 20:23:20 -0700 Subject: [PATCH 107/110] enhance of creating default netboot configuration file for p8 hardware discovery --- xCAT-server/lib/xcat/plugins/dhcp.pm | 2 +- xCAT-server/lib/xcat/plugins/mknb.pm | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 1a427824d..a4e2f64b8 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -2418,7 +2418,7 @@ sub addnet push @netent, " filename \"elilo.efi\";\n"; push @netent, " } else if option client-architecture = 00:0e { #OPAL-v3\n "; - push @netent, " option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/default\";\n"; + push @netent, " option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/".$net."_".$maskbits."\";\n"; push @netent, " } else if substring(filename,0,1) = null { #otherwise, provide yaboot if the client isn't specific\n "; push @netent, " filename \"/yaboot\";\n"; diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index a8874cf67..f9c3316ba 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -239,6 +239,14 @@ sub process_request { close($cfg); } + } elsif ($arch =~ /ppc/) { + open($cfgfile,">", "$tftpdir/pxelinux.cfg/p/$net"); + print $cfgfile "default xCAT\n"; + print $cfgfile " label xCAT\n"; + print $cfgfile " kernel http://".$normnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n"; + print $cfgfile " initrd http://".$normnets->{$_}.":80/$initrd_file\n"; + print $cfgfile ' append "quiet xcatd='.$normnets->{$_}.":$xcatdport $consolecmdline\"\n"; + close($cfgfile); } } $dopxe=0; @@ -269,7 +277,7 @@ sub process_request { print $cfgfile " APPEND initrd=xcat/nbfs.$arch.gz quiet xcatd=".$hexnets->{$_}.":$xcatdport $consolecmdline\n"; close($cfgfile); } elsif ($arch =~ /ppc/) { - open($cfgfile,">", "$tftpdir/pxelinux.cfg/p/default"); + open($cfgfile,">","$tftpdir/etc/".lc($_)); print $cfgfile "default xCAT\n"; print $cfgfile " label xCAT\n"; print $cfgfile " kernel http://".$hexnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n"; From 641d9bd78ac152972f1ae1b3cd3c0740827ca6d7 Mon Sep 17 00:00:00 2001 From: huweihua Date: Thu, 25 Sep 2014 02:10:42 -0400 Subject: [PATCH 108/110] add otherpkgs.pkglist file for rh5 + system x --- .../xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist | 1 + 1 file changed, 1 insertion(+) create mode 100644 xCAT-server/share/xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist new file mode 100644 index 000000000..51cbbf9d0 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh5/x86_64/systemimager-client From 0541a3361abd3a181dd0221016d2aee97651cb6f Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 25 Sep 2014 02:17:35 -0400 Subject: [PATCH 109/110] add Requires: xCAT-genesis-scripts-ppc64 in xCAT.spec for ppc64 arch --- xCAT/xCAT.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index 893f04996..713d273bc 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -63,6 +63,9 @@ Requires: syslinux xCAT-genesis-scripts-x86_64 elilo-xcat Requires: ipmitool-xcat >= 1.8.9 Requires: xnba-undi %endif +%ifarch ppc ppc64 +Requires: xCAT-genesis-scripts-ppc64 +%endif %if %notpcm %ifarch i386 i586 i686 x86 x86_64 From 6aabbe5ae23b26d08aa2a2a9e00238aa765dd79b Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 25 Sep 2014 02:22:46 -0400 Subject: [PATCH 110/110] build xCAT-genesis-scripts for ppc64 --- buildcore.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildcore.sh b/buildcore.sh index 3517040e2..41866121e 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -265,6 +265,8 @@ if [ "$OSNAME" != "AIX" ]; then ORIGFAILEDRPMS="$FAILEDRPMS" ./makerpm xCAT-genesis-scripts x86_64 "$EMBED" if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-genesis-scripts-x86_64"; fi + ./makerpm xCAT-genesis-scripts ppc64 "$EMBED" + if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-genesis-scripts-ppc64"; fi if [ "$FAILEDRPMS" = "$ORIGFAILEDRPMS" ]; then # all succeeded rm -f $DESTDIR/xCAT-genesis-scripts*rpm rm -f $SRCDIR/xCAT-genesis-scripts*rpm