Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: constrain runtime after creating network
Browse files Browse the repository at this point in the history
Runtime must setup the network before moving itself into the cgroup, otherwise
it won't be able to get the vhost/net queues file descriptors for the
hypervisor.

Signed-off-by: Julio Montes <[email protected]>
  • Loading branch information
Julio Montes committed Apr 29, 2020
1 parent fc9be99 commit 93b1b83
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions virtcontainers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ func createSandboxFromConfig(ctx context.Context, sandboxConfig SandboxConfig, f
return nil, err
}

// Move runtime to sandbox cgroup so all process are created there.
if s.config.SandboxCgroupOnly {
if err := s.setupSandboxCgroup(); err != nil {
return nil, err
}
}

// cleanup sandbox resources in case of any failure
defer func() {
if err != nil {
Expand All @@ -102,6 +95,13 @@ func createSandboxFromConfig(ctx context.Context, sandboxConfig SandboxConfig, f
}
}()

// Move runtime to sandbox cgroup so all process are created there.
if s.config.SandboxCgroupOnly {
if err := s.setupSandboxCgroup(); err != nil {
return nil, err
}
}

// Start the VM
if err = s.startVM(); err != nil {
return nil, err
Expand Down

0 comments on commit 93b1b83

Please sign in to comment.