Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mininet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olaf Bergmann
mininet
Commits
08d611f4
Commit
08d611f4
authored
10 years ago
by
Cody Burkard
Browse files
Options
Downloads
Patches
Plain Diff
fix silent failures when rt cannot be assigned
parent
aae0affa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mininet/node.py
+17
-8
17 additions, 8 deletions
mininet/node.py
with
17 additions
and
8 deletions
mininet/node.py
+
17
−
8
View file @
08d611f4
...
...
@@ -510,7 +510,7 @@ def setParam( self, results, method, **param ):
value may also be list or dict
"""
name
,
value
=
param
.
items
()[
0
]
f
=
getattr
(
self
,
method
,
None
)
if
not
f
or
value
is
None
:
if
not
f
:
return
if
type
(
value
)
is
list
:
result
=
f
(
*
value
)
...
...
@@ -655,8 +655,14 @@ def popen( self, *args, **kwargs ):
# Tell mnexec to execute command in our cgroup
mncmd
=
[
'
mnexec
'
,
'
-g
'
,
self
.
name
,
'
-da
'
,
str
(
self
.
pid
)
]
if
self
.
sched
==
'
rt
'
:
cpuTime
=
int
(
self
.
cgroupGet
(
'
rt_runtime_us
'
,
'
cpu
'
)
)
# if our cgroup is not given any cpu time,
# we cannot assign the RR Scheduler.
if
self
.
sched
==
'
rt
'
and
cpuTime
>
0
:
mncmd
+=
[
'
-r
'
,
str
(
self
.
rtprio
)
]
elif
self
.
sched
==
'
rt
'
and
cpuTime
<=
0
:
debug
(
'
***error: not enough cpu time available for %s.
'
%
self
.
name
,
'
Using cfs scheduler for subprocess
\n
'
)
return
Host
.
popen
(
self
,
*
args
,
mncmd
=
mncmd
,
**
kwargs
)
def
cleanup
(
self
):
...
...
@@ -707,8 +713,9 @@ def setCPUFrac( self, f=-1, sched=None):
f: CPU bandwidth limit (fraction)
sched:
'
rt
'
or
'
cfs
'
Note
'
cfs
'
requires CONFIG_CFS_BANDWIDTH
"""
# if cpu fraction is None, reset to default of 0
if
not
f
:
return
f
=
-
1
if
not
sched
:
sched
=
self
.
sched
if
sched
==
'
rt
'
:
...
...
@@ -721,15 +728,17 @@ def setCPUFrac( self, f=-1, sched=None):
# Reset to unlimited
quota
=
-
1
# Set cgroup's period and quota
self
.
cgroupSet
(
pstr
,
period
)
self
.
cgroupSet
(
qstr
,
quota
)
setPeriod
=
self
.
cgroupSet
(
pstr
,
period
)
setQuota
=
self
.
cgroupSet
(
qstr
,
quota
)
if
sched
==
'
rt
'
:
# Set RT priority if necessary
self
.
chrt
()
info
(
'
(%s %d/%dus)
'
%
(
sched
,
q
uota
,
p
eriod
)
)
sched
=
self
.
chrt
()
info
(
'
(%s %d/%dus)
'
%
(
sched
,
setQ
uota
,
setP
eriod
)
)
def
setCPUs
(
self
,
cores
,
mems
=
0
):
"
Specify (real) cores that our cgroup can run on
"
if
not
cores
:
return
if
type
(
cores
)
is
list
:
cores
=
'
,
'
.
join
(
[
str
(
c
)
for
c
in
cores
]
)
self
.
cgroupSet
(
resource
=
'
cpuset
'
,
param
=
'
cpus
'
,
...
...
@@ -743,7 +752,7 @@ def setCPUs( self, cores, mems=0 ):
errFail
(
'
cgclassify -g cpuset:/%s %s
'
%
(
self
.
name
,
self
.
pid
)
)
def
config
(
self
,
cpu
=
None
,
cores
=
None
,
**
params
):
def
config
(
self
,
cpu
=
-
1
,
cores
=
None
,
**
params
):
"""
cpu: desired overall system CPU fraction
cores: (real) core(s) this host can run on
params: parameters for Node.config()
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment