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

network create: add warning for deprecated macvlan flag #11402

Merged
merged 1 commit into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmd/podman/networks/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -56,7 +57,8 @@ func networkCreateFlags(cmd *cobra.Command) {

macvlanFlagName := "macvlan"
flags.StringVar(&networkCreateOptions.MacVLAN, macvlanFlagName, "", "create a Macvlan connection based on this device")
_ = cmd.RegisterFlagCompletionFunc(macvlanFlagName, completion.AutocompleteNone)
// This option is deprecated
flags.MarkHidden(macvlanFlagName)

labelFlagName := "label"
flags.StringArrayVar(&labels, labelFlagName, nil, "set metadata on a network")
Expand Down Expand Up @@ -100,6 +102,11 @@ func networkCreate(cmd *cobra.Command, args []string) error {
if err != nil {
return errors.Wrapf(err, "unable to process options")
}

if networkCreateOptions.MacVLAN != "" {
logrus.Warn("The --macvlan option is deprecated, use `--driver macvlan --opt parent=<device>` instead")
}

response, err := registry.ContainerEngine().NetworkCreate(registry.Context(), name, networkCreateOptions)
if err != nil {
return err
Expand Down
10 changes: 2 additions & 8 deletions docs/source/markdown/podman-network-create.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ resolution.

#### **--driver**, **-d**

Driver to manage the network (default "bridge"). Currently only `bridge` is supported.
Driver to manage the network. Currently `bridge` and `macvlan` is supported. Defaults to `bridge`.
As rootless the `macvlan` driver has no access to the host network interfaces because rootless networking requires a separate network namespace.

#### **--opt**=*option*, **-o**

Expand Down Expand Up @@ -54,13 +55,6 @@ must be used with a *subnet* option.

Set metadata for a network (e.g., --label mykey=value).

#### **--macvlan**

*This option is being deprecated*

Create a *Macvlan* based connection rather than a classic bridge. You must pass an interface name from the host for the
Macvlan connection.

#### **--subnet**

The subnet in CIDR notation.
Expand Down