From b1b35707aae57d299933f029eb0adc0a9000f97f Mon Sep 17 00:00:00 2001 From: Anders F Björklund Date: Mon, 23 Nov 2020 22:04:06 +0100 Subject: Add podman network create option for bridge mtu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Anders F Björklund --- cmd/podman/networks/create.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cmd') diff --git a/cmd/podman/networks/create.go b/cmd/podman/networks/create.go index 938b8da77..8db4bb89a 100644 --- a/cmd/podman/networks/create.go +++ b/cmd/podman/networks/create.go @@ -30,6 +30,7 @@ var ( var ( networkCreateOptions entities.NetworkCreateOptions labels []string + opts []string ) func networkCreateFlags(cmd *cobra.Command) { @@ -39,6 +40,10 @@ func networkCreateFlags(cmd *cobra.Command) { flags.StringVarP(&networkCreateOptions.Driver, driverFlagName, "d", "bridge", "driver to manage the network") _ = cmd.RegisterFlagCompletionFunc(driverFlagName, common.AutocompleteNetworkDriver) + optFlagName := "opt" + flags.StringArrayVarP(&opts, optFlagName, "o", []string{}, "Set driver specific options (default [])") + _ = cmd.RegisterFlagCompletionFunc(optFlagName, completion.AutocompleteNone) + gatewayFlagName := "gateway" flags.IPVar(&networkCreateOptions.Gateway, gatewayFlagName, nil, "IPv4 or IPv6 gateway for the subnet") _ = cmd.RegisterFlagCompletionFunc(gatewayFlagName, completion.AutocompleteNone) @@ -93,6 +98,10 @@ func networkCreate(cmd *cobra.Command, args []string) error { if err != nil { return errors.Wrap(err, "failed to parse labels") } + networkCreateOptions.Options, err = parse.GetAllLabels([]string{}, opts) + if err != nil { + return errors.Wrapf(err, "unable to process options") + } response, err := registry.ContainerEngine().NetworkCreate(registry.Context(), name, networkCreateOptions) if err != nil { return err -- cgit v1.2.3-54-g00ecf