-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
podman stats as root broken #13824
Comments
Can you share how do you create your containers? Did you use the network connect/disconnect commands? |
The network is configured statically at pod create time like |
No this is about the network configuration.
This is the problem: podman/libpod/networking_linux.go Lines 949 to 950 in 311d66f
Should be a simple fix if you are interested in creating a PR for that. |
How is that supposed to work when the container has multiple interfaces? |
I don't think it does at the moment. The only idea would be to add the sum off all interfaces but I don't think this is a good idea either because of the potential integer overflow. |
If we currently imply the existence of an |
We already have the network interface names in the network status. This just needs to be changed so that we take a actual interface name from that. If there is no interface name in the status we need to skip obviously. |
My concern is whether it would be better to skip and give no data instead of picking one arbitrarily, especially if the API doesn't give feedback about which interface was picked, and give potentially misleading data. The method of picking an interface also should be deterministic based on the network name for consistency across hosts. |
I agree it should be deterministic but skipping it completely is not a good idea. Most people only have one interface so they do not care. Also there could be users who already rely on the returned network stats. |
Right, if there is only one then it would not be an arbitrary selection. But it might be better to skip if there are >1 for now. |
Ping. Do you ~argree on the solution? |
I checked what docker is doing. The api is returning the statistics per interface. Since we can not break the API at the moment I think we could add them in the backend for now (and fix it in 5.0). This should make it deterministic. Not sure if we need to prevent an integer overflow. |
Hardcoding the interface name is a bad idea. We have no control over the actual interface name since the user can change it. The correct thing is to read them from the network status. Since the contianer can have more than one interface we have to add the RX/TX values. The other values are currently not used. For podman 5.0 we should change it so that the API can return the statistics per interface and the client should sum the TX/RX for the command output. This is what docker is doing. Fixes containers#13824 Signed-off-by: Paul Holzinger <[email protected]>
Hardcoding the interface name is a bad idea. We have no control over the actual interface name since the user can change it. The correct thing is to read them from the network status. Since the contianer can have more than one interface we have to add the RX/TX values. The other values are currently not used. For podman 5.0 we should change it so that the API can return the statistics per interface and the client should sum the TX/RX for the command output. This is what docker is doing. Fixes containers#13824 Signed-off-by: Paul Holzinger <[email protected]>
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Steps to reproduce the issue:
Install podman on Arch Linux (4.0.3), Centos 8 Stream (4.0.2) or use Fedora Coreos (4.0.2)
log in as root
podman stats
Describe the results you received:
It just prints
Error: Link not found
Describe the results you expected:
not that
Additional information you deem important (e.g. issue happens only occasionally):
podman stats
seems to work when run as non-root, tested on Arch Linux, but I get the same error there when run as root.Using the socket API:
curl --unix-socket /run/podman/podman.sock 'http://d/v4.0.0/libpod/containers/stats'
{"Error":{},"Stats":null}
Output of
podman version
:4.0.3 and 4.0.2
** podman info -D **
From coreos:
The text was updated successfully, but these errors were encountered: