From 63dd200e7e47261454c7e55fed2ad972144e147f Mon Sep 17 00:00:00 2001 From: haircommander Date: Wed, 22 Aug 2018 13:13:07 -0400 Subject: Changed GetContainerStats to return ErrCtrStateInvalid This results in some functionality changes: If a ErrCtrStateInvalid is returned to GetPodStats, the container is ommitted from the stats. As such, if an empty slice of Container stats are returned to GetPodStats in varlink, an error will occur. GetContainerStats will return the ErrCtrStateInvalid as well. Finally, if ErrCtrStateInvalid is returned to the podman stats call, the container will be ommitted from the stats. Signed-off-by: haircommander Closes: #1319 Approved by: baude --- cmd/podman/varlink/io.podman.varlink | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd/podman/varlink') diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink index 2fc53b43e..cd75b3b5f 100644 --- a/cmd/podman/varlink/io.podman.varlink +++ b/cmd/podman/varlink/io.podman.varlink @@ -441,7 +441,8 @@ method ExportContainer(name: string, path: string) -> (tarfile: string) # GetContainerStats takes the name or ID of a container and returns a single ContainerStats structure which # contains attributes like memory and cpu usage. If the container cannot be found, a -# [ContainerNotFound](#ContainerNotFound) error will be returned. +# [ContainerNotFound](#ContainerNotFound) error will be returned. If the container is not running, a [NoContainerRunning](#NoContainerRunning) +# error will be returned # #### Example # ~~~ # $ varlink call -m unix:/run/podman/io.podman/io.podman.GetContainerStats '{"name": "c33e4164f384"}' @@ -759,6 +760,7 @@ method TopPod() -> (notimplemented: NotImplemented) # GetPodStats takes the name or ID of a pod and returns a pod name and slice of ContainerStats structure which # contains attributes like memory and cpu usage. If the pod cannot be found, a [PodNotFound](#PodNotFound) +# error will be returned. If the pod has no running containers associated with it, a [NoContainerRunning](#NoContainerRunning) # error will be returned. # #### Example # ~~~ @@ -792,6 +794,9 @@ error ImageNotFound (name: string) # ContainerNotFound means the container could not be found by the provided name or ID in local storage. error ContainerNotFound (name: string) +# NoContainerRunning means none of the containers requested are running in a command that requires a running container. +error NoContainerRunning () + # PodNotFound means the pod could not be found by the provided name or ID in local storage. error PodNotFound (name: string) -- cgit v1.2.3-54-g00ecf