diff --git a/mininet/node.py b/mininet/node.py index 784fe89039ec61684b73d78d1faf144b287a2e86..0a0fec0ade69c6c8ee7374a8cc3121faaf1cc39a 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -166,7 +166,7 @@ def mountPrivateDirs( self ): for directory in self.privateDirs: if isinstance( directory, tuple ): # mount given private directory - privateDir = directory[ 1 ] % self.__dict__ + privateDir = directory[ 1 ] % self.__dict__ mountPoint = directory[ 0 ] self.cmd( 'mkdir -p %s' % privateDir ) self.cmd( 'mkdir -p %s' % mountPoint ) @@ -174,7 +174,7 @@ def mountPrivateDirs( self ): ( privateDir, mountPoint ) ) else: # mount temporary filesystem on directory - self.cmd( 'mkdir -p %s' % directory ) + self.cmd( 'mkdir -p %s' % directory ) self.cmd( 'mount -n -t tmpfs tmpfs %s' % directory ) def unmountPrivateDirs( self ): @@ -640,13 +640,9 @@ def __init__( self, name, sched='cfs', **kwargs ): # still does better with larger period values. self.period_us = kwargs.get( 'period_us', 100000 ) self.sched = sched - if self.sched == 'rt': - release = quietRun( 'uname -r' ).strip('\r\n') - output = quietRun( 'grep CONFIG_RT_GROUP_SCHED /boot/config-%s' % release ) - if output == '# CONFIG_RT_GROUP_SCHED is not set\n': - error( '\n*** error: please enable RT_GROUP_SCHED in your kernel\n' ) - exit( 1 ) - self.rtprio = 20 + if sched == 'rt': + self.checkRtGroupSched() + self.rtprio = 20 def cgroupSet( self, param, value, resource='cpu' ): "Set a cgroup parameter and return its value" @@ -710,6 +706,19 @@ def rtInfo( self, f ): quota = int( self.period_us * f ) return pstr, qstr, self.period_us, quota + _rtGroupSched = False # internal class var: Is CONFIG_RT_GROUP_SCHED set? + + @classmethod + def checkRtGroupSched( cls ): + "Check (Ubuntu,Debian) kernel config for CONFIG_RT_GROUP_SCHED for RT" + if not cls._rtGroupSched: + release = quietRun( 'uname -r' ).strip('\r\n') + output = quietRun( 'grep CONFIG_RT_GROUP_SCHED /boot/config-%s' % release ) + if output == '# CONFIG_RT_GROUP_SCHED is not set\n': + error( '\n*** error: please enable RT_GROUP_SCHED in your kernel\n' ) + exit( 1 ) + cls._rtGroupSched = True + def cfsInfo( self, f): "Internal method: return parameters for CFS bandwidth" pstr, qstr = 'cfs_period_us', 'cfs_quota_us' @@ -1370,7 +1379,7 @@ def __init__( self, name, *ryuArgs, **kwargs ): Controller.__init__( self, name, command='ryu-manager', - cargs='--ofp-tcp-listen-port %s ' + + cargs='--ofp-tcp-listen-port %s ' + ' '.join( ryuArgs ), cdir=ryuCoreDir, **kwargs )