Fix podman inspect to correctly handle log_size_max

When generating Conmon's command line, we read containers.conf to
get log_size_max and used it if the container didn't override it.
However, `podman inspect` only reads from the container's own
config, and ignores containers.conf. Unify the way we determine
maximum log size with a single function and use it for both
inspect and containers.conf, and add a test for this behavior.

Fixes https://issues.redhat.com/browse/RHEL-96776

Signed-off-by: Matt Heon <mheon@redhat.com>
This commit is contained in:
Matt Heon
2025-07-02 16:40:44 -04:00
parent 8234879708
commit 13816eb86f
5 changed files with 34 additions and 6 deletions

View File

@ -1342,10 +1342,7 @@ func (r *ConmonOCIRuntime) sharedConmonArgs(ctr *Container, cuuid, bundlePath, p
logrus.Debugf("%s messages will be logged to syslog", r.conmonPath)
args = append(args, "--syslog")
size := r.logSizeMax
if ctr.config.LogSize > 0 {
size = ctr.config.LogSize
}
size := ctr.LogSizeMax()
if size > 0 {
args = append(args, "--log-size-max", strconv.FormatInt(size, 10))
}