RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1722352 - vlan id can't be changed with nmstatectl
Summary: vlan id can't be changed with nmstatectl
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: nmstate
Version: 8.1
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: rc
: 8.5
Assignee: Fernando F. Mancera
QA Contact: Mingyu Shi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-20 07:02 UTC by Jianlin Shi
Modified: 2022-01-11 06:21 UTC (History)
7 users (show)

Fixed In Version: nmstate-1.1.0-0.1.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 17:42:37 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
pre-tested.log (21.15 KB, text/plain)
2021-05-12 03:31 UTC, Mingyu Shi
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github nmstate nmstate pull 1587 0 None open vlan/vxlan: add support to modify the VLAN/VXLAN ID 2021-05-11 13:34:22 UTC
Red Hat Product Errata RHBA-2021:4157 0 None None None 2021-11-09 17:42:47 UTC

Description Jianlin Shi 2019-06-20 07:02:10 UTC
Description of problem:
vlan id can't be changed by nmstatectl

Version-Release number of selected component (if applicable):
0.0.7-1

How reproducible:
Always

Steps to Reproduce:
1. change vlan id for existed vlan with nmstatectl

Actual results:
fail

Expected results:
pass

Additional info:

[root@hp-dl580g8-03-vm-09 libnmstate]# nmstatectl show veth0_3
---
dns-resolver:
  config:
    search: []
    server: []
  running:
    search:
    - rhts.eng.pek2.redhat.com
    server:
    - 10.73.2.107
    - 10.73.2.108
    - 10.10.160.1
routes:
  config: []
  running:
  - destination: 192.168.3.0/24
    metric: 400
    next-hop-address: ''
    next-hop-interface: veth0_3
    table-id: 254
  - destination: 2000:3::/64
    metric: 400
    next-hop-address: ''
    next-hop-interface: veth0_3
    table-id: 254
  - destination: fe80::/64
    metric: 400
    next-hop-address: ''
    next-hop-interface: veth0_3
    table-id: 254
  - destination: ff00::/8
    metric: 256
    next-hop-address: ''
    next-hop-interface: veth0_3
    table-id: 255
interfaces:
- name: veth0_3
  type: vlan
  state: up
  ipv4:
    address:
    - ip: 192.168.3.1
      prefix-length: 24
    dhcp: false
    enabled: true
  ipv6:
    address:
    - ip: 2000:3::1
      prefix-length: 64
    - ip: fe80::8c07:fd32:3440:3246
      prefix-length: 64
    autoconf: false
    dhcp: false
    enabled: true
  mac-address: D2:5E:52:84:A8:BA
  mtu: 1500
  vlan:
    base-iface: veth0
    id: 3

and try to change vlan id from 3 to 4:

[root@hp-dl580g8-03-vm-09 libnmstate]# cat veth0_3.yaml 
---
dns-resolver:
  config:
    search: []
    server: []
  running:
    search:
    - rhts.eng.pek2.redhat.com
    server:
    - 10.73.2.107
    - 10.73.2.108
    - 10.10.160.1
routes:
  config: []
  running:
  - destination: 192.168.3.0/24
    metric: 400
    next-hop-address: ''
    next-hop-interface: veth0_3
    table-id: 254
  - destination: 2000:3::/64
    metric: 400
    next-hop-address: ''
    next-hop-interface: veth0_3
    table-id: 254
  - destination: fe80::/64
    metric: 400
    next-hop-address: ''
    next-hop-interface: veth0_3
    table-id: 254
  - destination: ff00::/8
    metric: 256
    next-hop-address: ''
    next-hop-interface: veth0_3
    table-id: 255
