network create: support "-o parent=XXX" for ipvlan

Just like macvlan the ipvlan driver accepts a specific parent interface.

Fixes #16621

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2022-12-05 18:02:46 +01:00
parent 41af424cd8
commit c9961e18c0
2 changed files with 30 additions and 1 deletions

View File

@ -125,7 +125,7 @@ func networkCreate(cmd *cobra.Command, args []string) error {
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 {
} else 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