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

Multiple filter options do not act as logical AND for volume ls #19219

Closed
hickeng opened this issue Jul 13, 2023 · 5 comments · Fixed by #19269
Closed

Multiple filter options do not act as logical AND for volume ls #19219

hickeng opened this issue Jul 13, 2023 · 5 comments · Fixed by #19269
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

@hickeng
Copy link

hickeng commented Jul 13, 2023

Issue Description

Proximately the same issue as was described for ps in #1341

Using multiple --filter option on volumes is an OR but should be AND.

Steps to reproduce the issue

Steps to reproduce the issue:

  1. Create test volumes using the follow commands
  2. Query volumes using multiple filters
[root@localhost tmp]# docker volume create --label a=b --label b=a podman-test-a
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
podman-test-a
[root@localhost tmp]# docker volume create --label a=b --label c=d podman-test-b
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
podman-test-b
[root@localhost tmp]# docker volume create --label c=d --label e=f podman-test-c
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
podman-test-c
[root@localhost tmp]#

Query with compound filters:

[root@localhost tmp]# docker volume ls -q --filter label=a=b --filter label=c=d
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
podman-test-a
podman-test-b
podman-test-c
[root@localhost tmp]#

Describe the results you received

Lists all volumes matching either label

[root@localhost tmp]# docker volume ls -q --filter label=a=b --filter label=c=d
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
podman-test-a
podman-test-b
podman-test-c
[root@localhost tmp]#

Describe the results you expected

Lists only the volumes matching all the specified filters:

[root@localhost tmp]# docker volume ls -q --filter label=a=b --filter label=c=d
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
podman-test-b
[root@localhost tmp]#

podman info output

host:
  arch: amd64
  buildahVersion: 1.29.0
  cgroupControllers:
  - cpuset
  - cpu
  - cpuacct
  - blkio
  - memory
  - devices
  - freezer
  - net_cls
  - perf_event
  - net_prio
  - hugetlb
  - pids
  - rdma
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon-2.1.5-1.fc36.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.5, commit: '
  cpuUtilization:
    idlePercent: 99.78
    systemPercent: 0.02
    userPercent: 0.19
  cpus: 8
  distribution:
    distribution: fedora
    variant: container
    version: "36"
  eventLogger: file
  hostname: localhost
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.10.102.1-microsoft-standard-WSL2
  linkmode: dynamic
  logDriver: k8s-file
  memFree: 1144238080
  memTotal: 8190472192
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.8.1-1.fc36.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.8.1
      commit: f8a096be060b22ccd3d5f3ebe44108517fbf6c30
      rundir: /root/.run/containers/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +WASM:wasmedge +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_NET_RAW,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: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  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: 2147483648
  swapTotal: 2147483648
  uptime: 166h 12m 0.00s (Approximately 6.92 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 4
    paused: 0
    running: 2
    stopped: 2
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: fuse-overlayfs-1.9-6.fc36.x86_64
      Version: |-
        fusermount3 version: 3.10.5
        fuse-overlayfs: version 1.9
        FUSE library version 3.10.5
        using FUSE kernel interface version 7.31
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 269490393088
  graphRootUsed: 14522699776
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 5
  runRoot: /run/containers/storage
  transientStore: false
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 4.4.1
  Built: 1676629882
  BuiltTime: Fri Feb 17 02:31:22 2023
  GitCommit: ""
  GoVersion: go1.18.10
  Os: linux
  OsArch: linux/amd64
  Version: 4.4.1

Podman in a container

No

Privileged Or Rootless

Privileged

Upstream Latest Release

No

Additional environment details

WSL environment created using podman-machine

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

@hickeng hickeng added the kind/bug Categorizes issue or PR as related to a bug. label Jul 13, 2023
@vrothberg
Copy link
Member

Thanks for reaching out and providing the reproducer, @hickeng !

@vrothberg
Copy link
Member

@jakecorrenti, interested in tackling this one? Currently, any filter must match to return a volume but to match Docker, all filters must match. Should also be made clear in the docs.

@mheon was that intentional?

@jakecorrenti
Copy link
Member

sure thing, I'll take a look!

@jakecorrenti
Copy link
Member

/assign

@mheon
Copy link
Member

mheon commented Jul 13, 2023

@vrothberg I have no memory of this but I can't see doing it intentionally.

jakecorrenti added a commit to jakecorrenti/podman that referenced this issue Jul 18, 2023
Fixes a bug where `podman volume ls` with multiple `label` filters would
return volumes that matched *any* of the filters, not *all* of them.

Adapts generating volume filter functions to be more in
line with how it is done for containers and pods.

Fixes: containers#19219

Signed-off-by: Jake Correnti <[email protected]>
ashley-cui pushed a commit to ashley-cui/podman that referenced this issue Jul 20, 2023
Fixes a bug where `podman volume ls` with multiple `label` filters would
return volumes that matched *any* of the filters, not *all* of them.

Adapts generating volume filter functions to be more in
line with how it is done for containers and pods.

Fixes: containers#19219

Signed-off-by: Jake Correnti <[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 Oct 17, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 17, 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