diff --git a/buildcore.sh b/buildcore.sh index 4ff8f272c..5dcb44a2c 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -49,7 +49,7 @@ ZVMLINK="xCAT-client xCAT xCATsn" # xCAT-server has PCM specific configuration - RESTAPI(perl-JSON) # 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" +PCMLINK="perl-xCAT xCAT-buildkit xCAT-genesis-scripts-x86_64 xCAT-genesis-scripts-ppc64 xCAT-vlan" # Note: for FSM, the FlexCAT rpm is built separately from gsa/git FSMBUILD="perl-xCAT xCAT-client xCAT-server" FSMLINK="" diff --git a/perl-xCAT/xCAT/ProfiledNodeUtils.pm b/perl-xCAT/xCAT/ProfiledNodeUtils.pm index 778eea607..ce7989c72 100644 --- a/perl-xCAT/xCAT/ProfiledNodeUtils.pm +++ b/perl-xCAT/xCAT/ProfiledNodeUtils.pm @@ -1351,7 +1351,6 @@ sub get_netboot_attr{ { return 0, "Hardware profile not defined in DB." } - $hardwareprofile =~ s/^__HardwareProfile_//; } else { @@ -1384,16 +1383,28 @@ sub get_netboot_attr{ { $os_arch = 'x86_64'; } + + # Identify whether this node is PowerKVM or PowerNV if os arch is ppc64le + # If hardware profile is defined + my $mgt = '*'; + if ($os_arch eq 'ppc64le' and $hardwareprofile ne '*') { + my $nodehmtab = xCAT::Table->new('nodehm'); + my $nodehmtab_entry = $nodehmtab->getNodeAttribs($hardwareprofile, ['mgt']); + if (defined $nodehmtab_entry->{'mgt'}) { + $mgt = $nodehmtab_entry->{'mgt'}; + } + } + # Rule for netboot attribute.If update the rule,just update %netboot_dict and @condition_array # It's sequence sensitive: os arch -> os name -> os major version -> hardware profile -# Priority | Arch | OS Name | OS Major Version | Hardware Profile | Noderes.netboot | -# 1 | x86_64/x86 | * | * | * | xnba | -# 2 | ppc64 | rhels | 7 | * | grub2 | -# 3 | | * | * | * | yaboot | -# 4 | ppc64le/el | * | * | IBM_PowerNV | petitboot | -# 5 | | * | * | * | grub2 | -# arch osname version hardware netboot +# Priority | Arch | OS Name | OS Major Version | Management method | Noderes.netboot | +# 1 | x86_64/x86 | * | * | * | xnba | +# 2 | ppc64 | rhels | 7 | * | grub2 | +# 3 | | * | * | * | yaboot | +# 4 | ppc64le/el | * | * | * | grub2 +# 4 | ppc64le/el | * | * | ipmi | petitboot +# arch osname version hardware netboot my %netboot_dict = ( 'x86_64' => 'xnba', 'ppc64' => { 'rhels' => { @@ -1405,20 +1416,20 @@ sub get_netboot_attr{ 'ppc64le' => { '*' => { '*' => { - 'IBM_PowerNV' => 'petitboot', - '*' => 'grub2', + '*' => 'grub2', + 'ipmi' => 'petitboot', }, }, }, ); - my $condition_array_ref = [$os_arch, $os_name, $os_major_version, $hardwareprofile]; + my $condition_array_ref = [$os_arch, $os_name, $os_major_version, $mgt]; $netboot = cal_netboot(\%netboot_dict, $condition_array_ref); if($netboot eq '0') { return 0, "Can not get the netboot attribute"; } else - { + { return 1, $netboot; } } diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index d674c4c4a..a4c2f4d84 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -839,6 +839,14 @@ Usage: if(exists $args_dict{'hardwareprofile'}){ $hardwareprofile = $args_dict{'hardwareprofile'}; } + + # Get the netboot attribute for node + my ($retcode, $retval) = xCAT::ProfiledNodeUtils->get_netboot_attr($imageprofile, $hardwareprofile); + if (not $retcode) { + setrsp_errormsg($retval); + return; + } + my $new_netboot = $retval; # After checking, all nodes' profile should be same # Get the new profile with specified ones in args_dict @@ -879,13 +887,7 @@ Usage: setrsp_infostr("Warning: no profile changes detect."); return; } - # Get the netboot attribute for node - my ($retcode, $retval) = xCAT::ProfiledNodeUtils->get_netboot_attr($imageprofile, $hardwareprofile); - if (not $retcode) { - setrsp_errormsg($retval); - return; - } - my $new_netboot = $retval; + # Update nodes' attributes foreach (@$nodes) { $updatenodeshash{$_}{'groups'} .= $profile_groups; diff --git a/xCAT-server/share/xcat/install/scripts/chroot.sles b/xCAT-server/share/xcat/install/scripts/chroot.sles index 7698db4e8..cf22e985a 100644 --- a/xCAT-server/share/xcat/install/scripts/chroot.sles +++ b/xCAT-server/share/xcat/install/scripts/chroot.sles @@ -46,7 +46,15 @@ if [ -z "$PRINIC" ] then for karg in $(cat /proc/cmdline |sed -e 's/-/:/g' -e 's/ /\n/g'); do if [ "${karg%%=*}" = "BOOTIF" ]; then - export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=01:}"|awk '{print $1}'` + #export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=01:}"|awk '{print $1}'` + export PRINIC=${karg#*=01:} + export PRINIC=`ip -o link|grep -i "$PRINIC"|awk '{print $2}'|sed s/://` + fi + if [ "${karg%%=*}" = "netdevice" ]; then + export PRINIC="${karg#*=}"; + if [ "${#PRINIC}" = "20" ]; then + export PRINIC=${PRINIC:3:21} + fi fi done if [ -z "$PRINIC" ]; then @@ -57,7 +65,8 @@ if [ -z "$PRINIC" ] then export PRINIC=eth0 elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then - export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'` + #export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'` + export PRINIC=`ip -o link|grep -i "$PRINIC"|awk '{print $2}'|sed s/://` fi echo 'export PRINIC='"$PRINIC" > /mnt/tmp/prinicsetting ]]> diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index 7a571db44..590a78598 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash # IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html # Internal script used by confignics only. # It configs the Ethernet adpaters on the node @@ -502,6 +502,21 @@ elif [ "$1" = "-s" ];then str_inst_ip=`grep fixed-address $str_lease_file | tail -n 1 | awk '{print $2}' | sed 's/;$//'` str_inst_mask=`grep subnet-mask $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` + else + if [ -n "$MACADDRESS" ];then + str_inst_mac=$MACADDRESS + inst_nic=`ip -o link |grep -i ${str_inst_mac} |awk '{print $2}'|sed 's/://g'` + if [ ! -z "${inst_nic}" ];then + str_inst_ip=`ip -4 -o addr|grep -i ${inst_nic} |awk '{print $4}'|awk -F/ '{print $1}'` + if [ ! -z "str_inst_ip" ];then + inst_ip_pre=`ip ro ls|grep -i ${str_inst_ip}|awk '{print $1}'|awk -F/ '{print $1}'` + if [ ! -z "inst_ip_pre" ];then + str_inst_mask=`route |grep ${inst_ip_pre}|awk '{print $3}'|head -1` + fi + fi + fi + str_inst_gateway=`ip ro ls|grep default|awk '{print $3}'|head -1` + fi fi elif [ -f "/etc/SuSE-release" ];then str_lease_file="/var/lib/dhcpcd/dhcpcd-"$str_inst_nic".info" @@ -516,6 +531,21 @@ elif [ "$1" = "-s" ];then str_inst_ip=`grep fixed-address $str_lease_file | tail -n 1 | awk '{print $2}' | sed 's/;$//'` str_inst_mask=`grep subnet-mask $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` + else + if [ -n "$MACADDRESS" ];then + str_inst_mac=$MACADDRESS + inst_nic=`ip -o link |grep -i ${str_inst_mac} |awk '{print $2}'|sed 's/://g'` + if [ ! -z "${inst_nic}" ];then + str_inst_ip=`ip -4 -o addr|grep -i ${inst_nic} |awk '{print $4}'|awk -F/ '{print $1}'` + if [ ! -z "str_inst_ip" ];then + inst_ip_pre=`ip ro ls|grep -i ${str_inst_ip}|awk '{print $1}'|awk -F/ '{print $1}'` + if [ ! -z "inst_ip_pre" ];then + str_inst_mask=`route |grep ${inst_ip_pre}|awk '{print $3}'|head -1` + fi + fi + fi + str_inst_gateway=`ip ro ls|grep default|awk '{print $3}'|head -1` + fi fi fi if [ -n "$MACADDRESS" ];then