interfaces:
- name: veth0_3
  type: vlan
  state: up
  ipv4:
    address:
    - ip: 192.168.3.1
      prefix-length: 24
    dhcp: false
    enabled: true
  ipv6:
    address:
    - ip: 2000:3::1
      prefix-length: 64
    - ip: fe80::8c07:fd32:3440:3246
      prefix-length: 64
    autoconf: false
    dhcp: false
    enabled: true
  mac-address: D2:5E:52:84:A8:BA
  mtu: 1500
  vlan:
    base-iface: veth0
    id: 4

but failed:

[root@hp-dl580g8-03-vm-09 libnmstate]# nmstatectl set veth0_3.yaml 
2019-06-20 03:01:59,304 root         DEBUG    Checkpoint /org/freedesktop/NetworkManager/Checkpoint/74 created for all devices: 60
2019-06-20 03:01:59,305 root         DEBUG    Adding new interfaces: []
2019-06-20 03:01:59,336 root         DEBUG    Editing interfaces: ['veth0_3']
2019-06-20 03:01:59,337 root         WARNING  IPv6 link local address fe80::8c07:fd32:3440:3246/64 is ignored when applying desired state
2019-06-20 03:01:59,338 root         DEBUG    Connection settings for ConnectionSetting.import_by_profile:
id: veth0_3
iface: veth0_3
uuid: ba66f505-5baf-4844-8adf-f3665a7ac665
type: vlan
autoconnect: True
autoconnect_slaves: <enum NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT of type NM.SettingConnectionAutoconnectSlaves>
2019-06-20 03:01:59,342 root         DEBUG    Executing NM action: func=commit_changes_async
2019-06-20 03:01:59,353 root         DEBUG    Connection update succeeded: dev=veth0_3
2019-06-20 03:01:59,354 root         DEBUG    Executing NM action: func=safe_activate_async
2019-06-20 03:01:59,357 root         ERROR    NM main-loop aborted: Connection activation failed on device veth0_3: error=nm-manager-error-quark: Connection 'veth0_3' is not available on device veth0_3 because profile is not compatible with device (vlan id setting mismatches) (2)
2019-06-20 03:01:59,379 root         DEBUG    Checkpoint /org/freedesktop/NetworkManager/Checkpoint/74 rollback executed: dbus.Dictionary({dbus.String('/org/freedesktop/NetworkManager/Devices/1'): dbus.UInt32(0), dbus.String('/org/freedesktop/NetworkManager/Devices/35'): dbus.UInt32(0), dbus.String('/org/freedesktop/NetworkManager/Devices/2'): dbus.UInt32(0), dbus.String('/org/freedesktop/NetworkManager/Devices/34'): dbus.UInt32(0)}, signature=dbus.Signature('su'))
Traceback (most recent call last):
  File "/usr/bin/nmstatectl", line 11, in <module>
    load_entry_point('nmstate==0.0.7', 'console_scripts', 'nmstatectl')()
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 59, in main
    return args.func(args)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 187, in apply
    args.timeout)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 206, in apply_state
    checkpoint = libnmstate.apply(state, verify_change, commit, timeout)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 59, in apply
    state.State(desired_state), verify_change, commit, rollback_timeout)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 132, in _apply_ifaces_state
    _edit_interfaces(state2edit)
  File "/usr/lib64/python3.6/contextlib.py", line 88, in __exit__
    next(self.gen)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 184, in _setup_providers
    mainloop.error))
libnmstate.error.NmstateLibnmError: Unexpected failure of libnm when running the mainloop: run execution

Comment 1 Gris Ge 2020-02-12 03:49:09 UTC
Hi Jianlin,

Changing VLAN ID is supposed to done via:
 * Mark old VLAN interface as 'state: absent'.
 * Add new VLAN interface in the same yml file.


Hi Mingyu,

Can you test whether above step works in nmstate-0.2.3-1.el8?

Thank you.

Comment 2 Gris Ge 2020-02-12 12:51:36 UTC
Hi Jianli,

The NetworkManager does not allow changing VLAN ID after created. 
So to solve this problem, nmstate need to delete old VLAN and create the new one.
This require massive change and should be a RFE.

