From c31a5c0d9c9db52f03caa443a3fdfdce194046e8 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 1 Dec 2020 22:12:16 +0100 Subject: Add support for network ids The network ID is not stored. It is just the sha256 hash from the network name. There is a risk of a potential hash collision. However it's very unlikely and even if we hit this it will complain that more than network with this ID exists. The main benefit is that the compat api can have proper network ID support. Also this adds the support for `podman network ls --format "{{.ID}}"` and `--filter id=`. It also ensures that we can do network rm and network inspect . Since we use a hash this commit is backwards compatible even for already existing networks. Signed-off-by: Paul Holzinger --- pkg/api/server/register_networks.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pkg/api/server') diff --git a/pkg/api/server/register_networks.go b/pkg/api/server/register_networks.go index 193b05e6d..e6c85d244 100644 --- a/pkg/api/server/register_networks.go +++ b/pkg/api/server/register_networks.go @@ -68,6 +68,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // description: | // JSON encoded value of the filters (a map[string][]string) to process on the network list. Currently available filters: // - name=[name] Matches network name (accepts regex). + // - id=[id] Matches for full or partial ID. // - driver=[driver] Only bridge is supported. // - label=[key] or label=[key=value] Matches networks based on the presence of a label alone or a label and a value. // produces: @@ -225,6 +226,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // description: | // JSON encoded value of the filters (a map[string][]string) to process on the network list. Available filters: // - name=[name] Matches network name (accepts regex). + // - id=[id] Matches for full or partial ID. // - driver=[driver] Only bridge is supported. // - label=[key] or label=[key=value] Matches networks based on the presence of a label alone or a label and a value. // - plugin=[plugin] Matches CNI plugins included in a network (e.g `bridge`,`portmap`,`firewall`,`tuning`,`dnsname`,`macvlan`) -- cgit v1.2.3-54-g00ecf