@@ -13,6 +13,7 @@ import (
13
13
14
14
systemdDbus "github.com/coreos/go-systemd/v22/dbus"
15
15
"github.com/opencontainers/runc/libcontainer/cgroups"
16
+ "github.com/opencontainers/runc/libcontainer/cgroups/cgroupv1"
16
17
"github.com/opencontainers/runc/libcontainer/cgroups/fs"
17
18
"github.com/opencontainers/runc/libcontainer/configs"
18
19
"github.com/sirupsen/logrus"
@@ -143,7 +144,7 @@ func (m *legacyManager) Apply(pid int) error {
143
144
_ , err := getSubsystemPath (m .cgroups , name )
144
145
if err != nil {
145
146
// Don't fail if a cgroup hierarchy was not found, just skip this subsystem
146
- if cgroups .IsNotFound (err ) {
147
+ if cgroupv1 .IsNotFound (err ) {
147
148
continue
148
149
}
149
150
return err
@@ -214,7 +215,7 @@ func (m *legacyManager) Apply(pid int) error {
214
215
subsystemPath , err := getSubsystemPath (m .cgroups , s .Name ())
215
216
if err != nil {
216
217
// Don't fail if a cgroup hierarchy was not found, just skip this subsystem
217
- if cgroups .IsNotFound (err ) {
218
+ if cgroupv1 .IsNotFound (err ) {
218
219
continue
219
220
}
220
221
return err
@@ -273,7 +274,7 @@ func joinCgroups(c *configs.Cgroup, pid int) error {
273
274
// let systemd handle this
274
275
case "cpuset" :
275
276
path , err := getSubsystemPath (c , name )
276
- if err != nil && ! cgroups .IsNotFound (err ) {
277
+ if err != nil && ! cgroupv1 .IsNotFound (err ) {
277
278
return err
278
279
}
279
280
s := & fs.CpusetGroup {}
@@ -291,7 +292,7 @@ func joinCgroups(c *configs.Cgroup, pid int) error {
291
292
}
292
293
// For other subsystems, omit the `not found` error
293
294
// because they are optional.
294
- if ! cgroups .IsNotFound (err ) {
295
+ if ! cgroupv1 .IsNotFound (err ) {
295
296
return err
296
297
}
297
298
}
@@ -302,12 +303,12 @@ func joinCgroups(c *configs.Cgroup, pid int) error {
302
303
}
303
304
304
305
func getSubsystemPath (c * configs.Cgroup , subsystem string ) (string , error ) {
305
- mountpoint , err := cgroups .FindCgroupMountpoint (c .Path , subsystem )
306
+ mountpoint , err := cgroupv1 .FindCgroupMountpoint (c .Path , subsystem )
306
307
if err != nil {
307
308
return "" , err
308
309
}
309
310
310
- initPath , err := cgroups .GetInitCgroup (subsystem )
311
+ initPath , err := cgroupv1 .GetInitCgroup (subsystem )
311
312
if err != nil {
312
313
return "" , err
313
314
}
@@ -427,7 +428,7 @@ func (m *legacyManager) Set(container *configs.Config) error {
427
428
for _ , sys := range legacySubsystems {
428
429
// Get the subsystem path, but don't error out for not found cgroups.
429
430
path , err := getSubsystemPath (container .Cgroups , sys .Name ())
430
- if err != nil && ! cgroups .IsNotFound (err ) {
431
+ if err != nil && ! cgroupv1 .IsNotFound (err ) {
431
432
return err
432
433
}
433
434
if err := sys .Set (path , container .Cgroups ); err != nil {
@@ -445,7 +446,7 @@ func (m *legacyManager) Set(container *configs.Config) error {
445
446
446
447
func setKernelMemory (c * configs.Cgroup ) error {
447
448
path , err := getSubsystemPath (c , "memory" )
448
- if err != nil && ! cgroups .IsNotFound (err ) {
449
+ if err != nil && ! cgroupv1 .IsNotFound (err ) {
449
450
return err
450
451
}
451
452
@@ -476,7 +477,7 @@ func (m *legacyManager) GetCgroups() (*configs.Cgroup, error) {
476
477
477
478
func (m * legacyManager ) GetFreezerState () (configs.FreezerState , error ) {
478
479
path , err := getSubsystemPath (m .cgroups , "freezer" )
479
- if err != nil && ! cgroups .IsNotFound (err ) {
480
+ if err != nil && ! cgroupv1 .IsNotFound (err ) {
480
481
return configs .Undefined , err
481
482
}
482
483
freezer , err := legacySubsystems .Get ("freezer" )
0 commit comments