diff --git a/lxd/network/driver_ovn.go b/lxd/network/driver_ovn.go index 0aecf78b10ed..640c93450d8b 100644 --- a/lxd/network/driver_ovn.go +++ b/lxd/network/driver_ovn.go @@ -3806,7 +3806,7 @@ func (n *ovn) InstanceDevicePortStart(opts *OVNInstanceNICSetupOpts, securityACL MAC: mac, IPs: staticIPs, Parent: nestedPortParentName, - VLAN: nestedPortVLAN, + NestedVLAN: nestedPortVLAN, Location: n.state.ServerName, }, true) if err != nil { diff --git a/lxd/network/openvswitch/ovn.go b/lxd/network/openvswitch/ovn.go index d15d50825311..3c12891d782c 100644 --- a/lxd/network/openvswitch/ovn.go +++ b/lxd/network/openvswitch/ovn.go @@ -119,8 +119,9 @@ type OVNSwitchPortOpts struct { DHCPv4OptsID OVNDHCPOptionsUUID // Optional, if empty, no DHCPv4 enabled on port. DHCPv6OptsID OVNDHCPOptionsUUID // Optional, if empty, no DHCPv6 enabled on port. Parent OVNSwitchPort // Optional, if set a nested port is created. - VLAN uint16 // Optional, use with Parent to request a specific VLAN for nested port. + NestedVLAN uint16 // Optional, use with Parent to request a specific VLAN for nested port. Location string // Optional, use to indicate the name of the LXD server this port is bound to. + VLAN uint16 // Optional, use to indicate a specific VLAN for the port. } // OVNACLRule represents an ACL rule that can be added to a logical switch or port group. @@ -1239,7 +1240,7 @@ func (o *OVN) LogicalSwitchPortAdd(switchName OVNSwitch, portName OVNSwitchPort, if opts != nil { // Created nested VLAN port if requested. if opts.Parent != "" { - args = append(args, string(opts.Parent), fmt.Sprintf("%d", opts.VLAN)) + args = append(args, string(opts.Parent), fmt.Sprintf("%d", opts.NestedVLAN)) } ipStr := make([]string, 0, len(opts.IPs)) @@ -1269,6 +1270,10 @@ func (o *OVN) LogicalSwitchPortAdd(switchName OVNSwitch, portName OVNSwitchPort, if opts.Location != "" { args = append(args, "--", "set", "logical_switch_port", string(portName), fmt.Sprintf("external_ids:%s=%s", ovnExtIDLXDLocation, opts.Location)) } + + if opts.VLAN != 0 { + args = append(args, "--", "set", "logical_switch_port", string(portName), fmt.Sprintf("tag_request=%d", opts.VLAN)) + } } args = append(args, "--", "set", "logical_switch_port", string(portName), fmt.Sprintf("external_ids:%s=%s", ovnExtIDLXDSwitch, switchName))