From 59a277bc407561862e019875b38ca0ee70e2e85a Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 13 Jun 2014 05:48:53 -0400 Subject: [PATCH 1/9] fix incorrect call --- xCAT-client/bin/mysqlsetup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index 5c78f2fd4..bf764b35a 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -1822,7 +1822,7 @@ sub restorexcatdb else { #$xcmd = "service xcatd restart"; - my $ret=xCAT::Utils->restartservie("xcatd"); + my $ret=xCAT::Utils->restartservice("xcatd"); return $ret; } From 2b3115299f3b52d60ab744aee7f6bb4ff0791685 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 13 Jun 2014 04:32:25 -0700 Subject: [PATCH 2/9] fix defext #4162 Wrong value of kernel argument ifname= - diskless/stateless node failed to boot in RHEL7 environment --- xCAT-server/lib/xcat/plugins/anaconda.pm | 46 +++++++++++++++--------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index a5e2eb60a..b286edb5c 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -752,15 +752,19 @@ sub mknetboot my $useifname=0; #for rhels5.x-ppc64, if installnic="mac", BOOTIF= should be appended my $usemac=0; + my $nicname=""; if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") { $useifname=1; - $kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":"; + #$kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":"; + $nicname=$reshash->{$node}->[0]->{installnic}; } elsif ($nodebootif) { $useifname=1; - $kcmdline .= "ifname=$nodebootif:"; + #$kcmdline .= "ifname=$nodebootif:"; + $nicname=$nodebootif; } elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") { $useifname=1; - $kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":"; + #$kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":"; + $nicname=$reshash->{$node}->[0]->{primarynic}; }else{ if($arch=~ /ppc/) { @@ -790,24 +794,32 @@ sub mknetboot # } } - if ($useifname && $mac) { - $kcmdline .= "$mac "; + if( ($nicname ne "") and (not xCAT::NetworkUtils->isValidMAC($nicname) )){ + if ($useifname && $mac) { + $kcmdline .= "ifname=$nicname:$mac "; + } + $kcmdline .= "netdev=$nicname "; + }else { + if($mac){ + $kcmdline .= "BOOTIF=$mac "; + } } + # add "netdev=" or "BOOTIF=" # which are used for other scenarios - my $netdev = ""; - if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") { - $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " "; - } elsif ($nodebootif) { - $kcmdline .= "netdev=" . $nodebootif . " "; - } elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") { - $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " "; - } else { - if ( ($usemac || $useifname) && $mac) { - $kcmdline .= "BOOTIF=" . $mac . " "; - } - } + #my $netdev = ""; + #if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") { + # $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " "; + #} elsif ($nodebootif) { + # $kcmdline .= "netdev=" . $nodebootif . " "; + #} elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") { + # $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " "; + #} else { + # if ( ($usemac || $useifname) && $mac) { + # $kcmdline .= "BOOTIF=" . $mac . " "; + # } + #} my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] ); if ( $client_nethash{$node}{mgtifname} =~ /hf/ ) From d7eb089a6e42f99611c6b7ef33d1a9be21a764d0 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 13 Jun 2014 10:37:18 -0400 Subject: [PATCH 3/9] replace ifconfig with ip --- xCAT/postscripts/enablekdump | 3 ++- xCAT/postscripts/hardeths | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/enablekdump b/xCAT/postscripts/enablekdump index 1c6ad2d92..f713c69cf 100755 --- a/xCAT/postscripts/enablekdump +++ b/xCAT/postscripts/enablekdump @@ -31,7 +31,8 @@ for i in `/bin/cat /proc/cmdline`; do break elif [ "$KEY" = "BOOTIF" ]; then MACX=`/bin/echo $i | /bin/awk -F= '{print $2}'|sed -e s/^01-// -e s/-/:/g` - ETHX=`/sbin/ifconfig | /bin/grep -i $MACX | /bin/awk '{print $1}'` + #ETHX=`/sbin/ifconfig | /bin/grep -i $MACX | /bin/awk '{print $1}'` + ETHX=`/sbin/ip -oneline link show ens33|/bin/grep -i $MACX |/bin/awk -F ":" '{print $2}'|/bin/grep -o "[^ ]\+\( \+[^ ]\+\)*"` break fi done diff --git a/xCAT/postscripts/hardeths b/xCAT/postscripts/hardeths index f3f8b2236..3c72f3dd0 100755 --- a/xCAT/postscripts/hardeths +++ b/xCAT/postscripts/hardeths @@ -81,7 +81,8 @@ for nic in `ip link |grep "BROADCAST" |awk '{print $2}' | sed s/://`; do if ( pmatch $OSVER "ubuntu*" ) then NETWORK=`network_ipv4calc $IPADDR $NETMASK` - BROADCAST=`ifconfig $nic | grep Bcast | awk '{print $3}' | awk -F: '{print $2}'` + #BROADCAST=`ifconfig $nic | grep Bcast | awk '{print $3}' | awk -F: '{print $2}'` + BROADCAST=`ip -4 -oneline addr show $nic|grep brd| awk -F ' ' '{print $6}'` if [ ! -z "$defgw" ]; then gateway_line="gateway $defgw" From 560dd57b15075d2fe777969b6d909da2a27b7e24 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 13 Jun 2014 09:06:12 -0700 Subject: [PATCH 4/9] replace ifconfig with ip,replace service with systemd --- xCAT/postscripts/setupesx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/xCAT/postscripts/setupesx b/xCAT/postscripts/setupesx index 0e062cd60..d21c290ed 100755 --- a/xCAT/postscripts/setupesx +++ b/xCAT/postscripts/setupesx @@ -1,12 +1,18 @@ # esx setup # example on how to set up ESX. We setup ssh and also add a basic # VLAN configuration + +str_dir_name=`dirname $0` + +. $str_dir_name/xcatlib.sh + logger -t xcat -p local4.info setupesx # Enable SSH access to root and exchange keys sed -e 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config > /etc/ssh/sshd_config.new mv -f /etc/ssh/sshd_config.new /etc/ssh/sshd_config -/etc/init.d/sshd restart +#/etc/init.d/sshd restart +restartservice ssh if [ -r /etc/ssh/sshd_config ] then @@ -43,8 +49,11 @@ cat >/tmp/esxcfg.sh < Date: Fri, 13 Jun 2014 09:35:41 -0700 Subject: [PATCH 5/9] replace ifconfig with ip --- xCAT-genesis-builder/restart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-builder/restart b/xCAT-genesis-builder/restart index 19a624f6e..2a235c788 100755 --- a/xCAT-genesis-builder/restart +++ b/xCAT-genesis-builder/restart @@ -44,8 +44,10 @@ while [ $WAITING -gt 0 ]; do done WAITING=0 if [ ! -z "$FORCENICS" ]; then - for nic in `ifconfig|grep HWaddr|awk '{print $1}'|egrep "$FORCENICS"`; do - if ! ifconfig $nic|grep "inet addr" > /dev/null; then + #for nic in `ifconfig|grep HWaddr|awk '{print $1}'|egrep "$FORCENICS"`; do + for nic in `ip -oneline link show |grep -i ether |awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"|egrep "$FORCENICS"`; do + # if ! ifconfig $nic|grep "inet addr" > /dev/null; then + if ! ip -4 -oneline addr show $nic|grep -i inet > /dev/null; then WAITING=1 fi done From 8cf5aacd8f286d40506a9ce0898535487f7b609a Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 13 Jun 2014 19:36:34 -0700 Subject: [PATCH 6/9] replace ifconfig with ip --- xCAT-genesis-scripts/etc/init.d/functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/etc/init.d/functions b/xCAT-genesis-scripts/etc/init.d/functions index 0744c87ed..d4e3e9624 100644 --- a/xCAT-genesis-scripts/etc/init.d/functions +++ b/xCAT-genesis-scripts/etc/init.d/functions @@ -1590,7 +1590,8 @@ send_monitor_msg() { # Get the client mac address. if [ -z "$mac" ]; then - mac=`ifconfig $DEVICE 2>/dev/null | sed -ne "s/.*HWaddr //p" | sed "s/ //g" | sed s/:/./g` + #mac=`ifconfig $DEVICE 2>/dev/null | sed -ne "s/.*HWaddr //p" | sed "s/ //g" | sed s/:/./g` + mac=`ip -4 -oneline link show $DEVICE 2>/dev/null|grep -i ether|sed -ne "s/.*ether //p"|awk -F ' ' '{print $1}'|sed s/:/./g` fi # Collect some special info only after proc file system is mounted. From 43b1ddd1db4cb4ec77ba4a914908fd57e7b3c755 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 13 Jun 2014 20:13:49 -0700 Subject: [PATCH 7/9] replace ifconfig with ip --- xCAT-IBMhpc/share/xcat/IBMhpc/ping-all/ping_all | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/ping-all/ping_all b/xCAT-IBMhpc/share/xcat/IBMhpc/ping-all/ping_all index a8719159f..c9e6992ac 100755 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/ping-all/ping_all +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/ping-all/ping_all @@ -62,7 +62,8 @@ else file=$1 fi -ifconfig -a | grep 'inet ' | awk ' { print $2 } ' | grep -v 127.0.0.1 | +#ifconfig -a | grep 'inet ' | awk ' { print $2 } ' | grep -v 127.0.0.1 | +ip -4 -oneline addr show 2>/dev/null |grep inet | sed -ne "s/.*inet //p"|awk -F ' ' '{print $1}'|awk -F '/' '{print $1}'| while read my_address ; do ##print "checking $my_address" grep -q " ${my_address}$" $file From c778b849e9ec48be864a78f6c1305e2827dc459d Mon Sep 17 00:00:00 2001 From: immarvin Date: Sat, 14 Jun 2014 08:51:41 -0700 Subject: [PATCH 8/9] replace ifconfig with ip --- xCAT-server/share/xcat/netboot/rh/dracut/xcatroot | 3 ++- xCAT-server/share/xcat/netboot/rh/genimage | 3 ++- xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot | 3 ++- xCAT-server/share/xcat/scripts/genduiduuid.sh | 3 ++- xCAT-server/share/xcat/scripts/genula.sh | 3 ++- xCAT-server/share/xcat/scripts/xHRM | 9 ++++++--- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index 72a1f4ba9..e18f532a5 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -236,7 +236,8 @@ if [ -z $STATEMNT ]; then MACX=`ip link show $netdev | grep ether | awk '{print $2}'` elif [ ! -z "$BOOTIF" ]; then MACX=$BOOTIF - ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'` + #ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'` + ETHX=` ip -oneline link show |grep -i $BOOTIF|awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"` fi if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index ce7baeb96..8c4ced961 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -1154,7 +1154,8 @@ for i in `cat /proc/cmdline`; do NETDEV=`echo \$i |awk -F= '{print \$2}'` elif [ "\$KEY" == 'BOOTIF' ]; then VALUE=`echo \$i |awk -F= '{print \$2}'|sed -e s/^01-// -e s/-/:/g` - BOOTIF=`ifconfig -a|grep -i "hwaddr \$VALUE"|awk '{print \$1}'` + #BOOTIF=`ifconfig -a|grep -i "hwaddr \$VALUE"|awk '{print \$1}'` + BOOTIF=\`ip -oneline link show |grep -i \$VALUE|awk -F ':' '{print \$2}'|grep -o \"[^ ]\+\( \+[^ ]\+\)*\"\` elif [ "\$KEY" == 'XCAT' ]; then VALUE=`echo \$i |awk -F= '{print \$2}'` # format: XCAT=xcatmaster:3001 diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot index b02abe09f..894a86a1c 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot @@ -166,7 +166,8 @@ if [ -z $STATEMNT ]; then MACX=`ip link show $netdev | grep ether | awk '{print $2}'` elif [ ! -z "$BOOTIF" ]; then MACX=$BOOTIF - ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'` + #ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'` + ETHX=` ip -oneline link show |grep -i $BOOTIF|awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"` fi if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then diff --git a/xCAT-server/share/xcat/scripts/genduiduuid.sh b/xCAT-server/share/xcat/scripts/genduiduuid.sh index 1cfa20dfa..e9bf49317 100644 --- a/xCAT-server/share/xcat/scripts/genduiduuid.sh +++ b/xCAT-server/share/xcat/scripts/genduiduuid.sh @@ -13,7 +13,8 @@ if [ -r /sys/devices/virtual/dmi/id/product_uuid ]; then duid=$duid$octnum done duid=$duid'";' - for interface in `ifconfig -a|grep HWaddr|awk '{print $1}'`; do + #for interface in `ifconfig -a|grep HWaddr|awk '{print $1}'`; do + for interface in `ip -4 -oneline link show|grep -i ether |awk -F ":" '{print $2}'| grep -o "[^ ]\+\( \+[^ ]\+\)*"`; do echo $duid > /var/lib/dhclient/dhclient6-$interface.leases done echo $duid > /var/lib/dhclient/dhclient6.leases diff --git a/xCAT-server/share/xcat/scripts/genula.sh b/xCAT-server/share/xcat/scripts/genula.sh index 74103ab57..ac8220d77 100644 --- a/xCAT-server/share/xcat/scripts/genula.sh +++ b/xCAT-server/share/xcat/scripts/genula.sh @@ -20,7 +20,8 @@ TIMESTAMP=$(printf "%08X:%08X" $SECONDS $NTPTICKS) #next, get a mac address and convert to eui64 EUIPAD="FF:FE" -MAC=$(/sbin/ifconfig|grep HWaddr|grep -v usb|grep -v 00:00:00:00:00:00|head -n 1|awk '{print $NF}') +#MAC=$(/sbin/ifconfig|grep HWaddr|grep -v usb|grep -v 00:00:00:00:00:00|head -n 1|awk '{print $NF}') +MAC=$(ip -oneline link show|grep -v usb|grep -v 00:00:00:00:00:00|head -n 1|sed -ne "s/.*link\/ether //p"|awk -F ' ' '{print $1}') FIRSTBYTE=${MAC%%:*} FIRSTBYTE=$(printf %02X $((0x$FIRSTBYTE|2))) OTHERMANUF=${MAC%%:??:??:??} diff --git a/xCAT-server/share/xcat/scripts/xHRM b/xCAT-server/share/xcat/scripts/xHRM index 470893c00..d184130b4 100755 --- a/xCAT-server/share/xcat/scripts/xHRM +++ b/xCAT-server/share/xcat/scripts/xHRM @@ -7,13 +7,15 @@ function get_def_interface { #we are, however, presuming ipv4 for the moment retval=$(ping -c 1 `hostname`|head -n 1|cut -d\( -f 2|cut -d\) -f 1) if [ -z "$retval" -o "127.0.0.1" = "$retval" ]; then #ok, that didn't pan out, now we grab the first address that looks sane - retval=`ifconfig|grep inet" " |grep -v addr:127.0.0.1|grep -v 'addr:169.254'|head -n 1|cut -d: -f 2|cut -d' ' -f 1` + #retval=`ifconfig|grep inet" " |grep -v addr:127.0.0.1|grep -v 'addr:169.254'|head -n 1|cut -d: -f 2|cut -d' ' -f 1` + retval=`ip -4 -oneline addr show|grep -v "127.0.0.1"|grep -v '169.254'|head -n 1|awk -F 'inet ' '{print $2}'|awk -F '/' '{print $1}'` fi if [ -z "$retval" ]; then echo "ERROR: Unable to reasonably guess the 'default' interface" >&2 exit 1 fi - iface=`ifconfig|grep -v inet6|egrep '(Link|inet)'|grep -B1 'addr:'$retval |head -n 1|awk '{print $1}'` + #iface=`ifconfig|grep -v inet6|egrep '(Link|inet)'|grep -B1 'addr:'$retval |head -n 1|awk '{print $1}'` + iface=`ip -4 -oneline addr show|grep -i $retval|awk -F ':' '{print $2}'|awk -F ' ' '{print $1}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"` if [ -z "$iface" ]; then echo "ERROR: Unable to reasonably guess the default interface" >&2 exit 1 @@ -118,7 +120,8 @@ elif [ "bridgeprereq" = "$1" ]; then # get the port for installation if [ -n "$INSTALLNIC" ]; then if [[ "$INSTALLNIC" = mac ]] || [[ "$INSTALLNIC" = MAC ]]; then - INSPORT=`ifconfig -a|grep -v inet6| grep -i 'HWaddr '$MACADDRESS|head -n 1|awk '{print $1}'` + #INSPORT=`ifconfig -a|grep -v inet6| grep -i 'HWaddr '$MACADDRESS|head -n 1|awk '{print $1}'` + INSPORT=`ip -oneline link show|grep -i ether|grep -i $MACADDRESS|awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"` else INSPORT=$INSTALLNIC fi From d49424b6c8c1a69ce1e0c2034172a19c3c72bf7f Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 16 Jun 2014 01:58:35 -0700 Subject: [PATCH 9/9] add discinfo of rhelhpc7.0 --- perl-xCAT/xCAT/data/discinfo.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/perl-xCAT/xCAT/data/discinfo.pm b/perl-xCAT/xCAT/data/discinfo.pm index c0153d435..42362c0d0 100755 --- a/perl-xCAT/xCAT/data/discinfo.pm +++ b/perl-xCAT/xCAT/data/discinfo.pm @@ -72,6 +72,7 @@ require Exporter; "1339640148.070971" => "rhelhpc6.3",#x86_64 "1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode "1384196516.465862" => "rhelhpc6.5",#x86_64, RHEL ComputeNode + "1399449226.140088" => "rhelhpc7.0",#x86_64, RHEL ComputeNode "1194015916.783841" => "fedora8", "1194015385.299901" => "fedora8", "1210112435.291709" => "fedora9",