cluster: RHEL510 - rgmanager: Update SAPInstance agent resource limits

Ryan McCabe rmccabe at fedoraproject.org
Tue Apr 16 14:36:18 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=07766f691733c71344a703eff31636fac3ca1d30
Commit:        07766f691733c71344a703eff31636fac3ca1d30
Parent:        8ebfc023495b1010e6802ab1be6fb11790f35494
Author:        Chris Feist <cfeist at redhat.com>
AuthorDate:    Fri Dec 7 13:37:57 2012 -0600
Committer:     Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Tue Apr 16 10:35:09 2013 -0400

rgmanager: Update SAPInstance agent resource limits

Update the rgmanager SAPInstance agent so resource limits configured in
/usr/sap/services are properly applied.

This is commit f6a961f28ba5dd321dd069c9b621f89a3481894e
from resource-agents.git

Resolves: rhbz#869705

Signed-off-by: Ryan McCabe <rmccabe at redhat.com>
---
 rgmanager/src/resources/SAPInstance |   38 +++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/rgmanager/src/resources/SAPInstance b/rgmanager/src/resources/SAPInstance
index 802d3c0..fbfb7d7 100644
--- a/rgmanager/src/resources/SAPInstance
+++ b/rgmanager/src/resources/SAPInstance
@@ -162,6 +162,40 @@ sapinstance_methods() {
 	!
 }
 
+#
+# setup_limits: If sapstartsrv needs to be started by this resource agent we need to ensure that any resource
+#               limits configured in /usr/sap/sapservices are applied.
+#               Since sapstartsrv is started as root and then it downgrades its privileges by calling setuid() and
+#               setgid() any PAM limits at /etc/security/limits.conf are not applied.
+#               Should sapstartsrv need to be started, we look for values configured at /usr/sap/sapservices (as
+#               per SAP note 1437105) and, if found, we apply them before starting sapstartsrv.
+#               Instance processes are started by sapstartsrv and will inherit resource limits from it.
+#
+setup_limits() {
+  if [ -r $SAPSERVICES ]
+  then
+    descriptors=`grep "^limit.descriptors" $SAPSERVICES | sed -e "s/limit.descriptors=//" `
+    if [ -n $descriptors ]
+    then
+      ocf_log info "found valid open file descriptors limit at ${SAPSERVICES}: ${descriptors}, applying..."
+      eval ulimit -n $descriptors
+    fi
+
+    stacksize=`grep "^limit.stacksize" $SAPSERVICES | sed -e "s/limit.stacksize=//" `
+    if [ -n $stacksize ]
+    then
+      ocf_log info "found valid stack size limit at ${SAPSERVICES}: ${stacksize}, applying..."
+      eval ulimit -s $stacksize
+    fi
+
+    datasize=`grep "^limit.datasize" $SAPSERVICES | sed -e "s/limit.datasize=//" `
+    if [ -n $datasize ]
+    then
+      ocf_log info "found valid process data segment size limit at ${SAPSERVICES}: ${datasize}, applying..."
+      eval ulimit -d $datasize
+    fi
+  fi
+}
 
 #
 # check_sapstartsrv : Before using sapcontrol we make sure that the sapstartsrv is running for the correct instance.
@@ -192,6 +226,8 @@ check_sapstartsrv() {
   if [ $restart -eq 1 ]
   then
     pkill -9 -f "sapstartsrv.*$runninginst"
+  
+    setup_limits
     $SAPSTARTSRV pf=$SAPSTARTPROFILE -D -u $sidadm
 
     # now make sure the daemon has been started and is able to respond
@@ -571,6 +607,8 @@ if [ `echo $LD_LIBRARY_PATH | grep -c "^$DIR_EXECUTABLE\>"` -eq 0 ]; then
 fi
 sidadm="`echo $SID | tr '[:upper:]' '[:lower:]'`adm"
 
+SAPSERVICES=/usr/sap/sapservices
+
 # What kind of method was invoked?
 case "$1" in
 


More information about the cluster-commits mailing list