Juan Hernandez has uploaded a new change for review.

Change subject: packaging: Don't fail when setting limit fails
......................................................................

packaging: Don't fail when setting limit fails

Currently we fail the startup of the engine when setting a resource
limit fails. This complicates the execution of the engine service script
in development environments, so we are changing that to a warning.

Change-Id: Ic6668d276648665e86108e2d6d2b6e64ba9dfb19
Signed-off-by: Juan Hernandez <[email protected]>
---
M packaging/fedora/engine-service.py
1 file changed, 14 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/90/10890/1

diff --git a/packaging/fedora/engine-service.py 
b/packaging/fedora/engine-service.py
index efa8ba9..c95000c 100644
--- a/packaging/fedora/engine-service.py
+++ b/packaging/fedora/engine-service.py
@@ -317,6 +317,17 @@
         os.remove(enginePidFile)
 
 
+def setLimit(name):
+    limit = eval("resource.RLIMIT_" + name.upper())
+    value = engineConfig.getInteger("ENGINE_" + name.upper())
+    try:
+        resource.setrlimit(limit, (value, value))
+    except:
+        syslog.syslog(syslog.LOG_WARNING,
+            "Can't change the value of the resource "
+            "limit \"%s\" to %d." % (name, value))
+
+
 def startEngine():
     # Load the configuration and perform checks:
     loadConfig()
@@ -501,9 +512,9 @@
         return
 
     # Change the resource limits while we are root as we won't be
-    # able to change them once we assume the engine identity:
-    engineNofile = engineConfig.getInteger("ENGINE_NOFILE")
-    resource.setrlimit(resource.RLIMIT_NOFILE, (engineNofile, engineNofile))
+    # able to change them once we assume the engine identity (the
+    # values come from the configuration):
+    setLimit("nofile")
 
     # This is the child process, first thing we do is assume the engine
     # identity:


--
To view, visit http://gerrit.ovirt.org/10890
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6668d276648665e86108e2d6d2b6e64ba9dfb19
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to