Add support for passing container stop timeout as -1 (infinite)

Compat api for containers/stop should take -1 value

Add support for `podman stop --time -1`
Add support for `podman restart --time -1`
Add support for `podman rm --time -1`
Add support for `podman pod stop --time -1`
Add support for `podman pod rm --time -1`
Add support for `podman volume rm --time -1`
Add support for `podman network rm --time -1`

Fixes: https://github.com/containers/podman/issues/17542

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2023-07-29 08:08:31 -04:00
parent 1440985877
commit 1e54539432
24 changed files with 73 additions and 40 deletions

View File

@ -648,3 +648,11 @@ func ParseRestartPolicy(policy string) (string, uint, error) {
}
return policyType, retriesUint, nil
}
// ConvertTimeout converts negative timeout to MaxInt, which indicates approximately infinity, waiting to stop containers
func ConvertTimeout(timeout int) uint {
if timeout < 0 {
return math.MaxInt
}
return uint(timeout)
}