Bug 1902976

Summary: creating vlan is restricted by certain naming rule
Product: Red Hat Enterprise Linux 8 Reporter: Mingyu Shi <mshi>
Component: nmstateAssignee: Fernando F. Mancera <ferferna>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: low Docs Contact:
Priority: low    
Version: 8.4CC: ferferna, fge, jiji, jishi, network-qe, till
Target Milestone: rcKeywords: Triaged
Target Release: 8.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 17:42:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
pre-tested.log none

Description Mingyu Shi 2020-12-01 02:58:26 UTC
Description of problem:
When creating vlan, it looks like vlan iface name is restricted, assume vlan id is 100 and the base iface is eth0, the following names are unacceptable in nmstate:
1. vlan200
2. eth0.200
this means if you use name as 'vlan' + number or 'eth0.' + number, the number must be 100, equal to vlan id.
This link https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-naming_scheme_for_vlan_interfaces described such a schema, but it isn't like mandatory, as 'ip link' command is able to do that.

Version-Release number of selected component (if applicable):
nmstate-1.0.0-0.1.el8.noarch
nispor-1.0.1-2.el8.x86_64
NetworkManager-1.30.0-0.2.el8.x86_64
DISTRO=RHEL-8.4.0-20201130.n.0
Linux sun-x5-2l-1.gsslab.rdu2.redhat.com 4.18.0-255.el8.x86_64 #1 SMP Fri Nov 27 08:05:28 EST 2020 x86_64 x86_64 x86_64 GNU/Linux

How reproducible:
100%

Steps to Reproduce:
echo "interfaces:
- name: dummy0
  type: dummy
  state: up" | nmstatectl set

echo "interfaces:
- name: vlan200
  type: vlan
  state: up
  vlan:
    base-iface: dummy0
    id: 100" | nmstatectl set

echo "interfaces:
- name: dummy0.200
  type: vlan
  state: up
  vlan:
    base-iface: dummy0
    id: 100" | nmstatectl set

# the 2 above failed, while 'ip link' can do:
[10:51:13@sun-x5-2l-1 ~]0#  ip link add link dummy0 name vlan200 type vlan id 100
[10:52:45@sun-x5-2l-1 ~]0#  ip link add link dummy0 name dummy0.200 type vlan id 300
[10:53:05@sun-x5-2l-1 ~]0# ip -d link show vlan200
444: vlan200@dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether aa:40:b2:6d:ae:06 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 
    vlan protocol 802.1Q id 100 <REORDER_HDR> addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
[10:53:18@sun-x5-2l-1 ~]0# ip -d link show dummy0.200 
445: dummy0.200@dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether aa:40:b2:6d:ae:06 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 
    vlan protocol 802.1Q id 300 <REORDER_HDR> addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
[10:53:24@sun-x5-2l-1 ~]0# nmstatectl show vlan200
2020-12-01 10:56:54,483 root         DEBUG    Async action: Retrieve applied config: ethernet eno3 started
2020-12-01 10:56:54,484 root         DEBUG    Async action: Retrieve applied config: ethernet veth1 started
2020-12-01 10:56:54,484 root         DEBUG    Async action: Retrieve applied config: vlan veth1.70 started
2020-12-01 10:56:54,484 root         DEBUG    Async action: Retrieve applied config: vlan veth100 started
2020-12-01 10:56:54,484 root         DEBUG    Async action: Retrieve applied config: dummy dummy0 started
2020-12-01 10:56:54,485 root         DEBUG    Async action: Retrieve applied config: ethernet eno3 finished
2020-12-01 10:56:54,486 root         DEBUG    Async action: Retrieve applied config: ethernet veth1 finished
2020-12-01 10:56:54,486 root         DEBUG    Async action: Retrieve applied config: vlan veth1.70 finished
2020-12-01 10:56:54,487 root         DEBUG    Async action: Retrieve applied config: vlan veth100 finished
2020-12-01 10:56:54,487 root         DEBUG    Async action: Retrieve applied config: dummy dummy0 finished
---
dns-resolver:
  config: {}
  running:
    search:
    - gsslab.rdu2.redhat.com
    server:
    - 10.11.5.4
    - 10.11.5.3
route-rules:
  config: []
routes:
  config: []
  running: []
interfaces:
- name: vlan200
  type: vlan
  state: down
  ipv4:
    enabled: false
    address: []
  ipv6:
    enabled: false
    address: []
  mac-address: AA:40:B2:6D:AE:06
  mtu: 1500
  vlan:
    base-iface: dummy0
    id: 100


Actual results:
Failed

Expected results:
No failure, or notify user the rule.

Additional info:

