Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nemu3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
nemu3
Commits
a7e44669
Commit
a7e44669
authored
Aug 05, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes
parent
9f1d3d08
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
src/netns/environ.py
src/netns/environ.py
+18
-7
src/netns/iproute.py
src/netns/iproute.py
+2
-0
No files found.
src/netns/environ.py
View file @
a7e44669
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
os
,
subprocess
import
os
,
subprocess
__all__
=
[
"ip_path"
,
"tc_path"
,
"brctl_path"
,
"sysctl_path"
,
"hz"
]
__all__
=
[
"ip_path"
,
"tc_path"
,
"brctl_path"
,
"sysctl_path"
,
"hz"
]
__all__
+=
[
"tcpdump_path"
,
"netperf_path"
]
__all__
+=
[
"execute"
,
"backticks"
]
__all__
+=
[
"execute"
,
"backticks"
]
def
_find_bin
(
name
):
def
_find_bin
(
name
):
...
@@ -14,13 +15,23 @@ def _find_bin(name):
...
@@ -14,13 +15,23 @@ def _find_bin(name):
except
OSError
,
e
:
except
OSError
,
e
:
if
e
.
errno
!=
os
.
errno
.
ENOENT
:
if
e
.
errno
!=
os
.
errno
.
ENOENT
:
raise
raise
raise
RuntimeError
(
"Cannot find `%s' command, impossible to continue."
%
return
None
name
)
def
_find_bin_or_die
(
name
):
ip_path
=
_find_bin
(
"ip"
)
r
=
_find_bin
(
name
)
tc_path
=
_find_bin
(
"tc"
)
if
not
r
:
brctl_path
=
_find_bin
(
"brctl"
)
raise
RuntimeError
(
"Cannot find `%s' command, impossible to "
+
sysctl_path
=
_find_bin
(
"sysctl"
)
"continue."
%
name
)
return
r
ip_path
=
_find_bin_or_die
(
"ip"
)
tc_path
=
_find_bin_or_die
(
"tc"
)
brctl_path
=
_find_bin_or_die
(
"brctl"
)
sysctl_path
=
_find_bin_or_die
(
"sysctl"
)
# Optional tools
tcpdump_path
=
_find_bin
(
"tcpdump"
)
netperf_path
=
_find_bin
(
"netperf"
)
# Seems this is completely bogus. At least, we can assume that the internal HZ
# Seems this is completely bogus. At least, we can assume that the internal HZ
# is bigger than this.
# is bigger than this.
...
...
src/netns/iproute.py
View file @
a7e44669
...
@@ -272,6 +272,8 @@ def _get_if_name(iface):
...
@@ -272,6 +272,8 @@ def _get_if_name(iface):
# XXX: ideally this should be replaced by netlink communication
# XXX: ideally this should be replaced by netlink communication
# Interface handling
# Interface handling
# FIXME: try to lower the amount of calls to retrieve data!!
def
get_if_data
():
def
get_if_data
():
"""Gets current interface information. Returns a tuple (byidx, bynam) in
"""Gets current interface information. Returns a tuple (byidx, bynam) in
which each element is a dictionary with the same data, but using different
which each element is a dictionary with the same data, but using different
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment