Hide Forgot
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
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.
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.
(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
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.
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.
(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!
(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
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.
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
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