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 system df --format "{{json .}}" doesn't output "Size" and "Reclaimable" columns #14769

Closed
joachimBurket opened this issue Jun 29, 2022 · 6 comments · Fixed by #14805
Closed
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

@joachimBurket
Copy link

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Steps to reproduce the issue:

  1. podman system df

  2. podman system df --format "{{json .}}}"

Describe the results you received:

$ podman system df

TYPE           TOTAL       ACTIVE      SIZE        RECLAIMABLE
Images         89          5           59.2GB      57.58GB (97%)
Containers     0           0           0B          0B (0%)
Local Volumes  4           0           124MB       247.9MB (200%)

$ podman system df --format "{{json .}}}"
{"Type":"Images","Total":89,"Active":5}}
{"Type":"Containers","Total":0,"Active":0}}
{"Type":"Local Volumes","Total":4,"Active":0}}

Describe the results you expected:

The podman system df --format "{{json .}}}" command should also output the Size and Reclaimable fields.

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

Output of podman version:

Client:       Podman Engine
Version:      4.1.1
API Version:  4.1.1
Go Version:   go1.18.3
Built:        Wed Jun 15 16:31:58 2022
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.26.1
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.0-2.fc36.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: '
  cpuUtilization:
    idlePercent: 63.17
    systemPercent: 5.89
    userPercent: 30.95
  cpus: 4
  distribution:
    distribution: fedora
    variant: workstation
    version: "36"
  eventLogger: journald
  hostname: fedora
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.18.6-200.fc36.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 7157645312
  memTotal: 16457158656
  networkBackend: cni
  ociRuntime:
    name: crun
    package: crun-1.4.5-1.fc36.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.4.5
      commit: c381048530aa750495cf502ddb7181f2ded5b400
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-0.2.beta.0.fc36.x86_64
    version: |-
      slirp4netns version 1.2.0-beta.0
      commit: 477db14a24ff1a3de3a705e51ca2c4c1fe3dda64
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 8589930496
  swapTotal: 8589930496
  uptime: 24h 39m 39.32s (Approximately 1.00 days)
plugins:
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - docker.io
store:
  configFile: /home/joachim/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/joachim/.local/share/containers/storage
  graphRootAllocated: 748592037888
  graphRootUsed: 119622201344
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 89
  runRoot: /run/user/1000/containers
  volumePath: /home/joachim/.local/share/containers/storage/volumes
version:
  APIVersion: 4.1.1
  Built: 1655303518
  BuiltTime: Wed Jun 15 16:31:58 2022
  GitCommit: ""
  GoVersion: go1.18.3
  Os: linux
  OsArch: linux/amd64
  Version: 4.1.1

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

podman-4.1.1-1.fc36.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

Yes

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

Physical

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 29, 2022
@vrothberg
Copy link
Member

Thanks for reaching out, @joachimBurket!

The podman system df --format "{{json .}}}" command should also output the Size and Reclaimable fields.

Docker prints these fields, so Podman should too.

@vrothberg
Copy link
Member

@ashley-cui @mheon looks like a nice issue for interns to get familiar with the formatting code.

@vrothberg vrothberg added the Good First Issue This issue would be a good issue for a first time contributor to undertake. label Jun 29, 2022
@jakecorrenti
Copy link
Member

I can try and give this a shot in my free time

@vrothberg
Copy link
Member

It's yours, @jakecorrenti. Thanks!

@rhatdan
Copy link
Member

rhatdan commented Jun 30, 2022

I took a quick look at this. @jakecorrenti is correct the exporting of these flags is the problem The problem is the func
Size and Reclaimable which return Human readable content for non JSON output is conflicting with Size and Reclaimable in the structure. Sadly I have no idea how to fix this.
@jwhonce Ideas?
Bottom line we want json to reflect raw data and all other --formats to print human readable.

jakecorrenti pushed a commit to jakecorrenti/podman that referenced this issue Jul 1, 2022
Previously, `podman system df --format "{{json .}}"` would not output
`Size` and `Reclaimable` like `podman system df` would.

```
{"Type":"Images","Total":5,"Active":0,"Size":39972240,"Reclaimable":39972240}
{"Type":"Containers","Total":0,"Active":0,"Size":0,"Reclaimable":0}
{"Type":"Local Volumes","Total":0,"Active":0,"Size":0,"Reclaimable":0}
```

Closes: containers#14769

Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
jakecorrenti pushed a commit to jakecorrenti/podman that referenced this issue Jul 5, 2022
Previously, `podman system df --format "{{json .}}"` would not output
`Size` and `Reclaimable` like `podman system df` would.

```
{"Type":"Images","Total":5,"Active":0,"Size":39972240,"Reclaimable":39972240}
{"Type":"Containers","Total":0,"Active":0,"Size":0,"Reclaimable":0}
{"Type":"Local Volumes","Total":0,"Active":0,"Size":0,"Reclaimable":0}
```

Closes: containers#14769

Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
@joachimBurket
Copy link
Author

Thanks @jakecorrenti ! 🎉

@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 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 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