Comment 1 Fernando F. Mancera 2021-05-11 10:29:10 UTC
This was a bug on NetworkManager (#bz1907960). It has been fixed, therefore Nmstate is adding an integration test on upstream to make sure it won't happen again.

Upstream PR: https://github.com/nmstate/nmstate/pull/1586

Comment 2 Mingyu Shi 2021-05-12 03:23:05 UTC
Created attachment 1782226 [details]
pre-tested.log

Pretested with versions:
nmstate-1.1.0-0.20210511102937822652.pr1586.29.gd2ceecb.el8.noarch
nispor-1.0.1-4.el8.x86_64
NetworkManager-1.32.0-0.2.el8.x86_64
Linux mshi-rhel-850-20210328d2 4.18.0-301.1.el8.x86_64 #1 SMP Mon Mar 29 15:21:06 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux

Over dummy0, created vlan200 with id 100 and dummy0.200 with id 300 successfully.

Comment 5 Mingyu Shi 2021-06-30 03:32:48 UTC
Verified with versions:
nmstate-1.1.0-0.5.alpha4.el8.noarch
nispor-1.1.1-1.el8.x86_64
NetworkManager-1.32.0-1.el8.x86_64

[11:30:40@hpe-dl380pgen8-02-vm-10 ~]0# cat vlan-naming.yaml 
interfaces:
- name: veth0
  type: veth
  state: up
  veth:
    peer: veth0_p
- name: vlan200
  type: vlan
  state: up
  vlan:
    base-iface: veth0
    id: 100
- name: veth0.200
  type: vlan
  state: up
  vlan:
    base-iface: veth0
    id: 300
[11:30:43@hpe-dl380pgen8-02-vm-10 ~]0# nmstatectl set vlan-naming.yaml 
/tmp/nmstatelog/2021-06-30-11:30:48-738241034.log
Desired state applied: 
---
interfaces:
- name: veth0
  type: veth
  state: up
  veth:
    peer: veth0_p
- name: vlan200
  type: vlan
  state: up
  vlan:
    base-iface: veth0
    id: 100
- name: veth0.200
  type: vlan
  state: up
  vlan:
    base-iface: veth0
    id: 300
/tmp/nmstatelog/2021-06-30-11:30:48-738241034.0.log nmstatectl set vlan-naming.yaml return 0
[11:30:51@hpe-dl380pgen8-02-vm-10 ~]0# nmstatectl show *200
---
dns-resolver:
  config: {}
  running:
    search:
    - hpe2.lab.eng.bos.redhat.com
    server:
    - 10.19.42.41
    - 10.11.5.19
    - 10.5.30.160
route-rules:
  config: []
routes:
  config: []
  running: []
interfaces:
- name: veth0.200
  type: vlan
  state: up
  accept-all-mac-addresses: false
  ethtool:
    feature:
      fcoe-mtu: false
      highdma: true
      rx-gro: true
      rx-gro-list: false
      tx-checksum-fcoe-crc: false
      tx-checksum-ip-generic: true
      tx-checksum-sctp: true
      tx-fcoe-segmentation: false
      tx-generic-segmentation: true
      tx-gre-csum-segmentation: true
      tx-gre-segmentation: true
      tx-ipxip4-segmentation: true
      tx-ipxip6-segmentation: true
      tx-nocache-copy: false
      tx-scatter-gather-fraglist: true
      tx-sctp-segmentation: true
      tx-tcp-ecn-segmentation: true
      tx-tcp-mangleid-segmentation: true
      tx-tcp-segmentation: true
      tx-tcp6-segmentation: true
      tx-udp_tnl-csum-segmentation: true
      tx-udp_tnl-segmentation: true
  ipv4:
    enabled: false
    address: []
    dhcp: false
  ipv6:
    enabled: false
    address: []
    autoconf: false
    dhcp: false
  lldp:
    enabled: false
  mac-address: F6:06:6B:B4:0B:FF
  mtu: 1500
  vlan:
    base-iface: veth0
    id: 300
- name: vlan200
  type: vlan
  state: up
  accept-all-mac-addresses: false
  ethtool:
    feature:
      fcoe-mtu: false
      highdma: true
      rx-gro: true
      rx-gro-list: false
      tx-checksum-fcoe-crc: false
      tx-checksum-ip-generic: true
      tx-checksum-sctp: true
      tx-fcoe-segmentation: false
      tx-generic-segmentation: true
      tx-gre-csum-segmentation: true
      tx-gre-segmentation: true
      tx-ipxip4-segmentation: true
      tx-ipxip6-segmentation: true
      tx-nocache-copy: false
      tx-scatter-gather-fraglist: true
      tx-sctp-segmentation: true
      tx-tcp-ecn-segmentation: true
      tx-tcp-mangleid-segmentation: true
      tx-tcp-segmentation: true
      tx-tcp6-segmentation: true
      tx-udp_tnl-csum-segmentation: true
      tx-udp_tnl-segmentation: true
  ipv4:
    enabled: false
    address: []
    dhcp: false
  ipv6:
    enabled: false
    address: []
    autoconf: false
    dhcp: false
  lldp:
    enabled: false
  mac-address: F6:06:6B:B4:0B:FF
  mtu: 1500
  vlan:
    base-iface: veth0
    id: 100
ovs-db:
  external_ids:
    hostname: hpe-dl380pgen8-02-vm-10.hpe2.lab.eng.bos.redhat.com
    rundir: /var/run/openvswitch
    system-id: b79535ab-9af4-4104-8fa9-563c5c8bb2b9
  other_config: {}
[11:31:37@hpe-dl380pgen8-02-vm-10 ~]0# ip -d link show type vlan
23: veth0.200@veth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether f6:06:6b:b4:0b:ff brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 
    vlan protocol 802.1Q id 300 <REORDER_HDR> addrgenmode none numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
24: vlan200@veth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether f6:06:6b:b4:0b:ff brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535 
    vlan protocol 802.1Q id 100 <REORDER_HDR> addrgenmode none numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535

Comment 7 errata-xmlrpc 2021-11-09 17:42:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (nmstate bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4157