diff options
author | baude <bbaude@redhat.com> | 2020-11-10 12:41:16 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2020-11-10 14:00:54 -0600 |
commit | b917b9925cb17ecb36472ab1122a1891825af38b (patch) | |
tree | 657cd72148fb7cbf143bbf79c29797bbca6cfc8a /pkg/api/handlers/libpod | |
parent | ca672373b5def7b4aed695622ba560fb407f1bf9 (diff) | |
download | podman-b917b9925cb17ecb36472ab1122a1891825af38b.tar.gz podman-b917b9925cb17ecb36472ab1122a1891825af38b.tar.bz2 podman-b917b9925cb17ecb36472ab1122a1891825af38b.zip |
Set default network driver for APIv2 networks
Recent changes in networking require that the cni network driver be set.
If the user provides no driver, we set the driver to the
defaultnetworkdriver which currently is "bridge".
Fixes: #8294
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/api/handlers/libpod')
-rw-r--r-- | pkg/api/handlers/libpod/networks.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go index 9f6103c45..78e525f1f 100644 --- a/pkg/api/handlers/libpod/networks.go +++ b/pkg/api/handlers/libpod/networks.go @@ -6,6 +6,7 @@ import ( "github.com/containers/podman/v2/libpod" "github.com/containers/podman/v2/libpod/define" + "github.com/containers/podman/v2/libpod/network" "github.com/containers/podman/v2/pkg/api/handlers/utils" "github.com/containers/podman/v2/pkg/domain/entities" "github.com/containers/podman/v2/pkg/domain/infra/abi" @@ -31,6 +32,9 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) { errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) return } + if len(options.Driver) < 1 { + options.Driver = network.DefaultNetworkDriver + } ic := abi.ContainerEngine{Libpod: runtime} report, err := ic.NetworkCreate(r.Context(), query.Name, options) if err != nil { |