diff options
author | Fabricio Voznika <fvoznika@google.com> | 2021-02-22 15:54:58 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-02-22 15:57:07 -0800 |
commit | 34e2cda9ad6a20861844776abfbb45052d20c3fa (patch) | |
tree | 42e22747194d006da90c6270b37815bbf97c0837 /runsc/container | |
parent | fed1cc6d8c90e53bb9819b515d9d5b8bf4ec166e (diff) |
Return nicer error message when cgroups v1 isn't available
Updates #3481
Closes #5430
PiperOrigin-RevId: 358923208
Diffstat (limited to 'runsc/container')
-rw-r--r-- | runsc/container/container.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/runsc/container/container.go b/runsc/container/container.go index aae64ae1c..40812efb8 100644 --- a/runsc/container/container.go +++ b/runsc/container/container.go @@ -230,7 +230,6 @@ func New(conf *config.Config, args Args) (*Container, error) { if args.Spec.Linux.CgroupsPath == "" && !conf.TestOnlyAllowRunAsCurrentUserWithoutChroot { args.Spec.Linux.CgroupsPath = "/" + args.ID } - // Create and join cgroup before processes are created to ensure they are // part of the cgroup from the start (and all their children processes). cg, err := cgroup.New(args.Spec) @@ -238,6 +237,10 @@ func New(conf *config.Config, args Args) (*Container, error) { return nil, err } if cg != nil { + // TODO(gvisor.dev/issue/3481): Remove when cgroups v2 is supported. + if !conf.Rootless && cgroup.IsOnlyV2() { + return nil, fmt.Errorf("cgroups V2 is not yet supported. Enable cgroups V1 and retry") + } // If there is cgroup config, install it before creating sandbox process. if err := cg.Install(args.Spec.Linux.Resources); err != nil { switch { |