libpod: Factor out jail name construction from stats_freebsd.go

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
This commit is contained in:
Doug Rabson
2022-10-09 08:13:30 +01:00
parent b82b27cc48
commit 21081355a7
2 changed files with 10 additions and 6 deletions

View File

@ -20,13 +20,9 @@ import (
func (c *Container) getPlatformContainerStats(stats *define.ContainerStats, previousStats *define.ContainerStats) error {
now := uint64(time.Now().UnixNano())
jailName := c.ID()
if c.state.NetNS != nil {
jailName = c.state.NetNS.Name + "." + jailName
}
entries, err := rctl.GetRacct("jail:" + jailName)
entries, err := rctl.GetRacct("jail:" + c.jailName())
if err != nil {
return fmt.Errorf("unable to read accounting for %s: %w", jailName, err)
return fmt.Errorf("unable to read accounting for %s: %w", c.jailName(), err)
}
// If the current total usage is less than what was previously