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 unpause error output inconsistent #11098

Closed
srcshelton opened this issue Aug 2, 2021 · 3 comments · Fixed by #11113
Closed

podman unpause error output inconsistent #11098

srcshelton opened this issue Aug 2, 2021 · 3 comments · Fixed by #11113
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

@srcshelton
Copy link
Contributor

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

/kind bug

Description

$ sudo podman ps -a
Password:
CONTAINER ID  IMAGE                                            COMMAND               CREATED       STATUS         PORTS       NAMES
b66eefb501f7  localhost/service.app-admin.metalog:20200113-r1  -p /var/run/metal...  3 days ago    Up 3 days ago              openrc-metalog-20200113-r1
2e00f2032603  localhost/service.net-misc.openntpd:6.2_p3-r2    -d -f /etc/opennt...  3 days ago    Up 3 days ago              openrc-openntpd-6.2_p3-r2
8a8297f95023  localhost/gentoo-build:latest                    =sys-devel/gcc-10...  17 hours ago  paused                     buildpkg.hostpkgs.gcc.update

$ sudo podman unpause -a
8a8297f9502356fc1bc3032ba675640c6d3556e32ae03c59a45a5a902b77e11d
"2e00f2032603f4e5af2097cdf197abd8a3875d88887ee7f1c318dedcd8cd71d7" is not paused, can't unpause: container state improper
Error: "b66eefb501f793d59a2586e09dd44be489cbaf2493953b97133eefa6825a71c6" is not paused, can't unpause: container state improper

So the issues here appear to be:

  1. The "Error: " prefix from the second line of the unpause sub-command output seems to have got lost (or was correctly removed from second line but not the third?);
  2. Is it actually an error to have unpaused containers when you run unpause --all? It feels as if this is perhaps a warning at most - although since the specified containers are arguably already in the desired state, do they even need to be mentioned at all?

(I also have a nagging feeling that errors from other podman sub-commands don't enclose the container ID in double-quotes, but I've not verified this!)

Describe the results you expected:

No error messages should be produced when when no errors have occurred (this may be more nuanced when using the --all argument than when supplied with specific parameters).

Output of podman version:

Version:      3.2.3
API Version:  3.2.3
Go Version:   go1.16.6
Git Commit:   1e6fd46e91b21342f9454cf8105a92b90e398c52
Built:        Thu Jul 22 13:02:47 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.21.3
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - rdma
  cgroupManager: cgroupfs
  cgroupVersion: v2
  conmon:
    package: app-emulation/conmon-2.0.29
    path: /usr/bin/conmon
    version: 'conmon version 2.0.29, commit: 7e6de6678f6ed8a18661e1d5721b81ccee293b9b'
  cpus: 4
  distribution:
    distribution: gentoo
    version: unknown
  eventLogger: file
  hostname: apu2e
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.12.0-gentoo
  linkmode: dynamic
  memFree: 959692800
  memTotal: 4116377600
  ociRuntime:
    name: crun
    package: app-emulation/crun-0.20.1
    path: /usr/bin/crun
    version: |-
      crun version 0.20.1
      commit: 38271d1c8d9641a2cdc70acfa3dcb6996d124b3d
      spec: 1.0.0
      +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_AUDIT_WRITE,CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_MKNOD,CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 2449694720
  swapTotal: 2684350464
  uptime: 794h 45m 20.28s (Approximately 33.08 days)
registries:
  localhost:5000:
    Blocked: false
    Insecure: true
    Location: localhost:5000
    MirrorByDigestOnly: false
    Mirrors: []
    Prefix: localhost:5000
  search:
  - docker.io
  - docker.pkg.github.com
  - quay.io
  - public.ecr.aws
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 3
    paused: 0
    running: 3
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.ignore_chown_errors: "false"
  graphRoot: /storage/containers/podman/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 10
  runRoot: /storage/containers/podman/run
  volumePath: /storage/containers/podman/volumes
version:
  APIVersion: 3.2.3
  Built: 1626955367
  BuiltTime: Thu Jul 22 13:02:47 2021
  GitCommit: 1e6fd46e91b21342f9454cf8105a92b90e398c52
  GoVersion: go1.16.6
  OsArch: linux/amd64
  Version: 3.2.3

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

Yes

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 2, 2021
@mheon
Copy link
Member

mheon commented Aug 2, 2021

The second line isn't really having any output dropped, so much as the last line is having Error: prepended - if you had 6 containers error, only the last one would have an Error prefix. We can change this over to have every container error printed the same and print a trailing Error: 5 containers failed to unpause line, I suppose?

Otherwise, the unpause --all bit does sound reasonable - makes sense that it would not act on containers that are not paused, similar to stop --all does not error if containers are stopped already.

@jwhonce
Copy link
Member

jwhonce commented Aug 2, 2021

@mheon The pre-pending behavior is a holdover from podman v1. A number of commands print n-1 errors without prefix and then the "last" error gets decorated. I am fine with all errors getting the prefix, but we should do it for all commands not just this one.

@srcshelton
Copy link
Contributor Author

Ahh, I wondered if that'd be the case.

I'd +1 adding 'Error: ' to all relevant lines, because if you're string-parsing the command output (which I'm not, but it sounds like a use-case) then it's much easier to find all of the potential errors you might want to respond to that way.

But also yes, like stop -a it'd be helpful if containers already in the desired state didn't generate warnings/errors.

@rhatdan rhatdan self-assigned this Aug 3, 2021
rhatdan added a commit to rhatdan/podman that referenced this issue Aug 4, 2021
Currently if you execute podman unpause --all, podman pause --all
Podman shows attempts to unpause containers that are not paused
and prints an error.  This PR catches this error and only prints errors if
a paused container was not able to be unpaused.

Currently if you execute podman pause --all or podman kill --all, Podman
Podman shows attempts to pause or kill containers that are not running
and prints an error.  This PR catches this error and only prints errors if
a running container was not able to be paused or killed.

Also change printing of multiple errors to go to stderr and to prefix
"Error: " in front to match the output of the last error.

Fixes: containers#11098

Signed-off-by: Daniel J Walsh <[email protected]>
mheon pushed a commit to mheon/libpod that referenced this issue Aug 11, 2021
Currently if you execute podman unpause --all, podman pause --all
Podman shows attempts to unpause containers that are not paused
and prints an error.  This PR catches this error and only prints errors if
a paused container was not able to be unpaused.

Currently if you execute podman pause --all or podman kill --all, Podman
Podman shows attempts to pause or kill containers that are not running
and prints an error.  This PR catches this error and only prints errors if
a running container was not able to be paused or killed.

Also change printing of multiple errors to go to stderr and to prefix
"Error: " in front to match the output of the last error.

Fixes: containers#11098

Signed-off-by: Daniel J Walsh <[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 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 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.

4 participants