Skip to content
Snippets Groups Projects
Commit e3621eb0 authored by Brandon Heller's avatar Brandon Heller
Browse files

Move fixLimits function to util

parent 89bf3103
No related branches found
No related tags found
No related merge requests found
...@@ -71,12 +71,11 @@ ...@@ -71,12 +71,11 @@
from time import sleep from time import sleep
import os, re, signal, sys, select import os, re, signal, sys, select
flush = sys.stdout.flush flush = sys.stdout.flush
from resource import setrlimit, RLIMIT_NPROC, RLIMIT_NOFILE
from mininet.logging_mod import lg, set_loglevel from mininet.logging_mod import lg, set_loglevel
from mininet.node import Node, Host, Controller, Switch from mininet.node import Node, Host, Controller, Switch
from mininet.util import run, checkRun, quietRun, makeIntfPair, moveIntf from mininet.util import run, checkRun, quietRun, makeIntfPair, moveIntf
from mininet.util import createLink from mininet.util import createLink, setLimits
DATAPATHS = ['user', 'kernel'] DATAPATHS = ['user', 'kernel']
...@@ -532,11 +531,7 @@ def run( self ): ...@@ -532,11 +531,7 @@ def run( self ):
else: else:
lg.error("cli: unknown node or command: < %s >\n" % first) lg.error("cli: unknown node or command: < %s >\n" % first)
lg.info("*** cli: exiting\n") lg.info("*** cli: exiting\n")
def fixLimits():
"Fix ridiculously small resource limits."
setrlimit( RLIMIT_NPROC, ( 4096, 8192 ) )
setrlimit( RLIMIT_NOFILE, ( 16384, 32768 ) )
def init(): def init():
"Initialize Mininet." "Initialize Mininet."
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
'''Utility functions for Mininet.''' '''Utility functions for Mininet.'''
from time import sleep from time import sleep
from resource import setrlimit, RLIMIT_NPROC, RLIMIT_NOFILE
import select import select
from subprocess import call, check_call, Popen, PIPE, STDOUT from subprocess import call, check_call, Popen, PIPE, STDOUT
...@@ -166,4 +167,10 @@ def createLink(node1, node2): ...@@ -166,4 +167,10 @@ def createLink(node1, node2):
retry(3, MOVEINTF_DELAY, moveIntf, intf2, node2) retry(3, MOVEINTF_DELAY, moveIntf, intf2, node2)
node1.connection[intf1] = (node2, intf2) node1.connection[intf1] = (node2, intf2)
node2.connection[intf2] = (node1, intf1) node2.connection[intf2] = (node1, intf1)
return intf1, intf2 return intf1, intf2
\ No newline at end of file
def fixLimits():
'''Fix ridiculously small resource limits.'''
setrlimit( RLIMIT_NPROC, (4096, 8192))
setrlimit( RLIMIT_NOFILE, (16384, 32768))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment