From e2055a82517e9309af62b05a4983a4517a39e90b Mon Sep 17 00:00:00 2001 From: xq2005 Date: Mon, 13 May 2013 08:11:11 +0000 Subject: [PATCH] sync from the trunk for hardware discovery on debian/ubuntu git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16251 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/blade.pm | 8 +++++++- xCAT-server/lib/xcat/plugins/hpblade.pm | 8 +++++++- xCAT-server/lib/xcat/plugins/profilednodes.pm | 9 ++++++++- xCAT-server/lib/xcat/plugins/seqdiscovery.pm | 8 +++++++- xCAT-server/lib/xcat/plugins/switch.pm | 8 +++++++- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 1c0fa396c..0a3cb6dda 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -4296,7 +4296,13 @@ sub process_request { $invreq{command} = ['rinv']; my $mac; my $ip = $request->{'_xcat_clientip'}; - my $arptable = `/sbin/arp -n`; + my $arptable; + if ( -x "/usr/sbin/arp" ) { + $arptable = `/usr/sbin/arp -n`; + } + else{ + $arptable = `/sbin/arp -n`; + } my @arpents = split /\n/,$arptable; foreach (@arpents) { if (m/^($ip)\s+\S+\s+(\S+)\s/) { diff --git a/xCAT-server/lib/xcat/plugins/hpblade.pm b/xCAT-server/lib/xcat/plugins/hpblade.pm index 2f7b2c7e5..1322d2708 100755 --- a/xCAT-server/lib/xcat/plugins/hpblade.pm +++ b/xCAT-server/lib/xcat/plugins/hpblade.pm @@ -689,7 +689,13 @@ sub process_request { $invreq{command} = ['rinv']; my $mac; my $ip = $request->{'_xcat_clientip'}; - my $arptable = `/sbin/arp -n`; + my $arptable; + if ( -x "/usr/sbin/arp") { + $arptable = `/usr/sbin/arp -n`; + } + else{ + $arptable = `/sbin/arp -n`; + } my @arpents = split /\n/,$arptable; foreach (@arpents) { if (m/^($ip)\s+\S+\s+(\S+)\s/) { diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index da8fc7313..fa5ee2d47 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -37,6 +37,7 @@ my %allnicips; my %allracks; my %allchassis; my %allswitches; + # The array of all chassis which is special CMM my %allcmmchassis; my %allothernics; @@ -1436,7 +1437,13 @@ sub findme{ my $ip = $request->{'_xcat_clientip'}; xCAT::MsgUtils->message('S', "Profield nodes discover: _xcat_clientip is $ip.\n"); my $mac = ''; - my $arptable = `/sbin/arp -n`; + my $arptable; + if ( -x "/usr/sbin/arp" ){ + $arptable = `/usr/sbin/arp -n`; + } + else { + $arptable = `/sbin/arp -n`; + } my @arpents = split /\n/,$arptable; foreach (@arpents) { if (m/^($ip)\s+\S+\s+(\S+)\s/) { diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index 08052a707..7cc1a407b 100644 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -71,7 +71,13 @@ sub findme { if (defined $request->{nodetype} and $request->{nodetype}->[0] eq 'virtual') { return; } - my $arptable = `/sbin/arp -n`; + my $arptable; + if ( -x "/usr/sbin/arp") { + $arptable = `/usr/sbin/arp -n`; + } + else{ + $arptable = `/sbin/arp -n`; + } my @arpents = split /\n/,$arptable; foreach (@arpents) { if (m/^($ip)\s+\S+\s+(\S+)\s/) { diff --git a/xCAT-server/lib/xcat/plugins/switch.pm b/xCAT-server/lib/xcat/plugins/switch.pm index 3ae9ef45d..29b00a4bc 100644 --- a/xCAT-server/lib/xcat/plugins/switch.pm +++ b/xCAT-server/lib/xcat/plugins/switch.pm @@ -130,7 +130,13 @@ sub process_request { #discovery working. Food for thought. return; } - my $arptable = `/sbin/arp -n`; + my $arptable; + if ( -x "/usr/sbin/arp") { + $arptable = `/usr/sbin/arp -n`; + } + else{ + $arptable = `/sbin/arp -n`; + } my @arpents = split /\n/,$arptable; foreach (@arpents) { if (m/^($ip)\s+\S+\s+(\S+)\s/) {