Workaround on this would be two yaml files: one to remove old interface, one to create new one with changed VLAN ID.

If you still want this feature, please state the use case and we can review it in
RHEL 8.3 planning pharse.

Comment 3 Jianlin Shi 2020-02-13 01:41:08 UTC
(In reply to Gris Ge from comment #2)
> Hi Jianli,
> 
> The NetworkManager does not allow changing VLAN ID after created. 
> So to solve this problem, nmstate need to delete old VLAN and create the new
> one.
> This require massive change and should be a RFE.
> 
> Workaround on this would be two yaml files: one to remove old interface, one
> to create new one with changed VLAN ID.
> 
> If you still want this feature, please state the use case and we can review
> it in
> RHEL 8.3 planning pharse.

got it, please mshi@ help to test

Comment 4 Mingyu Shi 2020-07-10 08:43:12 UTC
No changes here, as kernel doesn't allow to change vlan id directly, but ip-link usage `ip link help`:

ip link set { DEVICE | dev DEVICE | group DEVGROUP }
       [ vlan VLANID [ qos VLAN-QOS ] [ proto VLAN-PROTO ] ]

don't know how to use this correctly, need to look into it.

We will review vlan cases and file a new feature issue if needed.

Comment 8 Gris Ge 2021-01-22 13:13:02 UTC
Even the kernel cannot change the VLAN ID at runtime, but nmstate/NM can delete this VLAN and create again with new ID just like what we did for veth peer changes.


Change to ASSIGN state and will fix it in RHEL 8.5.

Comment 10 Fernando F. Mancera 2021-05-06 22:24:29 UTC
(In reply to Gris Ge from comment #8)
> Even the kernel cannot change the VLAN ID at runtime, but nmstate/NM can
> delete this VLAN and create again with new ID just like what we did for veth
> peer changes.
> 
> 
> Change to ASSIGN state and will fix it in RHEL 8.5.

We cannot do the same that we did for veth interfaces because veth only needed to be deactivated but not removed. For VLAN ID, we need to remove the VLAN from kernel (NM connection + NM device) and create it again.

I am working on a patch but it will take some time and will require a lot of testing.

Thanks!

Comment 11 Fernando F. Mancera 2021-05-11 13:34:26 UTC
(In reply to Fernando F. Mancera from comment #10)
> (In reply to Gris Ge from comment #8)
> > Even the kernel cannot change the VLAN ID at runtime, but nmstate/NM can
> > delete this VLAN and create again with new ID just like what we did for veth
> > peer changes.
> > 
> > 
> > Change to ASSIGN state and will fix it in RHEL 8.5.
> 
> We cannot do the same that we did for veth interfaces because veth only
> needed to be deactivated but not removed. For VLAN ID, we need to remove the
> VLAN from kernel (NM connection + NM device) and create it again.
> 
> I am working on a patch but it will take some time and will require a lot of
> testing.
> 
> Thanks!

I was wrong. We can do the same that we did with veth peer property. Upstream PR: https://github.com/nmstate/nmstate/pull/1587

Comment 12 Mingyu Shi 2021-05-12 03:31:44 UTC
Created attachment 1782227 [details]
pre-tested.log

Pretested with versions:
nmstate-1.1.0-0.20210511144158078578.pr1587.30.g596a288.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

Successfully changed vlan id of dummy0.200(id 300) and vlan200(id 100) to 3000 and 1000 respectively.

Comment 16 Mingyu Shi 2021-06-06 13:30:51 UTC
Verified with versions:
nmstate-1.1.0-0.1.el8.noarch
nispor-1.1.0-1.el8.x86_64
NetworkManager-1.32.0-0.4.el8.x86_64

Run existing case: vlan_id_test, PASS

Comment 18 errata-xmlrpc 2021-11-09 17:42:37 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


Note You need to log in before you can comment on or make changes to this bug.