From 7c804caa9e5220dbfda69066141727d7ad23cda0 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 16 Mar 2015 00:54:56 -0400 Subject: [PATCH 01/14] defect 4598: hardeths script will do nothing if the interface has not IP and mac address --- xCAT/postscripts/hardeths | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/hardeths b/xCAT/postscripts/hardeths index 43ec7c84e..be1411ede 100755 --- a/xCAT/postscripts/hardeths +++ b/xCAT/postscripts/hardeths @@ -75,6 +75,7 @@ fi for nic in `ip link |grep "BROADCAST" |awk '{print $2}' | sed s/://`; do IPADDRMASK=`ip addr show dev $nic | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1` IPADDR=`echo $IPADDRMASK | awk -F'/' '{print $1}'` + [ -z $IPADDR ] && continue PREFIXMASK=`echo $IPADDRMASK | awk -F'/' '{print $2}'` # converts to x.x.x.x mask value maskfromprefix $PREFIXMASK @@ -108,7 +109,8 @@ EOF NICFILE=${NICFILEPRE}${nic} else #mac=`ifconfig $nic|grep HWaddr|awk '{print $5}'|tr "[A-Z]" "[a-z]"` - mac=`ip link show $nic | grep ether | awk '{print $2}'` + mac=`ip link show $nic | grep "ether\|infiniband" | awk '{print $2}'` + [ -z $mac ] && continue NICFILE=${NICFILEPRE}eth-id-${mac} fi sed -i s/BOOTPROTO=dhcp/BOOTPROTO=static/ $NICFILE From 8e0a2fe479f5efa1d0b1e452b2413084a3916af9 Mon Sep 17 00:00:00 2001 From: Lei Ai Date: Mon, 16 Mar 2015 13:57:58 +0800 Subject: [PATCH 02/14] 4590:update genesis rpm builder for compatible with MCP package --- xCAT-genesis-builder/buildrpm | 109 +++++++++++++++++++++------------- 1 file changed, 69 insertions(+), 40 deletions(-) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index 3627d7aa9..049001bc6 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -8,6 +8,7 @@ HOSTOS="$1" DIR=`dirname $0` #DIR=`realpath $DIR` DIR=`readlink -f $DIR` +BUILDARCH=`uname -m` # get the input files for dracut in the right place # Fedora 20 ppc64 uses /usr/lib/dracut/modules.d @@ -21,9 +22,64 @@ fi mkdir -p $DRACUTMODDIR cp $DIR/* $DRACUTMODDIR + +if [ "$HOSTOS" = "mcp" ]; then + #Special handlings for MCP PPC64 platform building. + if [ $BUILDARCH = "ppc64" ]; then + sed -i 's/dracut_install efibootmgr//' $DRACUTMODDIR/install + sed -i 's/dracut_install dmidecode \/usr\/lib64\/libstdc++.so.5//' $DRACUTMODDIR/install + sed -i 's/dmidecode//' $DRACUTMODDIR/install + sed -i 's/\/lib\/ld-linux.so.2/\/usr\/lib64\/ld-2.17.so/' $DRACUTMODDIR/install + else + sed -i 's/\/lib\/ld-linux.so.2/\/usr\/lib64\/ld-linux-x86-64.so.2/' $DRACUTMODDIR/install + fi + sed -i 's/mkfs.btrfs//' $DRACUTMODDIR/install + sed -i 's/\/etc\/redhat-release/\/etc\/base-release \/etc\/system-release/' $DRACUTMODDIR/install + sed -i 's/btrfs//' $DRACUTMODDIR/installkernel + + sed -i 's/\/usr\/bin\/basename/\/bin\/basename/' $DRACUTMODDIR/install + + sed -i 's/\/lib64\/libnss_dns-2.12.so/\/usr\/lib64\/libnss_dns-2.17.so/' $DRACUTMODDIR/install + sed -i 's/\/lib64\/libnss_dns.so.2/\/usr\/lib64\/libnss_dns.so.2/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libc.so.6/\/usr\/lib64\/libc.so.6/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libdl.so.2/\/usr\/lib64\/libdl.so.2/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libm.so.6/\/usr\/lib64\/libm.so.6/' $DRACUTMODDIR/install + sed -i 's/\/usr\/lib\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.19/' $DRACUTMODDIR/install + sed -i 's/\/usr\/lib64\/libstdc++.so.5//' $DRACUTMODDIR/install + sed -i 's/\/lib\/libpthread.so.0/\/usr\/lib64\/libpthread.so.0/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libncurses.so.5.7/\/usr\/lib64\/libncurses.so.5.9/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libgcc_s.so.1/\/usr\/lib64\/libgcc_s.so.1/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libtinfo.so.5.7/\/usr\/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/\/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 + + # these are needed for sysclone, but are not yet in mcp + sed -i 's/ bc//' $DRACUTMODDIR/install + sed -i 's/ mkdosfs//' $DRACUTMODDIR/install + sed -i 's/ rsync//' $DRACUTMODDIR/install + sed -i 's/ kexec//' $DRACUTMODDIR/install + sed -i 's/ klogd//' $DRACUTMODDIR/install + sed -i 's/ mdadm//' $DRACUTMODDIR/install + sed -i 's/ mkfs\.xfs//' $DRACUTMODDIR/install + sed -i 's/ xfs_db//' $DRACUTMODDIR/install + sed -i 's/ mkreiserfs//' $DRACUTMODDIR/install + sed -i 's/ reiserfstune//' $DRACUTMODDIR/install + sed -i 's/ vconfig//' $DRACUTMODDIR/install + sed -i 's/ killall//' $DRACUTMODDIR/install + + # These timezone files are not available in the latest mcp build + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh87//' $DRACUTMODDIR/install + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh88//' $DRACUTMODDIR/install + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh89//' $DRACUTMODDIR/install + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh87//' $DRACUTMODDIR/install + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh88//' $DRACUTMODDIR/install + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh89//' $DRACUTMODDIR/install + # For ppc64 platform, needs to remove some files, -# and some files are in different directories -if [ `uname -m` = "ppc64" ]; then +# # and some files are in different directories +elif [ $BUILDARCH = "ppc64" ]; then sed -i 's/dracut_install efibootmgr//' $DRACUTMODDIR/install sed -i 's/ dmidecode//' $DRACUTMODDIR/install sed -i 's/\/lib\/libncurses.so.5.7/\/lib64\/libncurses.so.5.7/' $DRACUTMODDIR/install @@ -46,38 +102,11 @@ if [ `uname -m` = "ppc64" ]; then sed -i 's/\/lib\/terminfo\/v\/vt100/\/usr\/share\/terminfo\/v\/vt100/g' $DRACUTMODDIR/install fi -if [ "$HOSTOS" = "mcp" ]; then - sed -i 's/mkfs.btrfs//' $DRACUTMODDIR/install - sed -i 's/\/etc\/redhat-release/\/etc\/base-release \/etc\/system-release/' $DRACUTMODDIR/install - sed -i 's/btrfs//' $DRACUTMODDIR/installkernel - - sed -i 's/\/usr\/bin\/basename/\/bin\/basename/' $DRACUTMODDIR/install - - # these are needed for sysclone, but are not yet in mcp - sed -i 's/ bc//' $DRACUTMODDIR/install - sed -i 's/ mkdosfs//' $DRACUTMODDIR/install - sed -i 's/ rsync//' $DRACUTMODDIR/install - sed -i 's/ kexec//' $DRACUTMODDIR/install - sed -i 's/ klogd//' $DRACUTMODDIR/install - sed -i 's/ mdadm//' $DRACUTMODDIR/install - sed -i 's/ mkfs\.xfs//' $DRACUTMODDIR/install - sed -i 's/ xfs_db//' $DRACUTMODDIR/install - sed -i 's/ mkreiserfs//' $DRACUTMODDIR/install - sed -i 's/ reiserfstune//' $DRACUTMODDIR/install - - # These timezone files are not available in the latest mcp build - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh87//' $DRACUTMODDIR/install - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh88//' $DRACUTMODDIR/install - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh89//' $DRACUTMODDIR/install - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh87//' $DRACUTMODDIR/install - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh88//' $DRACUTMODDIR/install - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh89//' $DRACUTMODDIR/install -fi -mkdir -p /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs +mkdir -p /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs # run dracut if [ "$HOSTOS" = "mcp" ]; then - KPATH=`/bin/ls -d /lib/modules/*.x86_64` + KPATH=`/bin/ls -d /lib/modules/*` KERNELVERSION=`basename $KPATH` echo Creating the initramfs in /tmp/xcatgenesis.$$.rfs using dracut and kernel $KERNELVERSION ... else @@ -85,31 +114,31 @@ else fi # On Fedora 20 ppc64, dracut uses host-only mode by default -if [ `uname -m` = "ppc64" ]; then +if [ $BUILDARCH = "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 +echo Expanding the initramfs into /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs ... +cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs zcat /tmp/xcatgenesis.$$.rfs|cpio -dumi # add the kernel if [ "$HOSTOS" = "mcp" ]; then echo Adding kernel /boot/vmlinuz-* ... - cp /boot/vmlinuz-*.x86_64 /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/kernel + cp /boot/vmlinuz-* /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/kernel else - echo Adding kernel /boot/vmlinuz-`uname -r` ... - cp /boot/vmlinuz-`uname -r` /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/kernel + echo Adding kernel /boot/vmlinuz-$BUILDARCH ... + cp /boot/vmlinuz-$BUILDARCH /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/kernel fi cd - # create tar file -echo Tarring /tmp/xcatgenesis.$$/opt into ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 ... +echo Tarring /tmp/xcatgenesis.$$/opt into ~/rpmbuild/SOURCES/xCAT-genesis-base-$BUILDARCH.tar.bz2 ... cd /tmp/xcatgenesis.$$ -tar jcf ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 opt +tar jcf ~/rpmbuild/SOURCES/xCAT-genesis-base-$BUILDARCH.tar.bz2 opt # build the rpm -echo Building xCAT-genesis-base rpm from ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 and $DIR/xCAT-genesis-base.spec ... +echo Building xCAT-genesis-base rpm from ~/rpmbuild/SOURCES/xCAT-genesis-base-$BUILDARCH.tar.bz2 and $DIR/xCAT-genesis-base.spec ... rpmbuild -ba $DIR/xCAT-genesis-base.spec rm -rf $DRACUTMODDIR From cddf0ba309a65e31b11502a6bcf37f2dbfd814bd Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 16 Mar 2015 02:23:16 -0700 Subject: [PATCH 03/14] fix defect for #4539 [FVT] On RHEL 7.1 ppc64, the name of network adapters changed after the operating system installation --- xCAT-server/share/xcat/install/rh/service.rhels7.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl b/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl index b32f1f01d..b1ac4c9b8 100644 --- a/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl +++ b/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl @@ -151,4 +151,5 @@ reboot %end %post #INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat# +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels7# %end From 17b29dcd17bb9f1530d2ed4d681fb60cc55eb0fb Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 16 Mar 2015 03:23:05 -0700 Subject: [PATCH 04/14] fix defect #4525 [DEV] ubuntu 14.04.1 ppc64el hierarchy stateless provision hang on wget: bad address 'c910f03c05k07' --- .../share/xcat/netboot/ubuntu/genimage | 56 +++++++++++++------ 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 4edff6ac0..df03b505a 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -830,20 +830,25 @@ sub getlibs { my $liblist = `chroot $rootimg_dir ldd $file`; my @libs = split/\n/,$liblist; my @return; - foreach (@libs) { - unless (/=>/) { - (my $wjnk, my $lib,my $jnk) = split /\s+/,$_,3; - $lib =~ s/^\///; - $libhash{$lib}=1; - next; - } - (my $temp1,my $temp2) = split />/,$_,2; - (my $whitespace,$temp1,$temp2) = split /\s+/,$temp2,4; - unless ($temp1 =~ /\//) { - next; - } - $temp1 =~ s/^\///; - $libhash{$temp1}=1; + foreach (@libs) { + if(/statically linked/){ + return; + } + unless (/=>/) { + (my $wjnk, my $lib,my $jnk) = split /\s+/,$_,3; + $lib =~ s/^\///; + $libhash{$lib}=1; + getlibs($lib); + next; + } + (my $temp1,my $temp2) = split />/,$_,2; + (my $whitespace,$temp1,$temp2) = split /\s+/,$temp2,4; + unless ($temp1 =~ /\//) { + next; + } + $temp1 =~ s/^\///; + $libhash{$temp1}=1; + getlibs($temp1); } } @@ -1180,12 +1185,20 @@ for i in `cat /proc/cmdline`; do #NOTE needs FT retry code to scale #NOTE: should prob have max count FILENAME=`echo \$VALUE|awk -F/ '{print \$NF}'` + + MAXTRIES=5 + ITER=0 while [ ! -r "\$FILENAME" ]; do echo Getting \$VALUE... - if ! wget \$VALUE; then + if ! /usr/bin/wget \$VALUE; then ST=`expr \$RANDOM % 5` sleep \$ST rm -f \$FILENAME + ITER=\$(expr \$ITER + 1 ) + if [ "\$ITER" == "\$MAXTRIES" ]; then + /bin/busybox telnetd -l /bin/sh + shell + fi fi done fi @@ -1420,7 +1433,7 @@ EOMS print $inifile "fi\n"; print $inifile "cd /\n"; print $inifile "cp /etc/hostname \$NEWROOT/etc/hostname\n"; - print $inifile "cp /etc/resolv.conf \$NEWROOT/etc/resolv.conf\n"; + print $inifile "rm -f \$NEWROOT/etc/resolv.conf; cp /etc/resolv.conf \$NEWROOT/etc/resolv.conf\n"; print $inifile "mount --move /dev \$NEWROOT/dev \n"; print $inifile "mount --move /proc \$NEWROOT/proc \n"; print $inifile "mount --move /sys \$NEWROOT/sys \n"; @@ -1525,7 +1538,7 @@ EOMS } } # add rsync for statelite - foreach ("bin/busybox","bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod") { + foreach ( "usr/bin/dig","bin/busybox","bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod","usr/bin/wget") { getlibs($_); push @filestoadd,$_; } @@ -1541,6 +1554,10 @@ EOMS if ($arch =~ /x86_64/) { push @filestoadd,"lib64/libnss_dns.so.2"; push @filestoadd,"lib64/libresolv.so.2"; + } elsif ($arch =~ /ppc64el/) { + push @filestoadd,"lib/powerpc64le-linux-gnu/libnss_files.so.2"; + push @filestoadd,"lib/powerpc64le-linux-gnu/libnss_dns.so.2"; + } else { push @filestoadd,"lib/libnss_dns.so.2"; } @@ -1583,6 +1600,11 @@ EOMS system("cp $rootimg_dir/lib/modules/$kernelver/modules.order /tmp/xcatinitrd.$$/lib/modules/$kernelver/modules.order"); } + +# if (-d "$rootimg_dir/lib/powerpc64le-linux-gnu/"){ +# system("cp -rf $rootimg_dir/lib/powerpc64le-linux-gnu/* /tmp/xcatinitrd.$$/lib/powerpc64le-linux-gnu/"); +# } + system("chroot /tmp/xcatinitrd.$$/ depmod $kernelver"); # Copy udev and network scripts into initrd for s390x, which also works for other platforms # udev From b99e85f10832f5a0cecd432b5419b21a5e5dd088 Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 16 Mar 2015 07:10:55 -0700 Subject: [PATCH 05/14] suppress some invalid message during genimage --- xCAT-server/share/xcat/netboot/ubuntu/genimage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index df03b505a..0c6fd71ac 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -831,7 +831,7 @@ sub getlibs { my @libs = split/\n/,$liblist; my @return; foreach (@libs) { - if(/statically linked/){ + if(/statically linked/ or /not a dynamic executable/){ return; } unless (/=>/) { From 50a086327b2949eac38000770b7b12238f382bae Mon Sep 17 00:00:00 2001 From: linggao Date: Mon, 16 Mar 2015 16:17:08 -0400 Subject: [PATCH 06/14] Fixed defect 4608: getmacs does not work for x222 nodes --- xCAT-server/lib/xcat/plugins/blade.pm | 95 ++++++++++++++++----------- 1 file changed, 57 insertions(+), 38 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index a9fcc666a..b34da65aa 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -11,6 +11,7 @@ BEGIN } } + use lib "$::XCATROOT/lib/perl"; #use Net::SNMP qw(:snmp INTEGER); use xCAT::Table; @@ -2004,7 +2005,7 @@ sub getmacs { } my @macs = (); - (my $code,my @orig_macs)=inv('mac'); + (my $code,my @orig_macs)=inv($node, 'mac'); my $ignore_gen_mac = 0; foreach my $mac (@orig_macs) { if ($mac =~ /(.*) -> (.*)/) { @@ -2113,6 +2114,7 @@ sub getmacs { } sub inv { + my $node = shift; my @invitems; my $data; my @output; @@ -2239,50 +2241,67 @@ sub inv { $updatehash{serial}=$data; } - if ($item =~ /^mac/ and $slot !~ /:/) { - foreach (0..3) { - $data=$session->get([$macoids[$_],$slot]); - if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } - if ($data =~ /:/) { - push @output,"MAC Address ".($_+1).": ".$data; + #print "item=$item, slot=$slot\n"; + + if ($item =~ /^mac/) { + if ($slot !~ /:/) { + foreach (0..3) { + $data=$session->get([$macoids[$_],$slot]); + if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } + if ($data =~ /:/) { + push @output,"MAC Address ".($_+1).": ".$data; + } + } + foreach (0..3) { + my $oid=$hsdcmacoids[$_].".$slot"; + $data=$session->get([$hsdcmacoids[$_],$slot]); + + if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } + if ($data =~ /:/) { + push @output,"HS Daughter card MAC Address ".($_+1).": ".$data; + } + } + foreach (0..3) { + $data=$session->get([$dcmacoids[$_],$slot]); + if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } + if ($data =~ /:/) { + push @output,"Daughter card 1 MAC Address ".($_+1).": ".$data; + } + } + foreach (0..3) { + $data=$session->get([$sidecardoids[$_],$slot]); + if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } + if ($data =~ /:/) { + push @output,"Side card MAC Address ".($_+1).": ".$data; + } + } + } else { + my $cmd="pasu $node show PXE |grep NicPortMacAddress"; + my $mac_list = xCAT::Utils->runcmd($cmd, 0, 1); + #print "mac_list=$mac_list\n"; + if (@$mac_list > 0) { + foreach my $mac (@$mac_list) { + #print "mac=$mac\n"; + $mac =~ s/^.*PXE.NicPortMacAddress.*(\d+)=(.*)$/"MAC Address $1: $2/; + #print "mac=$mac\n"; + push @output, $mac; + } + } } - } - foreach (0..3) { - my $oid=$hsdcmacoids[$_].".$slot"; - $data=$session->get([$hsdcmacoids[$_],$slot]); - if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } - if ($data =~ /:/) { - push @output,"HS Daughter card MAC Address ".($_+1).": ".$data; - } - } - foreach (0..3) { - $data=$session->get([$dcmacoids[$_],$slot]); - if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } - if ($data =~ /:/) { - push @output,"Daughter card 1 MAC Address ".($_+1).": ".$data; - } - } - foreach (0..3) { - $data=$session->get([$sidecardoids[$_],$slot]); - if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } - if ($data =~ /:/) { - push @output,"Side card MAC Address ".($_+1).": ".$data; - } - } - } - } - if ($updatetable and $updatehash{mtm}) { + } + } + if ($updatetable and $updatehash{mtm}) { #updatenodegroups my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($updatehash{mtm}) ; if (defined($tmp_pre)) { xCAT::TableUtils->updatenodegroups($currnode, $tmp_pre); } - } - if ($updatetable and keys %updatehash) { + } + if ($updatetable and keys %updatehash) { my $vpdtab = xCAT::Table->new('vpd'); $vpdtab->setNodeAttribs($currnode,\%updatehash); - } - return (0,@output); + } + return (0,@output); } sub power { my $subcommand = shift; @@ -3716,7 +3735,7 @@ sub bladecmd { } elsif ($command eq "getmacs") { return getmacs($node, @args); } elsif ($command eq "rinv") { - return inv(@args); + return inv($node, @args); } elsif ($command eq "reventlog") { return eventlog(@args); } elsif ($command eq "rscan") { From a2fa0c2a289f9cd27adb01f8d7059abd0e1221cf Mon Sep 17 00:00:00 2001 From: linggao Date: Mon, 16 Mar 2015 23:36:10 -0400 Subject: [PATCH 07/14] Fixed defect 4606: cannot ssh to genesis --- xCAT-genesis-builder/xcat-cmdline.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-genesis-builder/xcat-cmdline.sh b/xCAT-genesis-builder/xcat-cmdline.sh index 00aa2556e..b7cb7c093 100755 --- a/xCAT-genesis-builder/xcat-cmdline.sh +++ b/xCAT-genesis-builder/xcat-cmdline.sh @@ -7,6 +7,7 @@ echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bash_profile mkdir -p /etc/ssh mkdir -p /var/tmp/ mkdir -p /var/empty/sshd +sed -i '/^root:x/d' /etc/passwd echo root:x:0:0::/:/bin/bash >> /etc/passwd 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 From e2713f9b7bd66559ecc3167e79c9c97edc80e7e8 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Tue, 17 Mar 2015 03:03:16 -0400 Subject: [PATCH 08/14] the initrd for stateless has to been built first to make the installkernel cfg file added first. Refer to checkin 3df16cd4e38fcc434eadbe6de0c9a9b7a1f986b1 for rh7 --- xCAT-server/share/xcat/netboot/sles/genimage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 8625c7288..cbda9ed55 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -918,8 +918,8 @@ foreach my $dn (@ndrivers) { system("chroot $rootimg_dir depmod $kernelver"); if ($dracutmode) { - mkinitrd_dracut("statelite"); mkinitrd_dracut("stateless"); + mkinitrd_dracut("statelite"); } else { my @drivers; # backup of @ndrivers push @drivers, @ndrivers; From 28cb65ebacb3026d858f02c73601ece98a2b2d42 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 16 Mar 2015 16:59:02 -0400 Subject: [PATCH 09/14] rcons automatically uses confluent when it's installed on the xCAT management machine. Tests for /opt/confluent/bin/confetty Change to first check consoleservice keyword in site table before using confluent. This allows us to install confluent on the machine and control use with the keyword --- xCAT-client/bin/rcons | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/xCAT-client/bin/rcons b/xCAT-client/bin/rcons index a2baa3326..a226f3bfc 100755 --- a/xCAT-client/bin/rcons +++ b/xCAT-client/bin/rcons @@ -52,15 +52,28 @@ if [ -n "$2" ]; then fi fi -if [ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ] || [ -x "/usr/local/bin/confetty" ]; then - #use confluent - CONFETTY="confetty" - if [ -x "/opt/confluent/bin/confetty" ]; then +# xCAT 2.9.1 allows for an option to use confluent as a rcons replacement and only use +# confluent if this keyword is defined in the site table. This allows for confluent to +# be installed on the xCAT management node and switch between conserver & confluent +USE_CONFLUENT=0 +CONSOLE_SERVICE_KEYWORD=`tabdump site | grep consoleservice | cut -d, -f1 | tr -d '"'` +CONSOLE_SERVICE_VALUE=`tabdump site | grep consoleservice | cut -d, -f2 | tr -d '"'` + +if [ $CONSOLE_SERVICE_KEYWORD == "consoleservice" ]; then + if [ $CONSOLE_SERVICE_VALUE == "confluent" ]; then + USE_CONFLUENT=1 + fi +fi + +if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ] || [ -x "/usr/local/bin/confetty" ]); then + #use confluent + CONFETTY="confetty" + if [ -x "/opt/confluent/bin/confetty" ]; then CONFETTY="/opt/confluent/bin/confetty" - fi - if [ ! -z "$CONSCONTROLPATH" ]; then - CONSCONTROLPATH="-c $CONSCONTROLPATH" - fi + fi + if [ ! -z "$CONSCONTROLPATH" ]; then + CONSCONTROLPATH="-c $CONSCONTROLPATH" + fi if [ -z "$CONSERVER" ]; then CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '` fi From f731fb2ec990f88d8a74e4cb466fe15b37cebaee Mon Sep 17 00:00:00 2001 From: ertaozh Date: Tue, 17 Mar 2015 03:01:21 -0400 Subject: [PATCH 10/14] fix bug 4609: rcons returns /opt/xcat/bin/rcons: line 62: [: ==: unary operator expected --- xCAT-client/bin/rcons | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-client/bin/rcons b/xCAT-client/bin/rcons index a226f3bfc..ec599ea46 100755 --- a/xCAT-client/bin/rcons +++ b/xCAT-client/bin/rcons @@ -59,8 +59,8 @@ USE_CONFLUENT=0 CONSOLE_SERVICE_KEYWORD=`tabdump site | grep consoleservice | cut -d, -f1 | tr -d '"'` CONSOLE_SERVICE_VALUE=`tabdump site | grep consoleservice | cut -d, -f2 | tr -d '"'` -if [ $CONSOLE_SERVICE_KEYWORD == "consoleservice" ]; then - if [ $CONSOLE_SERVICE_VALUE == "confluent" ]; then +if [ "$CONSOLE_SERVICE_KEYWORD" == "consoleservice" ]; then + if [ "$CONSOLE_SERVICE_VALUE" == "confluent" ]; then USE_CONFLUENT=1 fi fi From 254f7b7b4333a177e055173dec434625a9796128 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 18 Mar 2015 16:51:49 -0400 Subject: [PATCH 11/14] This is really a hack. The xCAT-UI spec file should not have a hard coded location for compiler.jar file. However, I don't feel we should check in that compiler.jar file, so I've put it into a tools directory under the new build environment structure in c910 so we can more easily re-create build machines. The file path is automatically generated if it's not found to exists so we don't break the current build scripts. --- makerpm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/makerpm b/makerpm index 2266e78b5..d6fbc9f75 100755 --- a/makerpm +++ b/makerpm @@ -23,6 +23,18 @@ function makenoarch { RC=$? else # linux echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..." + # TODO: should fix this up, this is a hack for the new build machine + if [ $RPMNAME = "xCAT-UI" ]; then + # Only if the old compiler.jar file does not exist..... + if [ ! -e /xcat2/build/tools/compiler.jar ]; then + # look for the dynamic location of the compiler.jar file + DIRNAME=`dirname $(readlink -f $0)` + COMPILER_JAR=`echo "${DIRNAME%%linux_rpm/*}tools/compiler.jar"` + if [ -f $COMPILER_JAR ]; then + sed -i "s#/xcat2/build/tools/compiler.jar#${COMPILER_JAR}#g" xCAT-UI/xCAT-UI.spec + fi + fi + fi tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz From 89f58e514a61365c429be309e4e44f94741f1ebe Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 18 Mar 2015 21:45:28 -0700 Subject: [PATCH 12/14] fix defect #4613 [DEV] rhels7.0 provisioning complains !dracut-cmdline[78]: Warning: 'ksdevice=' is deprecated. Using BOOTIF=01-00-21-5e-a6-3d-d7 instead! --- perl-xCAT/xCAT/Utils.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) mode change 100755 => 100644 perl-xCAT/xCAT/Utils.pm diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm old mode 100755 new mode 100644 index b920ef108..bce499e13 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -3596,6 +3596,8 @@ sub version_cmp { $ver_a = shift; } my $ver_b = shift; + $ver_a =~ s/([-.]0+)+$//; + $ver_b =~ s/([-.]0+)+$//; my @array_a = ($ver_a =~ /([-.]|\d+|[^-.\d]+)/g); my @array_b = ($ver_b =~ /([-.]|\d+|[^-.\d]+)/g); @@ -3620,9 +3622,12 @@ sub version_cmp { } elsif ( $b eq '.' ) { return 1; } elsif ($a =~ /^\d+$/ and $b =~ /^\d+$/) { - if ($a =~ /^0/ || $b =~ /^0/) { - return ($a cmp $b); - } else { +# if ($a =~ /^0/ || $b =~ /^0/) { +# return ($a cmp $b); +# } else { +# return ($a <=> $b); +# } + if($a != $b ){ return ($a <=> $b); } } else { From 465fc18b2aec5be5dd984ecbb3eb4e2783fc61ae Mon Sep 17 00:00:00 2001 From: ertaozh Date: Thu, 19 Mar 2015 03:10:47 -0400 Subject: [PATCH 13/14] fix bug 4600: p8LE hardware discovery will hung when the first LINK UP nic is not in Management Network --- xCAT-genesis-scripts/bin/doxcat | 110 ++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 49 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index b0e5bb7df..e85bda22d 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -117,6 +117,7 @@ mask2prefix() { } # see if they specified static ip info, otherwise use dhcp +XCATPORT=3001 for parm in `cat /proc/cmdline`; do key=`echo $parm|awk -F= '{print $1}'` value=`echo $parm|awk -F= '{print $2}'` @@ -126,8 +127,14 @@ for parm in `cat /proc/cmdline`; do netmask=$value elif [[ ${key,,} == "gateway" ]]; then gateway=$value + elif [[ ${key,,} == "xcatd" ]]; then + XCATMASTER=`echo $value |awk -F: '{print $1}'` + XCATPORT=`echo $value |awk -F: '{print $2}'` fi done +export XCATPORT +export XCATMASTER + if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then # doing static ip # the device was determined above from the bootif mac, and put in bootnic @@ -145,54 +152,68 @@ 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 - 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 + # This section is for System P hardware discovery, which won't have a BOOTIF value set if [ -z "$bootnic" ]; then - 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 + tries=0 + while [ $tries -lt 100 ]; do + ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo | sort -n -r` + for tmp1 in $ALLUP_NICS; do + dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$tmp1.pid $tmp1 & + dhclient -6 -pf /var/run/dhclient6.$tmp1.pid $tmp1 -lf /var/lib/dhclient/dhclient6.leases & + #bootnic=$tmp1 + #break + done + if [ ! -z "$ALLUP_NICS" ]; then + break + fi + sleep 2 + tries=$(($tries+1)) 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 - #in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up - dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases & - NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'` - export NICSTOBRINGUP - for nic in $NICSTOBRINGUP; do + echo -n "Acquiring network addresses.." + while [ -z "$bootnic" ]; do + for tmp1 in $ALLUP_NICS; do + if ip addr show dev $tmp1|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; then + result=`ping -c1 -I $tmp1 $XCATMASTER 2>&1` + if [ $? -eq 0 ]; then + bootnic=$tmp1 + break + fi + fi + done + sleep 2 + done + if [ -z "$bootnic" ]; then + /bin/bash + fi + else + 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 + #in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up + dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases & + NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'` + export NICSTOBRINGUP + for nic in $NICSTOBRINGUP; do (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) & (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) & - done + done + + gripeiter=101 + echo -n "Acquiring network addresses.." + while ! ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; do + sleep 0.1 + if [ $gripeiter = 1 ]; then + echo + echo "It seems to be taking a while to acquire an IPv4 address, you may want to check spanning tree..." + fi + gripeiter=$((gripeiter-1)) + done + fi fi openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 & -gripeiter=101 -echo -n "Acquiring network addresses.." -while ! ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; do - sleep 0.1 - if [ $gripeiter = 1 ]; then - echo - echo "It seems to be taking a while to acquire an IPv4 address, you may want to check spanning tree..." - fi - gripeiter=$((gripeiter-1)) -done echo -n "Acquired IPv4 address on $bootnic: " ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}' ntpd -g -x @@ -214,16 +235,7 @@ if [ -f "/usr/sbin/dmidecode" ]; then fi DEVICE=$bootnic export DEVICE -XCATPORT=3001 -export XCATPORT -for parm in `cat /proc/cmdline`; do - key=`echo $parm|awk -F= '{print $1}'` - if [ "$key" = "xcatd" ]; then - XCATMASTER=`echo $parm|awk -F= '{print $2}'|awk -F: '{print $1}'` - XCATPORT=`echo $parm|awk -F= '{print $2}'|awk -F: '{print $2}'` - fi -done -export XCATMASTER + if [ "$destiny" != "discover" ]; then #we aren't discoverying, we probably can and should get a cert /bin/getcert $XCATMASTER:$XCATPORT fi From b0979eafc908420fe66e9d6b14e16ad91b41ed93 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 19 Mar 2015 12:14:27 -0400 Subject: [PATCH 14/14] Add a LOG option to buildcore.sh to allow for some output to redirect to a log file. Currently only used to optionally redirect wget output to a log instead of stderr. Output to stderr will cause automated build scripts to fail. --- buildcore.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/buildcore.sh b/buildcore.sh index 5dcb44a2c..d893423fd 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -36,6 +36,7 @@ # GITUP= - control which rpms get built by specifying a coregitup file # EMBED= - the environment for which a minimal version of xcat should be built, e.g. zvm or flex # VERBOSE=1 - to see lots of verbose output +# LOG= - provide an LOG file option to redirect some output into log file # you can change this if you need to UPLOADUSER=bp-sawyers @@ -343,6 +344,10 @@ fi #else we will continue # Prepare the RPMs for pkging and upload +WGET_CMD="wget" +if [ ! -z ${LOG} ]; then + WGET_CMD="wget -o ${LOG}" +fi # get gpg keys in place if [ "$OSNAME" != "AIX" ]; then @@ -350,7 +355,7 @@ if [ "$OSNAME" != "AIX" ]; then for i in pubring.gpg secring.gpg trustdb.gpg; do if [ ! -f $HOME/.gnupg/$i ] || [ `wc -c $HOME/.gnupg/$i|cut -f 1 -d' '` == 0 ]; then rm -f $HOME/.gnupg/$i - wget -P $HOME/.gnupg $GSA/keys/$i + ${WGET_CMD} -P $HOME/.gnupg $GSA/keys/$i chmod 600 $HOME/.gnupg/$i fi done @@ -372,10 +377,10 @@ if [ "$OSNAME" != "AIX" ]; then gpg -a --detach-sign $DESTDIR/repodata/repomd.xml gpg -a --detach-sign $SRCDIR/repodata/repomd.xml if [ ! -f $DESTDIR/repodata/repomd.xml.key ]; then - wget -P $DESTDIR/repodata $GSA/keys/repomd.xml.key + ${WGET_CMD} -q -P $DESTDIR/repodata $GSA/keys/repomd.xml.key fi if [ ! -f $SRCDIR/repodata/repomd.xml.key ]; then - wget -P $SRCDIR/repodata $GSA/keys/repomd.xml.key + ${WGET_CMD} -P $SRCDIR/repodata $GSA/keys/repomd.xml.key fi fi