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

support "podman network ls --filter dangling=true" #14595

Closed
holgerschurig opened this issue Jun 15, 2022 · 4 comments · Fixed by #14643
Closed

support "podman network ls --filter dangling=true" #14595

holgerschurig opened this issue Jun 15, 2022 · 4 comments · Fixed by #14643
Assignees
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@holgerschurig
Copy link

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

/kind feature

Description

The docker.el module for Emacs (see https://github.com/Silex/docker.el) uses "podman network ls --filter dangling=true"). Unfortunately, Podman doesn't support this yet.

Steps to reproduce the issue:

Emacs runs first

$ podman network ls --format="[{{ json .ID }},{{ json .ID }},{{ json .Name }},{{ json .Driver }}]"

to get all networks available and then it runs

$ podman network ls --filter dangling=true --format="[{{ json .ID }},{{ json .ID }},{{ json .Name }},{{ json .Driver }}]"

to get only the dangling ones. It uses this information to mark the dangling ones for it's GUI display.

This last call however returns an error:

$ podman network ls --filter dangling=true --format="[{{ json .ID }},{{ json .ID }},{{ json .Name }},{{ json .Driver }}]"
Error: invalid filter "dangling"

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

Output of podman version:

$ podman version
Client:       Podman Engine
Version:      4.2.0-dev
API Version:  4.2.0-dev
Go Version:   go1.17.11
Git Commit:   9fac1b335f681400a029e9d8014f45fa5634ec40
Built:        Tue Jun 14 13:53:13 2022
OS/Arch:      linux/amd64

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)

Sure

Commands that support dangling=true already

Emacs also uses

  • podman image ls --filter dangling=true
  • podman volume ls --filter dangling=true

These commands support the dangling filter.

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 15, 2022
@rhatdan rhatdan added the Good First Issue This issue would be a good issue for a first time contributor to undertake. label Jun 15, 2022
@rhatdan
Copy link
Member

rhatdan commented Jun 15, 2022

@cdoern PTAL

@clobrano
Copy link
Contributor

Hey, I am new to podman and I'd like to work on this if possible

@rhatdan
Copy link
Member

rhatdan commented Jun 16, 2022

You got it.

@clobrano
Copy link
Contributor

I had a look at it and, my assumptions are:

A: the filtering function is the one created in common/libnetwork/util/filters.go:createFilterFuncs()
B: a similar functionality is already implemented in podman/pkg/domain/infra/abi/network.go:NetworkPrune()

About (A), I think I could even patch libnetwork, but the logic implemented in (B) makes use of the list of all containers, which I believe libnetwork does not have access to, nor it needs to know.
I think this is also the reason why the same NetworkPrune() defines its own danglingFilterFunction() and pushes it into the list of filters given by libnetwork, which I think would be the same approach to be used here.

Regarding the tests, I think the new test shall go into test/e2e/network_test.go, together with the other podman network tests, is that right?

If that so, I could use GenerateNetworkConfig for testing the --filter dangling=true, since I believe a newly created network is automatically dangling.

clobrano added a commit to clobrano/podman that referenced this issue Jun 17, 2022
add the ability to filter networks by their dangling status via:

`network ls --filter dangling=true/false`

Fixes: containers#14595
clobrano added a commit to clobrano/podman that referenced this issue Jun 17, 2022
add the ability to filter networks by their dangling status via:

`network ls --filter dangling=true/false`

Fixes: containers#14595
Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
clobrano added a commit to clobrano/podman that referenced this issue Jun 17, 2022
add the ability to filter networks by their dangling status via:

`network ls --filter dangling=true/false`

Fixes: containers#14595
Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
clobrano added a commit to clobrano/podman that referenced this issue Jun 17, 2022
add the ability to filter networks by their dangling status via:

`network ls --filter dangling=true/false`

Fixes: containers#14595
Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
clobrano added a commit to clobrano/podman that referenced this issue Jun 17, 2022
add the ability to filter networks by their dangling status via:

`network ls --filter dangling=true/false`

Fixes: containers#14595
Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
clobrano added a commit to clobrano/podman that referenced this issue Jun 18, 2022
add the ability to filter networks by their dangling status via:

`network ls --filter dangling=true/false`

Fixes: containers#14595
Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
clobrano added a commit to clobrano/podman that referenced this issue Jun 20, 2022
add the ability to filter networks by their dangling status via:

`network ls --filter dangling=true/false`

Fixes: containers#14595
Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
clobrano added a commit to clobrano/podman that referenced this issue Jun 20, 2022
add the ability to filter networks by their dangling status via:

`network ls --filter dangling=true/false`

Fixes: containers#14595
Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
clobrano added a commit to clobrano/podman that referenced this issue Jun 21, 2022
add the ability to filter networks by their dangling status via:

`network ls --filter dangling=true/false`

Fixes: containers#14595
Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
karthikelango137 pushed a commit to karthikelango137/podman that referenced this issue Jul 5, 2022
add the ability to filter networks by their dangling status via:

`network ls --filter dangling=true/false`

Fixes: containers#14595
Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
gbraad pushed a commit to gbraad-redhat/podman that referenced this issue Jul 13, 2022
add the ability to filter networks by their dangling status via:

`network ls --filter dangling=true/false`

Fixes: containers#14595
Signed-off-by: Carlo Lobrano <c.lobrano@gmail.com>
@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/feature Categorizes issue or PR as related to a new feature. 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.

3 participants