Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
1ff85f09
Unverified
Commit
1ff85f09
authored
6 years ago
by
Nick Ethier
Browse files
Options
Download
Email Patches
Plain Diff
executor: cleanup netns handling in executor
parent
d28d8651
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drivers/shared/executor/executor_linux.go
+3
-11
drivers/shared/executor/executor_linux.go
with
3 additions
and
11 deletions
+3
-11
drivers/shared/executor/executor_linux.go
+
3
-
11
View file @
1ff85f09
...
@@ -10,7 +10,6 @@ import (
...
@@ -10,7 +10,6 @@ import (
"os/exec"
"os/exec"
"path"
"path"
"path/filepath"
"path/filepath"
"runtime"
"strings"
"strings"
"syscall"
"syscall"
"time"
"time"
...
@@ -186,22 +185,15 @@ func (l *LibcontainerExecutor) Launch(command *ExecCommand) (*ProcessState, erro
...
@@ -186,22 +185,15 @@ func (l *LibcontainerExecutor) Launch(command *ExecCommand) (*ProcessState, erro
// Starts the task
// Starts the task
if
command
.
NetworkIsolation
!=
nil
&&
command
.
NetworkIsolation
.
Path
!=
""
{
if
command
.
NetworkIsolation
!=
nil
&&
command
.
NetworkIsolation
.
Path
!=
""
{
// Lock to the thread we're changing the network namespace of
runtime
.
LockOSThread
()
netns
,
err
:=
ns
.
GetNS
(
command
.
NetworkIsolation
.
Path
)
netns
,
err
:=
ns
.
GetNS
(
command
.
NetworkIsolation
.
Path
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"failed to get ns %s: %v"
,
command
.
NetworkIsolation
.
Path
,
err
)
}
}
// Start the container in the network namespace
// Start the container in the network namespace
err
=
netns
.
Do
(
func
(
ns
.
NetNS
)
error
{
err
=
netns
.
Do
(
func
(
ns
.
NetNS
)
error
{
return
container
.
Run
(
process
)
})
if
err
:=
container
.
Run
(
process
);
err
!=
nil
{
container
.
Destroy
()
return
err
}
return
nil
})
if
err
!=
nil
{
if
err
!=
nil
{
container
.
Destroy
()
return
nil
,
err
return
nil
,
err
}
}
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help