1
0
mirror of https://github.com/containers/podman.git synced 2026-02-05 06:45:31 +01:00

Remove deprecated --macvlan flag from network create

The --macvlan flag was deprecated in Podman 3.x and was scheduled
for removal in version 4.0. Since we're now at version 6.0.0-dev,
this commit removes the deprecated flag and its associated code.
Users should now use the standard syntax:
  podman network create --driver macvlan --opt parent=<device> <name>

Signed-off-by: shiavm006 <shivammittal42006@gmail.com>
This commit is contained in:
shiavm006
2025-11-24 16:21:35 +05:30
parent 25c358e374
commit 786012a670
3 changed files with 1 additions and 27 deletions

View File

@@ -11,7 +11,6 @@ import (
"github.com/containers/podman/v6/cmd/podman/parse"
"github.com/containers/podman/v6/cmd/podman/registry"
"github.com/containers/podman/v6/pkg/domain/entities"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"go.podman.io/common/libnetwork/types"
"go.podman.io/common/libnetwork/util"
@@ -60,12 +59,6 @@ func networkCreateFlags(cmd *cobra.Command) {
flags.StringArrayVar(&networkCreateOptions.Ranges, ipRangeFlagName, nil, "allocate container IP from range")
_ = cmd.RegisterFlagCompletionFunc(ipRangeFlagName, completion.AutocompleteNone)
// TODO consider removing this for 4.0
macvlanFlagName := "macvlan"
flags.StringVar(&networkCreateOptions.MacVLAN, macvlanFlagName, "", "create a Macvlan connection based on this device")
// This option is deprecated
_ = flags.MarkHidden(macvlanFlagName)
labelFlagName := "label"
flags.StringArrayVar(&labels, labelFlagName, nil, "set metadata on a network")
_ = cmd.RegisterFlagCompletionFunc(labelFlagName, completion.AutocompleteNone)
@@ -136,12 +129,7 @@ func networkCreate(cmd *cobra.Command, args []string) error {
}
}
// old --macvlan option
if networkCreateOptions.MacVLAN != "" {
logrus.Warn("The --macvlan option is deprecated, use `--driver macvlan --opt parent=<device>` instead")
network.Driver = types.MacVLANNetworkDriver
network.NetworkInterface = networkCreateOptions.MacVLAN
} else if networkCreateOptions.Driver == types.MacVLANNetworkDriver || networkCreateOptions.Driver == types.IPVLANNetworkDriver {
if networkCreateOptions.Driver == types.MacVLANNetworkDriver || networkCreateOptions.Driver == types.IPVLANNetworkDriver {
// new -d macvlan --opt parent=... syntax
if parent, ok := network.Options["parent"]; ok {
network.NetworkInterface = parent