diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-03-27 11:46:33 +0100 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-03-28 17:32:22 +0100 |
commit | 9812804f754120fcf14256bf0ed9cd00c36bf9f7 (patch) | |
tree | f9412fd2ac6cdfba7c688aaf122c97e5f2e1701a /libpod | |
parent | cc129d13c5b8b80f542dbc6192ff3d5df29b47ee (diff) | |
download | podman-9812804f754120fcf14256bf0ed9cd00c36bf9f7.tar.gz podman-9812804f754120fcf14256bf0ed9cd00c36bf9f7.tar.bz2 podman-9812804f754120fcf14256bf0ed9cd00c36bf9f7.zip |
podmanv2: implement pod top
Implement `podman pod top` for podmanV2.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/pod_top_linux.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libpod/pod_top_linux.go b/libpod/pod_top_linux.go index 80221c3a9..1f84c8667 100644 --- a/libpod/pod_top_linux.go +++ b/libpod/pod_top_linux.go @@ -41,12 +41,23 @@ func (p *Pod) GetPodPidInformation(descriptors []string) ([]string, error) { } c.lock.Unlock() } + + // Also support comma-separated input. + psgoDescriptors := []string{} + for _, d := range descriptors { + for _, s := range strings.Split(d, ",") { + if s != "" { + psgoDescriptors = append(psgoDescriptors, s) + } + } + } + // TODO: psgo returns a [][]string to give users the ability to apply // filters on the data. We need to change the API here and the // varlink API to return a [][]string if we want to make use of // filtering. opts := psgo.JoinNamespaceOpts{FillMappings: rootless.IsRootless()} - output, err := psgo.JoinNamespaceAndProcessInfoByPidsWithOptions(pids, descriptors, &opts) + output, err := psgo.JoinNamespaceAndProcessInfoByPidsWithOptions(pids, psgoDescriptors, &opts) if err != nil { return nil, err } |