Conversation
|
@AkihiroSuda and @Zyqsempai please take a look at this new approach. it should make things much easier to manage and extend. |
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
=======================================
Coverage 45.42% 45.42%
=======================================
Files 23 23
Lines 1638 1638
=======================================
Hits 744 744
Misses 768 768
Partials 126 126Continue to review full report at Codecov.
|
95a78dc to
df36c14
Compare
v2/controller.go
Outdated
| } | ||
|
|
||
| func (c *Controller) Delete() error { | ||
| return remove(c.path) |
There was a problem hiding this comment.
I think we still need the remove all logic but i'm not sure if this is more robust in v2
|
|
3537de5 to
677330f
Compare
The resource type is changed in this but I would rather have a v2 native Resource type and do a mapping from an OCI spec's resource to the v2.Resource type. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
677330f to
3239d7b
Compare
Zyqsempai
left a comment
There was a problem hiding this comment.
You removed everything from playground, do we have any chance to test your solution?
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
|
Ok, pushed a big update. This has stats implemented along with renaming the playground tool to NAME:
cgctl - cgroup v2 management tool
USAGE:
cgctl [global options] command [command options] [arguments...]
VERSION:
1
COMMANDS:
new create a new cgroup
del delete a cgroup
list list processes in a cgroup
stat stat a cgroup
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--debug enable debug output in the logs
--mountpoint value cgroup mountpoint (default: "/sys/fs/cgroup")
--help, -h show help
--version, -v print the version> sudo ./cgctl new --enable test
> sudo ./cgctl list test
> sudo ./cgctl stat test
> sudo ./cgctl del test |
| if err != nil { | ||
| return err | ||
| } | ||
| if err := c.ToggleControllers(controllers, v2.Enable); err != nil { |
There was a problem hiding this comment.
This needs to be done for the parent group?
There was a problem hiding this comment.
you don't need to enable this at all if the system is setup to enable them
There was a problem hiding this comment.
When you have cpu in the top group /sys/fs/cgroup, cpu is enabled for /sys/fs/cgroup/foo, but not enabled for /sys/fs/cgroup/foo/bar.
root@suda-ws01:/sys/fs/cgroup# cat cgroup.controllers
cpuset cpu io memory pids rdma
root@suda-ws01:/sys/fs/cgroup# mkdir foo
root@suda-ws01:/sys/fs/cgroup# cat foo/cgroup.controllers
cpu io memory pids
root@suda-ws01:/sys/fs/cgroup# mkdir foo/bar
root@suda-ws01:/sys/fs/cgroup# cat foo/bar/cgroup.controllers
root@suda-ws01:/sys/fs/cgroup#There was a problem hiding this comment.
yes, its up to the creator of the cgroup to enable these. I don't think the sub cgroup should modify the parent settings
|
|
||
| // VerifyGroupPath verifies the format of g. | ||
| // VerifyGroupPath doesn't verify whether g actually exists on the system. | ||
| func VerifyGroupPath(g GroupPath) error { |
| } | ||
| out := make(map[string]uint64) | ||
| for _, controller := range controllers { | ||
| filename := fmt.Sprintf("%s.stat", controller) |
There was a problem hiding this comment.
how will it work for other files such as pids.current?
There was a problem hiding this comment.
Probably we should either add file name to key or return map[string]map[string]interface{}
|
We don't have to fix everything in this PR, it's meant to show that we can simplify things for v2 and to get this in so we can carry on the work |
Zyqsempai
left a comment
There was a problem hiding this comment.
I agree with @crosbymichael we shouldn't waste our time on perfecting this particular Pr, anyway, we have a lot of work to do so far. So I think we can merge it and polish it little by little in further PR's.
containerd#109 (comment) Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
|
follow-up: #110 |
split fs2 package from fs, as mixing up fs and fs2 is very likely to result in unmaintainable code. Inspired by containerd/cgroups#109 Fix opencontainers#2157 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
split fs2 package from fs, as mixing up fs and fs2 is very likely to result in unmaintainable code. Inspired by containerd/cgroups#109 Fix opencontainers#2157 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
split fs2 package from fs, as mixing up fs and fs2 is very likely to result in unmaintainable code. Inspired by containerd/cgroups#109 Fix opencontainers#2157 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
split fs2 package from fs, as mixing up fs and fs2 is very likely to result in unmaintainable code. Inspired by containerd/cgroups#109 Fix opencontainers#2157 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
split fs2 package from fs, as mixing up fs and fs2 is very likely to result in unmaintainable code. Inspired by containerd/cgroups#109 Fix opencontainers#2157 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
split fs2 package from fs, as mixing up fs and fs2 is very likely to result in unmaintainable code. Inspired by containerd/cgroups#109 Fix #2157 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
split fs2 package from fs, as mixing up fs and fs2 is very likely to result in unmaintainable code. Inspired by containerd/cgroups#109 Fix #2157 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
split fs2 package from fs, as mixing up fs and fs2 is very likely to result in unmaintainable code. Inspired by containerd/cgroups#109 Fix #2157 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
split fs2 package from fs, as mixing up fs and fs2 is very likely to result in unmaintainable code. Inspired by containerd#109 Fix #2157 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
The resource type is changed in this but I would rather have a v2 native
Resource type and do a mapping from an OCI spec's resource to the v2.Resource
type.
ref #104
Signed-off-by: Michael Crosby crosbymichael@gmail.com