2015-10-24 04:41:10 +08:00
|
|
|
// +build linux
|
|
|
|
|
2015-05-14 09:09:14 +08:00
|
|
|
package fs
|
|
|
|
|
|
|
|
import (
|
2015-06-22 10:29:59 +08:00
|
|
|
"github.com/opencontainers/runc/libcontainer/cgroups"
|
|
|
|
"github.com/opencontainers/runc/libcontainer/configs"
|
2015-05-14 09:09:14 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type NetClsGroup struct {
|
|
|
|
}
|
|
|
|
|
2015-10-16 06:19:23 +08:00
|
|
|
func (s *NetClsGroup) Name() string {
|
|
|
|
return "net_cls"
|
|
|
|
}
|
|
|
|
|
2015-11-05 18:41:08 +08:00
|
|
|
func (s *NetClsGroup) Apply(d *cgroupData) error {
|
2015-12-20 19:30:35 +08:00
|
|
|
_, err := d.join("net_cls")
|
2015-05-14 09:09:14 +08:00
|
|
|
if err != nil && !cgroups.IsNotFound(err) {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *NetClsGroup) Set(path string, cgroup *configs.Cgroup) error {
|
2015-12-15 08:26:29 +08:00
|
|
|
if cgroup.Resources.NetClsClassid != "" {
|
|
|
|
if err := writeFile(path, "net_cls.classid", cgroup.Resources.NetClsClassid); err != nil {
|
2015-05-14 09:09:14 +08:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-11-05 18:41:08 +08:00
|
|
|
func (s *NetClsGroup) Remove(d *cgroupData) error {
|
2015-05-14 09:09:14 +08:00
|
|
|
return removePath(d.path("net_cls"))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *NetClsGroup) GetStats(path string, stats *cgroups.Stats) error {
|
|
|
|
return nil
|
|
|
|
}
|