diff --git a/buildcore.sh b/buildcore.sh index f5897f5ae..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="" @@ -85,21 +85,19 @@ if [ "$OSNAME" != "AIX" ]; then echo "Can't get lock /var/lock/xcatbld-$REL.lock. Someone else must be doing a build right now. Exiting...." exit 1 fi - - export HOME=/root # This is so rpm and gpg will know home, even in sudo + # This is so rpm and gpg will know home, even in sudo + export HOME=/root fi # for the git case, query the current branch and set REL (changing master to devel if necessary) function setbranch { - #git checkout $BRANCH - #REL=`git rev-parse --abbrev-ref HEAD` REL=`git name-rev --name-only HEAD` if [ "$REL" = "master" ]; then REL="devel" fi } -if [ "$REL" = "xcat-core" ]; then # using git +if [ "$REL" = "xcat-core" ]; then # using git GIT=1 setbranch # this changes the REL variable fi @@ -131,7 +129,7 @@ fi XCATCORE="xcat-core" # core-snap is a sym link to xcat-core -if [ "$GIT" = "1" ]; then # using git - need to include REL in the path where we put the built rpms +if [ "$GIT" = "1" ]; then # using git - need to include REL in the path where we put the built rpms DESTDIR=../../$REL$EMBEDDIR/$XCATCORE else DESTDIR=../..$EMBEDDIR/$XCATCORE @@ -184,7 +182,8 @@ fi # If they have not given us a premade update file, do an svn update or git pull and capture the results SOMETHINGCHANGED=0 -if [ "$GIT" = "1" ]; then # using git +if [ "$GIT" = "1" ]; then + # using git if [ -z "$GITUP" ]; then GITUP=../coregitup echo "git pull > $GITUP" @@ -198,7 +197,8 @@ if [ "$GIT" = "1" ]; then # using git if ! $GREP 'Already up-to-date' $GITUP; then SOMETHINGCHANGED=1 fi -else # using svn +else + # using svn GIT=0 if [ -z "$SVNUP" ]; then SVNUP=../coresvnup @@ -242,7 +242,6 @@ fi # Build the rest of the noarch rpms for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT-SoftLayer xCAT-vlan xCAT-confluent; do - #if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then continue; fi # for zvm embedded env only need to build server and UI if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-SoftLayer" ]; then continue; fi # do not build xCAT-softlayer on aix @@ -253,7 +252,8 @@ for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xC maker $rpmname fi if [ "$OSNAME" = "AIX" ]; then - if [ "$rpmname" = "xCAT-client" -o "$rpmname" = "xCAT-server" ]; then # we do not automatically install the rest of the rpms on AIX + if [ "$rpmname" = "xCAT-client" -o "$rpmname" = "xCAT-server" ]; then + # we do not automatically install the rest of the rpms on AIX echo "rpm -Uvh $rpmname-$SHORTSHORTVER*rpm" >> $DESTDIR/instxcat fi fi @@ -281,9 +281,7 @@ if [ "$OSNAME" != "AIX" ]; then fi # Build the xCAT and xCATsn rpms for all platforms -#for rpmname in xCAT xCATsn xCAT-OpenStack xCAT-OpenStack-baremetal; do for rpmname in xCAT xCATsn; do - #if [ "$EMBED" = "zvm" ]; then break; fi if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # used to be: if $GREP -E "^[UAD] +$rpmname/" $GITUP; then UPLOAD=1 diff --git a/perl-xCAT/xCAT/ProfiledNodeUtils.pm b/perl-xCAT/xCAT/ProfiledNodeUtils.pm index 743101e38..ce7989c72 100644 --- a/perl-xCAT/xCAT/ProfiledNodeUtils.pm +++ b/perl-xCAT/xCAT/ProfiledNodeUtils.pm @@ -1261,6 +1261,13 @@ sub gen_chain_for_profiles{ unless ($netprofileattr){ return (1, "Can not get attributes for network profile $netprofile"); } + + # Get node's netboot attribute + my ($retcode, $retval) = xCAT::ProfiledNodeUtils->get_netboot_attr($imgprofile, $hwprofile); + if (not $retcode) { + return (1, $retval); + } + my $netboot = $retval; $final_chain = 'osimage='.$provmethod.":--noupdateinitrd"; # get the chain attribute from hardwareprofile and insert it to node. @@ -1273,7 +1280,8 @@ sub gen_chain_for_profiles{ } } #run bmcsetups. - if ((exists $netprofileattr->{"bmc"}) and $hw_reconfig){ + #PowerNV nodes can't use 'runcmd=bmcsetup' to set BMC. + if ((exists $netprofileattr->{"bmc"}) and $hw_reconfig and $netboot ne 'petitboot'){ if (index($final_chain, "runcmd=bmcsetup") == -1){ $final_chain = 'runcmd=bmcsetup,'.$final_chain.':reboot4deploy'; } @@ -1343,7 +1351,6 @@ sub get_netboot_attr{ { return 0, "Hardware profile not defined in DB." } - $hardwareprofile =~ s/^__HardwareProfile_//; } else { @@ -1376,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 | petiboot | -# 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' => { @@ -1397,20 +1416,20 @@ sub get_netboot_attr{ 'ppc64le' => { '*' => { '*' => { - 'IBM_PowerNV' => 'petiboot', - '*' => '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/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index f9574c00a..c1deed358 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -3710,7 +3710,7 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs); access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname', }, {attr_name => 'kitreponame', - tabentry => 'kitcomponent.kitrepoid', + tabentry => 'kitcomponent.kitreponame', access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname', }, {attr_name => 'basename', diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 1c50f3b5b..20a771fbe 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -1346,16 +1346,16 @@ sub addkit } else { $rc = system("cp -rf $kitdir/other_files/$_ $installdir/postscripts/"); } + if($rc && !-e "$installdir/postscripts/$_"){ + my %rsp; + push@{ $rsp{data} }, "Failed to copy scripts from $kitdir/scripts/ to $installdir/postscripts"; + xCAT::MsgUtils->message( "E", \%rsp, $callback ); + return 1; + } + $rc = 0; chmod(0755,"$installdir/postscripts/$_"); } - if($rc){ - my %rsp; - push@{ $rsp{data} }, "Failed to copy scripts from $kitdir/scripts/ to $installdir/postscripts"; - xCAT::MsgUtils->message( "E", \%rsp, $callback ); - return 1; - } - # Copying plugins to /opt/xcat/lib/perl/xCAT_plugin/ if ( -d "$kitdir/plugins/" ) { @@ -2748,9 +2748,13 @@ sub rmkitcomp my %newosikitcomponents; foreach my $allosikitcomp (@allosikitcomps) { if ( $allosikitcomp->{kitcomponents} and $allosikitcomp->{imagename} ) { + (my $allosiotherpkgdir) = $tabs{linuximage}->getAttribs({imagename=> $allosikitcomp->{imagename}}, 'otherpkgdir'); + my @allkitcomps = split /,/, $allosikitcomp->{kitcomponents}; foreach my $allkitcomp ( @allkitcomps ) { - if ( $allosikitcomp->{imagename} ne $osimage or $allkitcomp ne $kitcomponent ) { + if ( (($allosikitcomp->{imagename} ne $osimage) and + ($allosiotherpkgdir->{otherpkgdir} eq $otherpkgdir)) + or ($allkitcomp ne $kitcomponent) ) { $newosikitcomponents{$allkitcomp} = 1; } } diff --git a/xCAT-server/lib/xcat/plugins/kmodules.pm b/xCAT-server/lib/xcat/plugins/kmodules.pm index 1801c87a9..9f22a645e 100644 --- a/xCAT-server/lib/xcat/plugins/kmodules.pm +++ b/xCAT-server/lib/xcat/plugins/kmodules.pm @@ -462,7 +462,7 @@ sub set_sources { my @kernel_rpms = (); if ($ou_entry->{'basename'} =~ /^ubuntu/) { - @kernel_rpms = `find $dirpath/pool/main/l/linux/ -name *.deb`; + @kernel_rpms = `find $dirpath/pool/main/l/linux/ -name *deb`; } else { @@ -511,7 +511,7 @@ sub set_sources { my @kernel_rpms = (); if ($od_entry->{'basename'} =~ /ubuntu/) { - @kernel_rpms = `find $dirpath/pool/main/l/linux/ -name *.deb`; + @kernel_rpms = `find $dirpath/pool/main/l/linux/ -name *deb`; } else { @@ -532,7 +532,7 @@ sub set_sources { my @kernel_rpms = (); if ($od_entry->{'basename'} =~ /ubuntu/) { - @kernel_rpms = `find $dirpath/pool/main/l/linux/ -name *.deb`; + @kernel_rpms = `find $dirpath/pool/main/l/linux/ -name *deb`; } else { 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-server/share/xcat/install/scripts/post.rhels7 b/xCAT-server/share/xcat/install/scripts/post.rhels7 index 5a15719d6..41127db68 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhels7 +++ b/xCAT-server/share/xcat/install/scripts/post.rhels7 @@ -6,4 +6,8 @@ do if ethtool $nicname|grep -E -i "Link detected.*yes" >/dev/null 2>&1 then sed -i 's/ONBOOT=no/ONBOOT=yes/' $i fi + + #remove the entry 'HWADDR' from ifcfg-ethx, this is used to skip the + #nic name change during the install and first_reboot + sed -i '/HWADDR/d' $i done diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.2.x86_64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.2.x86_64.pkglist new file mode 100644 index 000000000..0b69a32dc --- /dev/null +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.2.x86_64.pkglist @@ -0,0 +1,15 @@ +bash +nfs-common +openssl +isc-dhcp-client +libc-bin +linux-image-generic-lts-utopic +openssh-server +openssh-client +wget +vim +ntp +rsync +busybox-static +gawk +dnsutils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 7dc708701..4edff6ac0 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -280,15 +280,11 @@ unless ($onlyinitrd) { my @line=split(" ",`ls -lh $installroot/$osver/$arch/dists/ | grep dr`); my $dist = $line[@line-1]; -# my $aptgetcmd = "chroot $rootimg_dir apt-get update && chroot $rootimg_dir apt-get $non_interactive "; - - # If there is env in otherpkg list - # apt-get update and apt-get install should be added env param - my $aptgetcmd = "chroot $rootimg_dir apt-get update"; - my $aptgetcmdby="chroot $rootimg_dir apt-get $non_interactive "; - - - my $aptcachecmd = "chroot $rootimg_dir apt-get update && chroot $rootimg_dir apt-cache $non_interactive "; + # If there is env in otherpkg list + # apt-get update and apt-get install should be added env param + my $aptgetcmd = "DEBIAN_FRONTEND=noninteractive chroot $rootimg_dir apt-get update"; + my $aptgetcmdby = "DEBIAN_FRONTEND=noninteractive chroot $rootimg_dir apt-get $non_interactive "; + my $aptcachecmd = "DEBIAN_FRONTEND=noninteractive chroot $rootimg_dir apt-get update && chroot $rootimg_dir apt-cache $non_interactive "; my $aptcmd1 = "debootstrap"; #my $aptcmd2 = "--arch $uarch $dist $rootimg_dir file://$installroot/$osver/$arch/"; my $aptcmd2; @@ -320,6 +316,10 @@ unless ($onlyinitrd) { print "Error: cannnot create bootstraps for rootimage. Make sure you specified full http mirror path.\n"; exit 1; } + + # Since kernel-image package needs the /proc/cpuinfo file to validate the cpu type, + # copy the /proc/cpuinfo from host node + copy("/proc/cpuinfo", "$rootimg_dir/proc/cpuinfo"); # Prepare the installation mirror for the package install print("Mount /proc, /dev, /sys, pkgdir and otherpkgdir to the rootimg.\n"); @@ -580,6 +580,31 @@ unless ($onlyinitrd) { postscripts(); #run 'postscripts' } +#-- run postinstall script +unless ($imagename) { + $postinstall_filename= imgutils::get_profile_def_filename($osver, $profile, $arch, $customdir, "postinstall"); + unless ($postinstall_filename) { + $postinstall_filename= imgutils::get_profile_def_filename($osver, $profile, $arch, $pathtofiles, "postinstall"); + } +} + +if ( $postinstall_filename ) { + + $updates{'postinstall'} = $postinstall_filename if ($tempfile); + + foreach my $postinstall ( split /,/, $postinstall_filename ) { + if ( !-x $postinstall ) { + print "postinstall script $postinstall is not executable\n"; + exit 1; + } + my $rc = system($postinstall, $rootimg_dir,$osver,$arch,$profile); + if($rc) { + print "postinstall script $postinstall failed\n"; + exit 1; + } + } +} + # Default to the first kernel found in the install image if nothing specified explicitly. # A more accurate guess than whatever the image build server happens to be running # If specified, that takes precedence. @@ -664,31 +689,6 @@ if (-d "$rootimg_dir/usr/share/dracut") { print "Enter the dracut mode. Dracut version: $dracutver. Dracut directory: $dracutdir.\n"; } -#-- run postinstall script -unless ($imagename) { - $postinstall_filename= imgutils::get_profile_def_filename($osver, $profile, $arch, $customdir, "postinstall"); - unless ($postinstall_filename) { - $postinstall_filename= imgutils::get_profile_def_filename($osver, $profile, $arch, $pathtofiles, "postinstall"); - } -} - -if ( $postinstall_filename ) { - - $updates{'postinstall'} = $postinstall_filename if ($tempfile); - - foreach my $postinstall ( split /,/, $postinstall_filename ) { - if ( !-x $postinstall ) { - print "postinstall script $postinstall is not executable\n"; - exit 1; - } - my $rc = system($postinstall, $rootimg_dir,$osver,$arch,$profile); - if($rc) { - print "postinstall script $postinstall failed\n"; - exit 1; - } - } -} - # all the attributes have been gathered # now, update the linuximage and osimage tables # TODO: do statelite and stateless share the same attributes? diff --git a/xCAT-server/share/xcat/tools/xCATreg b/xCAT-server/share/xcat/tools/xCATreg index f9284e78b..78a8d1589 100644 --- a/xCAT-server/share/xcat/tools/xCATreg +++ b/xCAT-server/share/xcat/tools/xCATreg @@ -165,7 +165,7 @@ sub xCATreg_init{ #init important attributes - $date = `date +"%Y%m%d"`; + $date = `date +"%Y%m%d"`; chomp($date); &runcmd("mkdir -p $logfiledir") if(! -e $logfiledir); @@ -1031,29 +1031,13 @@ sub git_update{ return 0; } -xCATreg_init(); - -############################################################### -# Mainfunction -############################################################### -send_msg(2,"........................"); -send_msg(2,"........................"); -send_msg(2,".....ooooO.............."); -send_msg(2,"....(....)....Ooooo....."); -send_msg(2,".....\\..(.....(....)...."); -send_msg(2,"......\\__).....)../....."); -send_msg(2,"..............(_ /......"); -send_msg(2,"........................"); -send_msg(2,".........START ........."); -send_msg(2,"........................"); - ####################################### # step 0. Parse input arguments ####################################### send_msg(2, "step 1, Parse input arguments............"); =pod if ( - !GetOptions("h|?" => \$needhelp, + !GetOptions("--help|h|?" => \$needhelp, "f=s" => \$configfile, "b=s" => \$branch, "m=s" => \$management_node, @@ -1063,7 +1047,7 @@ if ( ) =cut if ( - !GetOptions("h|?" => \$needhelp, + !GetOptions("--help|h|?" => \$needhelp, "f=s" => \$configfile, "b=s" => \$branch, "m=s" => \$management_node, @@ -1081,6 +1065,22 @@ if ($needhelp) exit 0; } + +xCATreg_init(); + +############################################################### +# Mainfunction +############################################################### +send_msg(2,"........................"); +send_msg(2,"........................"); +send_msg(2,".....ooooO.............."); +send_msg(2,"....(....)....Ooooo....."); +send_msg(2,".....\\..(.....(....)...."); +send_msg(2,"......\\__).....)../....."); +send_msg(2,"..............(_ /......"); +send_msg(2,"........................"); +send_msg(2,".........START ........."); +send_msg(2,"........................"); ####################################### # step 1. Read configuration files ####################################### diff --git a/xCAT-vlan/xCAT-vlan.spec b/xCAT-vlan/xCAT-vlan.spec index 82d174541..25bef6228 100755 --- a/xCAT-vlan/xCAT-vlan.spec +++ b/xCAT-vlan/xCAT-vlan.spec @@ -68,8 +68,6 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/rmvlan ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lsvlan ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/chvlanports -set -x - %clean # This step does not happen until *after* the %files packaging below 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 diff --git a/xCAT/postscripts/confignics b/xCAT/postscripts/confignics index 6be53a5f4..7122d7749 100755 --- a/xCAT/postscripts/confignics +++ b/xCAT/postscripts/confignics @@ -217,6 +217,8 @@ fi splitconfig "$NICIPS" splitconfig "$NICCUSTOMSCRIPTS" + + if [ $boot_myscript -eq 1 ];then . $str_dir_name/$myscript if [ $? -ne 0 ];then @@ -273,9 +275,11 @@ if [ $bool_remove -eq 1 ];then configeth -r $str_temp_nic done fi - old_ifs=$IFS IFS=$' ' +if [ $bool_cfg_inst_nic -eq 1 ];then + str_all_nics=$str_all_nics" "$str_inst_nic +fi array_nics_temp=($str_all_nics) IFS=$old_ifs for key in ${array_nics_temp[@]} @@ -341,7 +345,6 @@ do fi fi done - if [ -n "$str_ib_nics" ];then logger -t xcat -p local4.info "confignics: executed script: configib for nics: $str_ib_nics, ports: $num_iba_ports" echo "confignics on $NODE: executed script: configib for nics: $str_ib_nics, ports: $num_iba_ports"