From e15a6563a0787ff8df597be74d965f368508a62b Mon Sep 17 00:00:00 2001 From: linggao Date: Thu, 5 Nov 2009 23:08:07 +0000 Subject: [PATCH] added useNmapfromMN in the site table for nodestat command git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4493 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Schema.pm | 1 + xCAT-server/lib/xcat/plugins/nodestat.pm | 14 ++++++++++++-- xCAT-server/sbin/xcatconfig | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 3a0df6a8c..48b0e3818 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -595,6 +595,7 @@ site => { " SNsyncfiledir:\tThe directory on the Service Node, where xdcp will copy the files from the MN that will eventually be copied to the compute nodes. Default is /var/xcat/syncfiles.\n\n". " snmpc:\tThe snmp community string that xcat should use when communicating with the switches.\n\n". " svloglocal:\tsyslog on the service node does not get forwarded to the mgmt node - default is 0.\n\n". + " useNmapfromMN:\tWhen set to yes, nodestat command should obtain the node status using nmap (if available) from the management node instead of the service node. This will improve the performance in a flat network. Default is no.\n\n". " xcatconfdir:\t(default /etc/xcat)\n\n". " xcatdport:\tThe port used by the xcatd daemon for client/server communication. Default is 3001.\n\n". " xcatiport:\tThe port used by xcatd to receive install status updates from nodes. Default is 3002.\n\n". diff --git a/xCAT-server/lib/xcat/plugins/nodestat.pm b/xCAT-server/lib/xcat/plugins/nodestat.pm index 83779d546..2d0971840 100644 --- a/xCAT-server/lib/xcat/plugins/nodestat.pm +++ b/xCAT-server/lib/xcat/plugins/nodestat.pm @@ -85,8 +85,18 @@ sub preprocess_request my $service = "xcat"; my @requests; if ($nodes){ - if (-x '/usr/bin/nmap' or -x '/usr/local/bin/nmap') { - return [$req]; #For now, do not distribute, nodestat seems to lose accuracy and slow down distributed, if using nmap + if (-x '/usr/bin/nmap' or -x '/usr/local/bin/nmap') { + my $usenmapfrommn=0; + my $sitetab = xCAT::Table->new('site'); + if ($sitetab) { + (my $ref) = $sitetab->getAttribs({key => 'useNmapfromMN'}, 'value'); + if ($ref) { + if ($ref->{value} =~ /1|yes|YES|Y|y/) { $usenmapfrommn=1; } + } + } + if ($usenmapfrommn) { + return [$req]; #do not distribute, nodestat seems to lose accuracy and slow down distributed, if using nmap + } } # find service nodes for requested nodes # build an individual request for each service node diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 60468d27d..16cdf818c 100644 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -865,6 +865,8 @@ sub initDB $chtabcmds .= "$::XCATROOT/sbin/chtab key=xcatconfdir site.value=$confdir;"; $chtabcmds .= "$::XCATROOT/sbin/chtab key=timezone site.value=$timezone;"; + $chtabcmds .= + "$::XCATROOT/sbin/chtab key=useNmapfromMN site.value=no;"; if ($::osname eq 'AIX') {