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

podman inspect -t container --size myctr not working #4744

Closed
TomSweeneyRedHat opened this issue Dec 23, 2019 · 6 comments · Fixed by #4753
Closed

podman inspect -t container --size myctr not working #4744

TomSweeneyRedHat opened this issue Dec 23, 2019 · 6 comments · Fixed by #4753
Assignees
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. 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

@TomSweeneyRedHat
Copy link
Member

TomSweeneyRedHat commented Dec 23, 2019

/kind bug

Description

The --size option in a command like:

podman inspect -t container --size myctr

is being ignored. Instead of just the size being returned, the whole inspect output is instead shown.

Steps to reproduce the issue:

  1. podman pull alpine

  2. podman run --name=myctr alpine ls /etc/network

  3. podman inspect --size -t container myctr

Describe the results you received:

Full inspect output of the container showing all fields and values.

Describe the results you expected:

Just the size of the container per the man page.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

# podman version
Version:            1.6.2
RemoteAPI Version:  1
Go Version:         go1.13.1
OS/Arch:            linux/amd64

Output of podman info --debug:

# podman version
Version:            1.6.2
RemoteAPI Version:  1
Go Version:         go1.13.1
OS/Arch:            linux/amd64
[root@localhost ~]# podman info --debug
debug:
  compiler: gc
  git commit: ""
  go version: go1.13.1
  podman version: 1.6.2
host:
  BuildahVersion: 1.11.3
  CgroupVersion: v2
  Conmon:
    package: conmon-2.0.2-1.fc31.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.2, commit: 186a550ba0866ce799d74006dab97969a2107979'
  Distribution:
    distribution: fedora
    version: "31"
  MemFree: 1194172416
  MemTotal: 2083917824
  OCIRuntime:
    name: crun
    package: crun-0.10.6-1.fc31.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.10.6
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  SwapFree: 2147479552
  SwapTotal: 2147479552
  arch: amd64
  cpus: 1
  eventlogger: journald
  hostname: localhost.localdomain
  kernel: 5.3.16-300.fc31.x86_64
  os: linux
  rootless: false
  uptime: 4h 19m 2.13s (Approximately 0.17 days)
registries:
  blocked: null
  insecure: null
  search:
  - docker.io
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - quay.io
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 1
  GraphDriverName: overlay
  GraphOptions:
    overlay.mountopt: nodev,metacopy=on
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  ImageStore:
    number: 1
  RunRoot: /var/run/containers/storage
  VolumePath: /var/lib/containers/storage/volumes

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

# rpm -q podman
podman-1.6.2-2.fc31.x86_64

Additional environment details (AWS, VirtualBox, physical, etc.):

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 23, 2019
@mheon
Copy link
Member

mheon commented Dec 23, 2019

I think we expect --size to show everything plus size - if size is being shown, it should be working right. I think you need a --format to get just the size.

@TomSweeneyRedHat TomSweeneyRedHat added the Good First Issue This issue would be a good issue for a first time contributor to undertake. label Dec 23, 2019
@TomSweeneyRedHat
Copy link
Member Author

If size is being shown, I'm losing it in all of the output and I'm not gronking it with grep:

 podman inspect --size -t container myctr | grep ize
        "SizeRootFs": 5591300,
            "ShmSize": 65536000,
            "ConsoleSize": [

@mheon
Copy link
Member

mheon commented Dec 23, 2019

Hm. I'll take a look

@NevilleC
Copy link
Collaborator

If this issue is still available, I am happy to take it too.

But when reading the comments and the issue description, I get confused:
do we want to display all the fields + the size or only the size?

@TomSweeneyRedHat
Copy link
Member Author

@NevilleC the man page says:

–size, -s

Display the total file size if the type is a container

So in my book, we should only display the size of the container. I'll let @mheon correct that if necessary, and then we may need to also adjust the man page too. @NevilleC I've assigned the issue to you, thanks for hopping on to it!

@mheon
Copy link
Member

mheon commented Dec 27, 2019

Per Docker, we should display the full output of inspect per usual, but actually populate the SizeRw and SizeRootFs fields (which are otherwise always 0)

NevilleC added a commit to NevilleC/libpod that referenced this issue Dec 27, 2019
Currently, if a user requests the size on a container (inspect --size -t container),
the SizeRw does not show up if the value is 0. It's because InspectContainerData is
defined as int64 and there is an omit when empty.

We do want to display it even if the value is empty. I have changed the type of SizeRw to be a pointer to an int64 instead of an int64. It will allow us todistinguish the empty value to the missing value.

I updated the test "podman inspect container with size" to ensure we check thatSizeRw is displayed correctly.

Closes containers#4744

Signed-off-by: NevilleC <neville.cain@qonto.eu>
edsantiago pushed a commit to edsantiago/libpod that referenced this issue Dec 28, 2019
Currently, if a user requests the size on a container (inspect --size -t container),
the SizeRw does not show up if the value is 0. It's because InspectContainerData is
defined as int64 and there is an omit when empty.

We do want to display it even if the value is empty. I have changed the type of SizeRw to be a pointer to an int64 instead of an int64. It will allow us todistinguish the empty value to the missing value.

I updated the test "podman inspect container with size" to ensure we check thatSizeRw is displayed correctly.

Closes containers#4744

Signed-off-by: NevilleC <neville.cain@qonto.eu>
@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
Good First Issue This issue would be a good issue for a first time contributor to undertake. 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.

4 participants