Skip to content

Commit

Permalink
rootless v2 cannot collect network stats
Browse files Browse the repository at this point in the history
network statistics cannot be collected for rootless network devices with
the current implementation.  for now, we return nil so that stats will
at least for users.

Fixes:containers#4268

Signed-off-by: baude <[email protected]>
  • Loading branch information
baude committed Oct 15, 2019
1 parent 5f72e6e commit f10f9bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/podman-stats.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Note: Podman stats will not work in rootless environments that use CGroups V1.
Podman stats relies on CGroup information for statistics, and CGroup v1 is not
supported for rootless use cases.

Note: Rootless environments that use CGroups V2 are not able to report statistics
about their networking usage.

## OPTIONS

**--all**, **-a**
Expand Down
6 changes: 6 additions & 0 deletions libpod/networking_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,12 @@ func getContainerNetNS(ctr *Container) (string, error) {

func getContainerNetIO(ctr *Container) (*netlink.LinkStatistics, error) {
var netStats *netlink.LinkStatistics
// rootless v2 cannot seem to resolve its network connection to
// collect statistics. For now, we allow stats to at least run
// by returning nil
if rootless.IsRootless() {
return netStats, nil
}
netNSPath, netPathErr := getContainerNetNS(ctr)
if netPathErr != nil {
return nil, netPathErr
Expand Down

0 comments on commit f10f9bc

Please sign in to comment.