mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-26 23:38:31 +00:00
virtcontainer/cgroup: create cgroup manager after creating the network
Create the cgroup manager once the network has been created, this way the list of device will include the network VFIO devices attached to the sandbox, when the physical enpoint is the network driver. fixes #2774 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
a134c2e083
commit
919fc4cde5
@ -100,6 +100,10 @@ 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.createCgroupManager(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := s.setupSandboxCgroup(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -566,10 +566,6 @@ func newSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factor
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := s.createCgroupManager(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if s.disableVMShutdown, err = s.agent.init(ctx, s, sandboxConfig.AgentConfig); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -687,6 +683,12 @@ func fetchSandbox(ctx context.Context, sandboxID string) (sandbox *Sandbox, err
|
||||
return nil, fmt.Errorf("failed to create sandbox with config %+v: %v", config, err)
|
||||
}
|
||||
|
||||
if sandbox.config.SandboxCgroupOnly {
|
||||
if err := sandbox.createCgroupManager(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// This sandbox already exists, we don't need to recreate the containers in the guest.
|
||||
// We only need to fetch the containers from storage and create the container structs.
|
||||
if err := sandbox.fetchContainers(); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user