From fc6473772739303e5611cacd8213eacd611c17dc Mon Sep 17 00:00:00 2001 From: John Simpson Date: Mon, 28 Oct 2013 15:48:43 -0400 Subject: [PATCH 01/11] configfpc updated to exit when a MAC address cannot be resolved to an FPC node definition --- xCAT-server/lib/xcat/plugins/configfpc.pm | 31 +++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/configfpc.pm b/xCAT-server/lib/xcat/plugins/configfpc.pm index e74f78d7d..de1ed3692 100644 --- a/xCAT-server/lib/xcat/plugins/configfpc.pm +++ b/xCAT-server/lib/xcat/plugins/configfpc.pm @@ -43,7 +43,6 @@ sub process_request { 'help|h|?' => \$::opt_h, 'i|I=s' => \$::opt_I, 'verbose|V' => \$::opt_V, - 'version|v' => \$::opt_v, ); # Option -h for Help @@ -94,9 +93,9 @@ sub configfpc_usage { push @{ $rsp->{data} }, "\nUsage: configfpc - Configure the NeXtScale FPCs.i This command requires the -i option to give specify which network adapter to use to look for the FPCs.\n"; push @{ $rsp->{data} }, - " configfpc -i interface_adapter \n "; + " configfpc -i interface \n "; push @{ $rsp->{data} }, - " configfpc [-V|--verbose] -i adapter_interface \n "; + " configfpc [-V|--verbose] -i interface \n "; push @{ $rsp->{data} }, " configfpc [-h|--help|-?] \n"; xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); return 0; @@ -218,7 +217,8 @@ sub configfpc { } else { my %rsp; push@{ $rsp{data} }, "No FPC found that is associated with MAC address $fpcmac.\nCheck to see if the switch and switch table contain the information needed to locate this FPC MAC"; - xCAT::MsgUtils->message( "I", \%rsp, $callback ); + xCAT::MsgUtils->message( "E", \%rsp, $callback ); + $foundfpc = 0; } # @@ -231,16 +231,19 @@ sub configfpc { } my $arpout = `arp -d $fpcip`; - # check for another FPC - $res = `LANG=C ping -c 1 -w 5 $fpcip 2>&1`; - if ( $res =~ /100% packet loss/g) { - my %rsp; - push@{ $rsp{data} }, "There are no more FPCs with the default IP address to process"; - xCAT::MsgUtils->message( "I", \%rsp, $callback ); - $foundfpc = 0; - } - else { - $foundfpc = 1; + if ( ($foundfpc==1) ) { # if the last FPC was found and processed + + # check for another FPC + $res = `LANG=C ping -c 1 -w 5 $fpcip 2>&1`; + if ( ($res =~ /100% packet loss/g) && ($foundfpc==1) ) { + my %rsp; + push@{ $rsp{data} }, "There are no more FPCs with the default IP address to process"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + $foundfpc = 0; + } + else { + $foundfpc = 1; + } } } From 7e1b001ea4a827740602d9e47e901a2f4297a34c Mon Sep 17 00:00:00 2001 From: John Simpson Date: Mon, 28 Oct 2013 16:00:56 -0400 Subject: [PATCH 02/11] configfpc updated to exit when a MAC address cannot be resolved to an FPC node definition --- xCAT-server/lib/xcat/plugins/configfpc.pm | 31 ++++++++++------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/configfpc.pm b/xCAT-server/lib/xcat/plugins/configfpc.pm index de1ed3692..e74f78d7d 100644 --- a/xCAT-server/lib/xcat/plugins/configfpc.pm +++ b/xCAT-server/lib/xcat/plugins/configfpc.pm @@ -43,6 +43,7 @@ sub process_request { 'help|h|?' => \$::opt_h, 'i|I=s' => \$::opt_I, 'verbose|V' => \$::opt_V, + 'version|v' => \$::opt_v, ); # Option -h for Help @@ -93,9 +94,9 @@ sub configfpc_usage { push @{ $rsp->{data} }, "\nUsage: configfpc - Configure the NeXtScale FPCs.i This command requires the -i option to give specify which network adapter to use to look for the FPCs.\n"; push @{ $rsp->{data} }, - " configfpc -i interface \n "; + " configfpc -i interface_adapter \n "; push @{ $rsp->{data} }, - " configfpc [-V|--verbose] -i interface \n "; + " configfpc [-V|--verbose] -i adapter_interface \n "; push @{ $rsp->{data} }, " configfpc [-h|--help|-?] \n"; xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); return 0; @@ -217,8 +218,7 @@ sub configfpc { } else { my %rsp; push@{ $rsp{data} }, "No FPC found that is associated with MAC address $fpcmac.\nCheck to see if the switch and switch table contain the information needed to locate this FPC MAC"; - xCAT::MsgUtils->message( "E", \%rsp, $callback ); - $foundfpc = 0; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); } # @@ -231,19 +231,16 @@ sub configfpc { } my $arpout = `arp -d $fpcip`; - if ( ($foundfpc==1) ) { # if the last FPC was found and processed - - # check for another FPC - $res = `LANG=C ping -c 1 -w 5 $fpcip 2>&1`; - if ( ($res =~ /100% packet loss/g) && ($foundfpc==1) ) { - my %rsp; - push@{ $rsp{data} }, "There are no more FPCs with the default IP address to process"; - xCAT::MsgUtils->message( "I", \%rsp, $callback ); - $foundfpc = 0; - } - else { - $foundfpc = 1; - } + # check for another FPC + $res = `LANG=C ping -c 1 -w 5 $fpcip 2>&1`; + if ( $res =~ /100% packet loss/g) { + my %rsp; + push@{ $rsp{data} }, "There are no more FPCs with the default IP address to process"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + $foundfpc = 0; + } + else { + $foundfpc = 1; } } From 4366fd508a7f5b2586fdc1eef3016da27c244bd9 Mon Sep 17 00:00:00 2001 From: John Simpson Date: Mon, 28 Oct 2013 16:14:27 -0400 Subject: [PATCH 03/11] update to configfpc to add support for verbose and -i option and a ping verification --- xCAT-server/lib/xcat/plugins/configfpc.pm | 31 +++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/configfpc.pm b/xCAT-server/lib/xcat/plugins/configfpc.pm index e74f78d7d..de1ed3692 100644 --- a/xCAT-server/lib/xcat/plugins/configfpc.pm +++ b/xCAT-server/lib/xcat/plugins/configfpc.pm @@ -43,7 +43,6 @@ sub process_request { 'help|h|?' => \$::opt_h, 'i|I=s' => \$::opt_I, 'verbose|V' => \$::opt_V, - 'version|v' => \$::opt_v, ); # Option -h for Help @@ -94,9 +93,9 @@ sub configfpc_usage { push @{ $rsp->{data} }, "\nUsage: configfpc - Configure the NeXtScale FPCs.i This command requires the -i option to give specify which network adapter to use to look for the FPCs.\n"; push @{ $rsp->{data} }, - " configfpc -i interface_adapter \n "; + " configfpc -i interface \n "; push @{ $rsp->{data} }, - " configfpc [-V|--verbose] -i adapter_interface \n "; + " configfpc [-V|--verbose] -i interface \n "; push @{ $rsp->{data} }, " configfpc [-h|--help|-?] \n"; xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); return 0; @@ -218,7 +217,8 @@ sub configfpc { } else { my %rsp; push@{ $rsp{data} }, "No FPC found that is associated with MAC address $fpcmac.\nCheck to see if the switch and switch table contain the information needed to locate this FPC MAC"; - xCAT::MsgUtils->message( "I", \%rsp, $callback ); + xCAT::MsgUtils->message( "E", \%rsp, $callback ); + $foundfpc = 0; } # @@ -231,16 +231,19 @@ sub configfpc { } my $arpout = `arp -d $fpcip`; - # check for another FPC - $res = `LANG=C ping -c 1 -w 5 $fpcip 2>&1`; - if ( $res =~ /100% packet loss/g) { - my %rsp; - push@{ $rsp{data} }, "There are no more FPCs with the default IP address to process"; - xCAT::MsgUtils->message( "I", \%rsp, $callback ); - $foundfpc = 0; - } - else { - $foundfpc = 1; + if ( ($foundfpc==1) ) { # if the last FPC was found and processed + + # check for another FPC + $res = `LANG=C ping -c 1 -w 5 $fpcip 2>&1`; + if ( ($res =~ /100% packet loss/g) && ($foundfpc==1) ) { + my %rsp; + push@{ $rsp{data} }, "There are no more FPCs with the default IP address to process"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + $foundfpc = 0; + } + else { + $foundfpc = 1; + } } } From 1dfb366a1b4c2ec17d4bf48ab1db04160e394eb8 Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 29 Oct 2013 10:46:17 +0800 Subject: [PATCH 04/11] temp fix for bug 3792: multiple nics in the same subnet, use the first nic that in the subnet for dhcp --- xCAT-server/lib/xcat/plugins/dhcp.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) mode change 100644 => 100755 xCAT-server/lib/xcat/plugins/dhcp.pm diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm old mode 100644 new mode 100755 index 28a14490f..fb73800d4 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1927,6 +1927,11 @@ sub addnet if ($ent[0] eq $net and $ent[2] eq $mask) { $nic = $ent[1]; + # The first nic that matches the network, + # what will happen if there are more than one nics in the same subnet, + # and we want to use the second nic as the dhcp interfaces? + # this is a TODO + last; } } #print " add $net $mask under $nic\n"; @@ -1943,6 +1948,13 @@ sub addnet } unless ($dhcpconf[$idx] =~ /\} # $nic nic_end\n/) { + $callback->( + { + error => + ["Could not add the subnet $net/$mask for nic $nic into $dhcpconffile."], + errorcode => [1] + } + ); return 1; #TODO: this is an error condition } } From a4ec5d2e92a916801896f53cef22eaaf8e433375 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 29 Oct 2013 11:07:02 -0400 Subject: [PATCH 05/11] 3865,3864 --- xCAT-server/sbin/xcatsnap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/sbin/xcatsnap b/xCAT-server/sbin/xcatsnap index 500f62b06..64f8b07de 100755 --- a/xCAT-server/sbin/xcatsnap +++ b/xCAT-server/sbin/xcatsnap @@ -102,7 +102,7 @@ sub run_cmd { print "\n\tExecuting: $Command \n"; eval { local $SIG{ALRM} = sub { die "Timeout\n" }; - alarm 60; + alarm 600; @output = `$Command`; alarm 0; }; @@ -238,7 +238,7 @@ sub snap_it { "ls $installdir","/usr/bin/crontab -l", "find /tftpboot -size -32k","ls -lR $xcatroot", "arp -a","ps -edlf","ps -aux","ulimit -a","df -k", - "cat /etc/issue","lsxcatd -a"); + "cat /etc/issue","lsxcatd -a","cat /proc/meminfo", "cat /proc/cpuinfo"); } foreach my $item (@Commands_array) { $Command = $item; From e3c48f5dbda4228b02b99e9e2e0e70871ad893aa Mon Sep 17 00:00:00 2001 From: jwsimpson Date: Tue, 4 Jun 2013 12:29:22 +0000 Subject: [PATCH 06/11] adding check for -n to 2.8.3 --- xCAT-server/lib/xcat/plugins/dhcp.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index fb73800d4..2f870b7b4 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -868,6 +868,14 @@ sub check_options return 1; } + # check to see if -n is listed with any other options which is not allowed + if ($::opt_n and ($::opt_a || $::opt_d || $::opt_q || $::opt_r || $::opt_l || $statements)) { + my $rsp = {}; + $rsp->{data}->[0] = "The -n option cannot be used with other options."; + xCAT::MsgUtils->message("E", $rsp, $callback, 1); + return 1; + } + unless (($req->{arg} and (@{$req->{arg}}>0)) or $req->{node}) { my $rsp = {}; From e52d129d3063c8b26e9f49bfd81892f3c72f3e21 Mon Sep 17 00:00:00 2001 From: nott Date: Tue, 29 Oct 2013 14:42:24 -0400 Subject: [PATCH 07/11] buildkit fixes 3845, 3855, 3857 --- xCAT-buildkit/bin/buildkit | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 02ca942cb..e717029f6 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -949,9 +949,14 @@ sub kit_buildtar my $tarfile = $::deploy_dir."/".$kitfilename; - if ( system("cd $::deploy_dir; cd ..; cp -r build_input $kitname" ) ) { - print "Error: Could not copy building tarfile $tarfile \n"; - return 1; + my $dir = dirname($::deploy_dir); + my $bidir = "$dir/build_input"; + + if ( -d "$bidir") { + if ( system("cd $::deploy_dir; cd ..; cp -r build_input $kitname" ) ) { + print "Error: Could not copy building tarfile $tarfile \n"; + return 1; + } } print "Creating tar file $tarfile.\n"; @@ -1940,9 +1945,10 @@ sub build_kitcomp my $specfile = $::workdir."/tmp/$comp->{kitcompname}-prep.spec"; my $rpmbuild_cmd = "rpmbuild --define \"_topdir $rpmbuild_dir\" -ba $specfile"; - if (!$::VERBOSE) { + # don't want debug info - 3845 +# if (!$::VERBOSE) { $rpmbuild_cmd .= ' --quiet '; - } +# } if ( system($rpmbuild_cmd) ) { print "Error running rpmbuild command for kit component $comp->{kitcompname} meta package\n"; return 1; @@ -1955,7 +1961,7 @@ sub build_kitcomp return 1; } } - + $::VALID_PRER_COMPONENT = 1; } @@ -2012,9 +2018,12 @@ sub build_kitcomp return 1; } } - if (!$::VERBOSE) { + + # - don't want debug info - 3845 +# if (!$::VERBOSE) { $rpmbuild_cmd .= ' --quiet '; - } +# } + if ( system($rpmbuild_cmd) ) { print "Error running rpmbuild command for kit component $comp->{kitcompname} meta package\n"; return 1; @@ -2056,7 +2065,7 @@ sub update_kitcomp_kitpkgdeps my $repodir = shift; if (defined($comp->{kitpkgdeps})) { - # we have some rpms listed -n buildkit.conf file + # we have some rpms listed in buildkit.conf file my $new_kitpkgdeps = ''; foreach my $d (split(/,/, $comp->{kitpkgdeps})) { $d =~ s/\s+//g; @@ -2073,7 +2082,6 @@ sub update_kitcomp_kitpkgdeps my @rpmlist = `$lscmd`; if ( scalar(@rpmlist) == 0) { - print "Error: Could not find rpm named $d in $repodir. \n"; next; } @@ -3542,6 +3550,7 @@ sub NEW_kit_addpkgs system ("rm -Rf $tmpdir_base"); return 1; } + my @fromfiles=@$files; foreach my $repo (split(/,/, $ext_reponames)) { From 250258dbb7ef237dafbc36f132d1dc4a8096a51b Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Wed, 30 Oct 2013 00:42:53 -0700 Subject: [PATCH 08/11] fixed bug 3867, --- xCAT-server/lib/xcat/plugins/kit.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 40d6e92d9..656367dde 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -1730,7 +1730,7 @@ sub validate_os{ return 1; } - if ( $osimage->{arch} ne $kitcomp->{osarch} ) { + if ( $osimage->{arch} ne $kitcomp->{osarch} && $kitcomp->{osarch} ne 'noarch' ) { # my %rsp; # push@{ $rsp{data} }, "osimage $os is not compatible with kit component $kitcomp->{kitcompname} with attribute arch"; # xCAT::MsgUtils->message( "E", \%rsp, $::CALLBACK ); @@ -2013,7 +2013,7 @@ sub addkitcomp return 1; } - if ( $os{$osimage}{arch} ne $kitcomps{$kitcomp}{osarch} ) { + if ( $os{$osimage}{arch} ne $kitcomps{$kitcomp}{osarch} && $kitcomps{$kitcomp}{osarch} ne 'noarch' ) { my %rsp; push@{ $rsp{data} }, "osimage $osimage is not compatible with kit component $kitcomp with attribute arch"; xCAT::MsgUtils->message( "E", \%rsp, $callback ); @@ -3328,7 +3328,7 @@ sub chkkitcomp return 1; } - if ( $os{$osimage}{arch} ne $kitcomps{$kitcomp}{osarch} ) { + if ( $os{$osimage}{arch} ne $kitcomps{$kitcomp}{osarch} && $kitcomps{$kitcomp}{osarch} ne 'noarch' ) { my %rsp; push@{ $rsp{data} }, "kit component $kitcomp is not compatible with osimage $osimage with attribute arch"; xCAT::MsgUtils->message( "E", \%rsp, $callback ); @@ -4516,7 +4516,7 @@ sub get_compat_kitreponames { if (defined($kitrepo->{osminorversion}) && $kitrepo->{osminorversion} ne $osdistro->{minorversion}) { next; } - if (defined($kitrepo->{osarch}) && $kitrepo->{osarch} ne $osdistro->{arch}) { + if (defined($kitrepo->{osarch}) && $kitrepo->{osarch} ne $osdistro->{arch} && $kitrepo->{osarch} ne 'noarch') { next; } From 564abe331c98b650145675678f58c696bca3a19f Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 30 Oct 2013 03:08:48 -0700 Subject: [PATCH 09/11] bug 3831: install ubuntu hang --- .../share/xcat/install/scripts/pre.ubuntu | 41 ------------------- .../share/xcat/install/ubuntu/compute.tmpl | 2 + .../share/xcat/install/ubuntu/kvm.tmpl | 2 + 3 files changed, 4 insertions(+), 41 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/pre.ubuntu b/xCAT-server/share/xcat/install/scripts/pre.ubuntu index f6c9efd44..ccc9b5a47 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/pre.ubuntu @@ -4,48 +4,7 @@ if [ ! -c /dev/vcs ]; then mknod /dev/vcs c 7 0 fi -while [ -z "$instdisk" ]; do -VIRTDISKS=`ls /dev/vd*|wc -l` -if [ $VIRTDISKS -gt 0 ]; then -for disk in /dev/vd*[^0-9]; do - if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort - #no edd_id in debian installer, no edd hints supported -done -fi -if [ -z "$firstdirectdisk" ]; then - SCSIDISKS=`ls /dev/sd*|wc -l` - if [ $SCSIDISKS -gt 0 ]; then - for disk in /dev/sd*[^0-9]; do - currdriver=`udevadm info --attribute-walk --name $disk |grep DRIVERS|grep -v '""'|grep -v '"sd"'|head -n 1|sed -e 's/[^"]*"//' -e 's/"//'` - case "$currdriver" in - "ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct - if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resor - ;; - "mptsas"|"mpt2sas") #*PROBABLY* not SAN, but SAS SAN is possible - if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi - ;; - *) # could be san or who knows what, use it as a last resort - if [ -z "$firstdisk" ]; then firstdisk=$disk; fi - ;; - esac - done - fi -fi -if [ -z "$instdisk" ]; then - if [ ! -z "$firstdirectdisk" ]; then - instdisk=$firstdirectdisk - elif [ ! -z "$probablyfirstdirectdisk" ]; then - instdisk=$probablyfirstdirectdisk - elif [ ! -z "$firstdisk" ]; then - instdisk=$firstdisk - fi -fi -if [ ! -z "$instdisk" ]; then debconf-set partman-auto/disk "$instdisk"; fi debconf-get open-iscsi/targets > /tmp/q -sleep 0.1 -done & - - cat >/tmp/foo.sh < Date: Wed, 30 Oct 2013 07:14:38 -0700 Subject: [PATCH 10/11] fix defect #3393 xcat 2.8 mgt server(rhels6.4-ppc64) hang on Generating /etc/rndc.key during reboot --- xCAT-server/sbin/xcatconfig | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 3106f2b90..117e19caa 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -1051,6 +1051,20 @@ sub is_debian return 0; } +sub is_redhat6sp4 +{ + if( -e "/etc/redhat-release" ){ + open(my $relfile, "<", "/etc/redhat-release"); + my $line = <$relfile>; + close($relfile); + if ( $line =~ /Red Hat Enterprise Linux Server release 6.4/i ){ + return 1; + } + } + return 0; +} + + # on Ubuntu need to painstakingly compare /etc/localtime with files under # /usr/share/zoneinfo since /etc/localtime # isn't always a symbolic link sub discover_timezone_ubuntu @@ -2233,6 +2247,13 @@ sub startnamedonboot $serv = "bind9"; $cmd = "update-rc.d $serv enable"; } + + #"service named start" is very slowly,sometimes hang in rhels6.4 after installation + #a work around is to generate /etc/rndc-key during xCAT installation + if( is_redhat6sp4() ){ + system("rndc-confgen -a -r /dev/urandom"); + } + my $outref = xCAT::Utils->runcmd("$cmd", 0); if ($::RUNCMD_RC != 0) { From 3ca11580ae0a94d272c9a867afe68dfd6e6d69c0 Mon Sep 17 00:00:00 2001 From: John Simpson Date: Wed, 30 Oct 2013 16:03:41 -0400 Subject: [PATCH 11/11] added static arp setting and cleaned up some messages --- xCAT-server/lib/xcat/plugins/configfpc.pm | 29 +++++++++++++---------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/configfpc.pm b/xCAT-server/lib/xcat/plugins/configfpc.pm index de1ed3692..bddf8d625 100644 --- a/xCAT-server/lib/xcat/plugins/configfpc.pm +++ b/xCAT-server/lib/xcat/plugins/configfpc.pm @@ -139,7 +139,7 @@ sub configfpc { # Setup routing to 182.168.0.100 network if($::VERBOSE){ my %rsp = {}; - push@{ $rsp{data} }, "Adding route definition for $::interface and 192.168.0.101 network"; + push@{ $rsp{data} }, "Adding route definition for 192.168.0.101/16 to the $::interface network interface"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); } my $setroute = `ip addr add dev $::interface 192.168.0.101/16`; @@ -154,7 +154,7 @@ sub configfpc { $foundfpc = 0; my %rsp = {}; - push@{ $rsp{data} }, "No nodes Found FPC with $fpcip address"; + push@{ $rsp{data} }, "No default $fpcip IP addresses found"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); exit; # EXIT if we find no more default IP addresses on the network } @@ -162,14 +162,14 @@ sub configfpc { # xCAT::MsgUtils->message ("I", "Found $fpcip FPC IP addresses to process"); if($::VERBOSE){ my %rsp = {}; - push@{ $rsp{data} }, "Found FPC with $fpcip address"; + push@{ $rsp{data} }, "Found $fpcip address"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); } $foundfpc = 1; } - my $addnode = &add_node($defnode,$callback); + my $addnode = &add_node($defnode,$fpcip,$callback); # # Main loop - check to see if we found an FPC and continue to set the FPC infomration and look for the next one @@ -237,7 +237,7 @@ sub configfpc { $res = `LANG=C ping -c 1 -w 5 $fpcip 2>&1`; if ( ($res =~ /100% packet loss/g) && ($foundfpc==1) ) { my %rsp; - push@{ $rsp{data} }, "There are no more FPCs with the default IP address to process"; + push@{ $rsp{data} }, "There are no more default IP address to process"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); $foundfpc = 0; } @@ -253,7 +253,7 @@ sub configfpc { # Delete routing to 182.168.0.100 network if($::VERBOSE){ my %rsp = {}; - push@{ $rsp{data} }, "Deleting route definition for $::interface and 192.168.0.101 network"; + push@{ $rsp{data} }, "Deleting route definition for 192.168.0.101/16 on interface $::interface"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); } my $setroute = `ip addr del dev $::interface 192.168.0.101/16`; @@ -346,7 +346,7 @@ sub set_FPC_network_parms { # Set FPC Netmask if($::VERBOSE){ my %rsp = {}; - push@{ $rsp{data} }, "Use rspconfig to set the FPC netmask $netmask for node $defnode"; + push@{ $rsp{data} }, "Use rspconfig to set the FPC netmask $netmask"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); } my $netmaskout = xCAT::Utils->runxcmd( @@ -358,7 +358,7 @@ sub set_FPC_network_parms { $request, 0,1); if ($::RUNCMD_RC != 0) { my %rsp; - push@{ $rsp{data} }, "Could not change nemask $netmask on default FPC"; + push@{ $rsp{data} }, "Could not change nemask $netmask"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); $error++; } @@ -378,7 +378,7 @@ sub set_FPC_network_parms { $request, 0,1); if ($::RUNCMD_RC != 0) { my %rsp; - push@{ $rsp{data} }, "Could not change gateway $gateway on default FPC"; + push@{ $rsp{data} }, "Could not change gateway $gateway"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); $error++; } @@ -422,9 +422,12 @@ sub get_node { # extract the MAC address my ($junk1, $junk2, $junk3, $fpcmac, $junk4, $junk5, $junk6) = split(" ", $arpout); + # set the FPC MAC as static for the arp table + my $arpout = `arp -s $fpcip $fpcmac`; + # Print a message that this MAC has been found my %rsp; - push@{ $rsp{data} }, "Found FPC with default IP $fpcip and MAC $fpcmac"; + push@{ $rsp{data} }, "Found IP $fpcip and MAC $fpcmac"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); # Usee find_mac to 1) look for which switch port contains this MAC address @@ -435,7 +438,7 @@ sub get_node { # verbose if($::VERBOSE){ my %rsp = {}; - push@{ $rsp{data} }, "Found FPC with MAC $fpcmac associated with node $node"; + push@{ $rsp{data} }, "Found IP $fpcip with MAC $fpcmac associated with node $node"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); } @@ -447,6 +450,7 @@ sub get_node { # sub add_node { my $defnode = shift; + my $fpcip = shift; my $callback = shift; # add this node entry # Object name: feihu-fpc @@ -469,8 +473,7 @@ sub add_node { my $nodehmtab = xCAT::Table->new('nodehm',-create=>1); $nodehmtab->setNodeAttribs($defnode, {mgt => 'ipmi'}); my $ipmitab = xCAT::Table->new('ipmi',-create=>1); - $ipmitab->setNodeAttribs($defnode, {bmc => $defnode, username => 'USERID', password => 'PASSW0RD'}); - + $ipmitab->setNodeAttribs($defnode, {bmc => $fpcip, username => 'USERID', password => 'PASSW0RD'}); return 0; }