Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"PodName" property in Containers object never filled by the Rest API #7214

Closed
KKoukiou opened this issue Aug 4, 2020 · 9 comments · Fixed by #7223
Closed

"PodName" property in Containers object never filled by the Rest API #7214

KKoukiou opened this issue Aug 4, 2020 · 9 comments · Fixed by #7223
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@KKoukiou
Copy link
Contributor

KKoukiou commented Aug 4, 2020

/kind bug

Description

When listing containers through the Rest API there is PodName property which should be there according to the documentation but it's always empty string. "Pod" property contains the Pod ID and can be used to identify the pods instead.

Steps to reproduce the issue:

  1. sudo curl --unix-socket /run/podman/podman.sock http://d/v1.24/libpod/containers/json | jq
{
    "Command": [
      "bash"
    ],
...
    "Pod": "8cc10866fa4c22029afc01846525ed96fa726384ad95884b7d99e9a09ed4c642",
    "PodName": "",
...
  }
]

Output of podman version:

podman version 2.0.4

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.15.0
  cgroupVersion: v1
  conmon:
    package: conmon-2.0.19-1.fc32.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.19, commit: 5dce9767526ed27f177a8fa3f281889ad509fea7'
  cpus: 4
  distribution:
    distribution: fedora
    version: "32"
  eventLogger: file
  hostname: sequioa
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.7.8-200.fc32.x86_64
  linkmode: dynamic
  memFree: 241860608
  memTotal: 11945615360
  ociRuntime:
    name: runc
    package: runc-1.0.0-144.dev.gite6555cc.fc32.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc10+dev
      commit: fbdbaf85ecbc0e077f336c03062710435607dbf1
      spec: 1.0.1-dev
  os: linux
  remoteSocket:
    exists: true
    path: /run/podman/podman.sock
  rootless: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 4742705152
  swapTotal: 6039793664
  uptime: 26h 3m 13.98s (Approximately 1.08 days)
registries:
  localhost:5000:
    Blocked: false
    Insecure: true
    Location: localhost:5000
    MirrorByDigestOnly: false
    Mirrors: []
    Prefix: localhost:5000
  search:
  - localhost:5000
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 2
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 8
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 1
  Built: 0
  BuiltTime: Thu Jan  1 01:00:00 1970
  GitCommit: ""
  GoVersion: go1.14.6
  OsArch: linux/amd64
  Version: 2.0.4

Package info (e.g. output of rpm -q podman or apt list podman):

podman-2.0.4-1.fc32.x86_64
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 4, 2020
@rhatdan
Copy link
Member

rhatdan commented Aug 4, 2020

Does the pod actually have a name?

@KKoukiou
Copy link
Contributor Author

KKoukiou commented Aug 4, 2020

Does the pod actually have a name?

Sure, with sudo podman pod inspect I can see the Name property, I double verified now.

@rhatdan
Copy link
Member

rhatdan commented Aug 4, 2020

The code is looking for a opts.Pod option to be set to get this information.

	if opts.Pod && len(conConfig.Pod) > 0 {
		pod, err := rt.GetPod(conConfig.Pod)
		if err != nil {
			return entities.ListContainer{}, err
		}
		ps.PodName = pod.Name()
	}

@KKoukiou
Copy link
Contributor Author

KKoukiou commented Aug 4, 2020

@rhatdan Oh right - my fault.

The documentation clearly says it, https://podman.readthedocs.io/en/latest/_static/api.html#operation/libpodListContainers

That opts.Pod should be set to get information about the pod (Id, Name) when listing containers.

It was confusing because I did not set that parameter, but the PodId was present in the container details (which should be missing according to the docs) - in my case only the PodName was missing.

@KKoukiou KKoukiou closed this as completed Aug 4, 2020
@rhatdan
Copy link
Member

rhatdan commented Aug 4, 2020

I am wondering why we don't return it always. I think this might be a performance issue.

@mheon @baude Ideas?

@mheon
Copy link
Member

mheon commented Aug 4, 2020 via email

@baude baude self-assigned this Aug 4, 2020
@baude
Copy link
Member

baude commented Aug 4, 2020

ill take this one and look into it.

@baude
Copy link
Member

baude commented Aug 4, 2020

talked to @mheon , we have a good way to do this and not make it too much a perf hit.

@baude
Copy link
Member

baude commented Aug 4, 2020

as such, @mheon is taking this over as it in involves a db call.

@mheon mheon reopened this Aug 4, 2020
mheon added a commit to mheon/libpod that referenced this issue Aug 10, 2020
The ListContainers API previously had a Pod parameter, which
determined if pod name was returned (but, notably, not Pod ID,
which was returned unconditionally). This was fairly confusing,
so we decided to deprecate/remove the parameter and return it
unconditionally.

To do this without serious performance implications, we need to
avoid expensive JSON decodes of pod configuration in the DB. The
way our Bolt tables are structured, retrieving name given ID is
actually quite cheap, but we did not expose this via the Libpod
API. Add a new GetName API to do this.

Fixes containers#7214

Signed-off-by: Matthew Heon <[email protected]>
mheon added a commit to mheon/libpod that referenced this issue Aug 17, 2020
The ListContainers API previously had a Pod parameter, which
determined if pod name was returned (but, notably, not Pod ID,
which was returned unconditionally). This was fairly confusing,
so we decided to deprecate/remove the parameter and return it
unconditionally.

To do this without serious performance implications, we need to
avoid expensive JSON decodes of pod configuration in the DB. The
way our Bolt tables are structured, retrieving name given ID is
actually quite cheap, but we did not expose this via the Libpod
API. Add a new GetName API to do this.

Fixes containers#7214

Signed-off-by: Matthew Heon <[email protected]>
mheon added a commit to mheon/libpod that referenced this issue Aug 20, 2020
The ListContainers API previously had a Pod parameter, which
determined if pod name was returned (but, notably, not Pod ID,
which was returned unconditionally). This was fairly confusing,
so we decided to deprecate/remove the parameter and return it
unconditionally.

To do this without serious performance implications, we need to
avoid expensive JSON decodes of pod configuration in the DB. The
way our Bolt tables are structured, retrieving name given ID is
actually quite cheap, but we did not expose this via the Libpod
API. Add a new GetName API to do this.

Fixes containers#7214

Signed-off-by: Matthew Heon <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants