@@ -25,8 +25,7 @@ import (
2525 info "github.com/google/cadvisor/info/v1"
2626 "github.com/google/cadvisor/machine"
2727
28- cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs"
29- "github.com/opencontainers/runc/libcontainer/configs"
28+ //"github.com/opencontainers/runc/libcontainer/cgroups"
3029 "k8s.io/klog"
3130)
3231
@@ -51,19 +50,16 @@ func isRootCgroup(name string) bool {
5150}
5251
5352func newRawContainerHandler (name string , cgroupSubsystems * libcontainer.CgroupSubsystems , machineInfoFactory info.MachineInfoFactory , fsInfo fs.FsInfo , watcher * common.InotifyWatcher , rootFs string , includedMetrics container.MetricSet ) (container.ContainerHandler , error ) {
54- cgroupPaths := common .MakeCgroupPaths (cgroupSubsystems .MountPoints , name )
55-
5653 cHints , err := common .GetContainerHintsFromFile (* common .ArgContainerHints )
5754 if err != nil {
5855 return nil , err
5956 }
6057
61- // Generate the equivalent cgroup manager for this container.
62- cgroupManager := & cgroupfs.Manager {
63- Cgroups : & configs.Cgroup {
64- Name : name ,
65- },
66- Paths : cgroupPaths ,
58+ cgroupPaths := common .MakeCgroupPaths (cgroupSubsystems .MountPoints , name )
59+
60+ cgroupManager , err := libcontainer .NewCgroupManager (name , cgroupPaths )
61+ if err != nil {
62+ return nil , err
6763 }
6864
6965 var externalMounts []common.Mount
@@ -227,9 +223,11 @@ func (self *rawContainerHandler) getFsStats(stats *info.ContainerStats) error {
227223}
228224
229225func (self * rawContainerHandler ) GetStats () (* info.ContainerStats , error ) {
226+ //skipRootStats := cgroups.IsCgroup2UnifiedMode() || *disableRootCgroupStats
230227 if * disableRootCgroupStats && isRootCgroup (self .name ) {
231228 return nil , nil
232229 }
230+
233231 stats , err := self .libcontainerHandler .GetStats ()
234232 if err != nil {
235233 return stats , err
0 commit comments