Skip to content

Commit 850bae5

Browse files
committed
pkg/specgen/namespaces.go: Remove Cgroups v1
Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent c98c50e commit 850bae5

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

pkg/specgen/namespaces.go

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
spec "github.com/opencontainers/runtime-spec/specs-go"
1515
"github.com/opencontainers/runtime-tools/generate"
1616
"go.podman.io/common/libnetwork/types"
17-
"go.podman.io/common/pkg/cgroups"
1817
"go.podman.io/common/pkg/config"
1918
"go.podman.io/storage/pkg/fileutils"
2019
"go.podman.io/storage/pkg/unshare"
@@ -262,26 +261,14 @@ func ParseNamespace(ns string) (Namespace, error) {
262261
// ParseCgroupNamespace parses a cgroup namespace specification in string
263262
// form.
264263
func ParseCgroupNamespace(ns string) (Namespace, error) {
265-
toReturn := Namespace{}
266-
// Cgroup is host for v1, private for v2.
267-
// We can't trust c/common for this, as it only assumes private.
268-
cgroupsv2, err := cgroups.IsCgroup2UnifiedMode()
269-
if err != nil {
270-
return toReturn, err
271-
}
272-
if cgroupsv2 {
273-
switch ns {
274-
case "host":
275-
toReturn.NSMode = Host
276-
case "private", "":
277-
toReturn.NSMode = Private
278-
default:
279-
return toReturn, fmt.Errorf("unrecognized cgroup namespace mode %s passed", ns)
280-
}
281-
} else {
282-
toReturn.NSMode = Host
264+
switch ns {
265+
case "host":
266+
return Namespace{NSMode: Host}, nil
267+
case "private", "":
268+
return Namespace{NSMode: Private}, nil
269+
default:
270+
return Namespace{}, fmt.Errorf("unrecognized cgroup namespace mode %s passed", ns)
283271
}
284-
return toReturn, nil
285272
}
286273

287274
// ParseIPCNamespace parses an ipc namespace specification in string

0 commit comments

Comments
 (0)