Closed marusak closed 4 years ago
Hi @marusak, thanks for reaching out!
@giuseppe, using --cpu-shares
yields the following error:
Error: invalid configuration, cannot specify resource limits without cgroups v2 and --cgroup-manager=systemd
Is that correct or a regressions? It has worked with v1 at some point, didn't it?
Is that correct or a regressions? It has worked with v1 at some point, didn't it?
are you running as rootless?
are you running as rootless?
:see_no_evil: yes ... which totally explains the difference. So we should make the default value conditional and update the docs?
In my example I was running as root, as it is not supported as rootless (to my knowledge).
$ podman run --name is_it_1024 --cpu-shares=1024 -dit fedora bash
Error: writing file '/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/cgroup.subtree_control': No such file or directory: OCI runtime command not found error
(this is CGroupsV2 of Fedora 31)
see_no_evil yes ... which totally explains the difference. So we should make the default value conditional and update the docs?
1024 is the default also when running as rootless. The difference is that it cannot be modified.
I think the issue here can be that 0 means "unspecified", given that the minimum value for cpu shares on cgroup v1 is 2. I think we should just convert 0 to 1024.
@giuseppe the default is set to 0 (see https://github.com/containers/libpod/blob/master/cmd/podman/common.go#L192).
@giuseppe the default is set to 0 (see https://github.com/containers/libpod/blob/master/cmd/podman/common.go#L192).
which is fine. When it is set to 0 then its value is not set in the OCI spec file as libpod treats it as unspecified by the user: https://github.com/containers/libpod/blob/master/pkg/spec/spec.go#L187-L189
So I think the issue is only in inspect
.
In the inspect output, should we convert 0 to 1024 which is the default "most of the time" value used for the cgroup? We can't really assume it though as we could re-use an existing cgroup or configure systemd to use a different value.
I don't see how we can make the inspect output better and make it clear that 0 means "it uses whatever value the cgroup is configured with". The same problem exists with other cgroup settings as well.
I would think that we set it to 1024 by default in the output, given that we should only be overriding it if the resource limits struct is actually present and populated in the spec?
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description From doc:
But when I run container without specifying
--cpu-shares
it has cpu-shares set to 0.Steps to reproduce the issue:
Describe the results you expected:
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):