Skip to content

Commit 76024e1

Browse files
Merge pull request #27598 from shiavm006/remove-deprecated-macvlan-flag
Remove deprecated --macvlan flag from network create
2 parents b5916bf + 786012a commit 76024e1

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

cmd/podman/networks/create.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/containers/podman/v6/cmd/podman/parse"
1212
"github.com/containers/podman/v6/cmd/podman/registry"
1313
"github.com/containers/podman/v6/pkg/domain/entities"
14-
"github.com/sirupsen/logrus"
1514
"github.com/spf13/cobra"
1615
"go.podman.io/common/libnetwork/types"
1716
"go.podman.io/common/libnetwork/util"
@@ -60,12 +59,6 @@ func networkCreateFlags(cmd *cobra.Command) {
6059
flags.StringArrayVar(&networkCreateOptions.Ranges, ipRangeFlagName, nil, "allocate container IP from range")
6160
_ = cmd.RegisterFlagCompletionFunc(ipRangeFlagName, completion.AutocompleteNone)
6261

63-
// TODO consider removing this for 4.0
64-
macvlanFlagName := "macvlan"
65-
flags.StringVar(&networkCreateOptions.MacVLAN, macvlanFlagName, "", "create a Macvlan connection based on this device")
66-
// This option is deprecated
67-
_ = flags.MarkHidden(macvlanFlagName)
68-
6962
labelFlagName := "label"
7063
flags.StringArrayVar(&labels, labelFlagName, nil, "set metadata on a network")
7164
_ = cmd.RegisterFlagCompletionFunc(labelFlagName, completion.AutocompleteNone)
@@ -136,12 +129,7 @@ func networkCreate(cmd *cobra.Command, args []string) error {
136129
}
137130
}
138131

139-
// old --macvlan option
140-
if networkCreateOptions.MacVLAN != "" {
141-
logrus.Warn("The --macvlan option is deprecated, use `--driver macvlan --opt parent=<device>` instead")
142-
network.Driver = types.MacVLANNetworkDriver
143-
network.NetworkInterface = networkCreateOptions.MacVLAN
144-
} else if networkCreateOptions.Driver == types.MacVLANNetworkDriver || networkCreateOptions.Driver == types.IPVLANNetworkDriver {
132+
if networkCreateOptions.Driver == types.MacVLANNetworkDriver || networkCreateOptions.Driver == types.IPVLANNetworkDriver {
145133
// new -d macvlan --opt parent=... syntax
146134
if parent, ok := network.Options["parent"]; ok {
147135
network.NetworkInterface = parent

pkg/domain/entities/network.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ type NetworkCreateOptions struct {
3939
Gateways []net.IP
4040
Internal bool
4141
Labels map[string]string
42-
MacVLAN string
4342
NetworkDNSServers []string
4443
Ranges []string
4544
Subnets []string

test/e2e/network_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -550,19 +550,6 @@ var _ = Describe("Podman network", func() {
550550
Expect(c3).Should(ExitCleanly())
551551
})
552552

553-
It("podman network create/remove macvlan", func() {
554-
net := "macvlan" + stringid.GenerateRandomID()
555-
nc := podmanTest.Podman([]string{"network", "create", "--macvlan", "lo", net})
556-
nc.WaitWithDefaultTimeout()
557-
defer podmanTest.removeNetwork(net)
558-
// Cannot ExitCleanly(): "The --macvlan option is deprecated..."
559-
Expect(nc).Should(Exit(0))
560-
561-
nc = podmanTest.Podman([]string{"network", "rm", net})
562-
nc.WaitWithDefaultTimeout()
563-
Expect(nc).Should(ExitCleanly())
564-
})
565-
566553
It("podman network create/remove macvlan as driver (-d) no device name", func() {
567554
net := "macvlan" + stringid.GenerateRandomID()
568555
nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", net})

0 commit comments

Comments
 (0)