[ovs-dev] [PATCH] ovs-ctl: Don't decrease max open fds if already set higher

Thomas Graf tgraf at suug.ch
Thu May 8 18:45:25 UTC 2014


A user may set LimitNOFILE through systemd or other means to set
the maximum number of open file descriptors. Only modify the ulimit
if not already set to a higher value by the user.

Signed-off-by: Thomas Graf <tgraf at suug.ch>
---
 utilities/ovs-ctl.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 0735160..2f39519 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -227,7 +227,10 @@ start_forwarding () {
         # On Linux, ovs-vswitchd needs about three file descriptors
         # per bridge and one file descriptor per bridge port, so this
         # allows a very large number of bridges and ports.
-        ulimit -n 7500
+        MAXFD=7500
+        if [ $(ulimit -n) -lt $MAXFD ]; then
+            ulimit -n $MAXFD
+        fi
 
 	    # Start ovs-vswitchd.
 	    set ovs-vswitchd unix:"$DB_SOCK"
-- 
1.8.3.1




More information about the dev mailing list