# $Id$ # # Copyright (C) 2007 Platform Computing Inc # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # import sys import subprocess from kusu.genconfig import Report class thisReport(Report): def toolHelp(self): """toolHelp - This method provides the help screen for this particular plugin. All plugins must implement this method.""" print self.gettext("genconfig_Limits_Help") def getTotalMem(self): """ Gets memory available from system. This method is not used right now """ p = subprocess.Popen("cat /proc/meminfo | grep 'MemTotal:' | awk '{ print $2 }'", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() if not out: raise Exception, "Cannot find total memory size in system." total_mem = out.strip() return long(total_mem) def runPlugin(self, pluginargs): """runPlugin - This method provides the database report for this plugin. All plugins must implement this method. This plugin will generate the /etc/security/limits.conf file contents.""" print "# " print "# Dynamically generated by: genconfig (Do not edit!)" print "# " print "# Changes needed in this file should be made in the" print "# limits_conf.py plugin." print "" print "# Allow any user to lock up to all memory in the system (for OFED purposes)." print "* soft memlock 2000000" print "* hard memlock 2000000"