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 {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *NetClsGroup) Apply(d *data) error {
|
|
|
|
dir, err := d.join("net_cls")
|
|
|
|
if err != nil && !cgroups.IsNotFound(err) {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := s.Set(dir, d.c); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *NetClsGroup) Set(path string, cgroup *configs.Cgroup) error {
|
|
|
|
if cgroup.NetClsClassid != "" {
|
|
|
|
if err := writeFile(path, "net_cls.classid", cgroup.NetClsClassid); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *NetClsGroup) Remove(d *data) error {
|
|
|
|
return removePath(d.path("net_cls"))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *NetClsGroup) GetStats(path string, stats *cgroups.Stats) error {
|
|
|
|
return nil
|
|
|
|
}
|