Bug 1786935

Summary: Cannot get/set mac address of ovs-interface
Product: Red Hat Enterprise Linux 8 Reporter: omergi
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.2CC: jiji, jishi, mshi, network-qe, till
Target Milestone: rc   
Target Release: 8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nmstate-0.2.4-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:00:10 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:

Description omergi 2019-12-29 16:41:51 UTC
Description of problem:
When trying to get the mac address of an ovs-interface with nmstate it is shown as (unknown).
It is also not possible to set the mac address of an ovs-interface w/o --no-verify parameter.
(If I use the parameter --no-verify the mac address is set properly)

For example:
I try to set ovs-interface mac address as the address of the nic i connect to the ovs-bridge and set the ipv4.method to auto, such that the ovs-interface will get the same ip address as the nic.


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

How reproducible:
Create an ovs-interface with nmstate, then try to set/view it mac address.

Steps to Reproduce:
1.
get the desired nic mac address, for example eth1

create state mystate.yaml: 
interfaces:
- name: mybr
  type: ovs-bridge
  state: up
  bridge:
    port:
    - name: mybr0
    - name: eth0
- name: mybr0
  type: ovs-interface
  state: up
  mac-address: <eth0 mac address>
  ipv4:
    enabled: true
    dhcp: true


nmstatectl set mystate.yaml
nmstatectl show 
mac address wont show.

Actual results on NetworkManager:
nmcli device show mybr0
result:
GENERAL.HWADDR: (unknown)

Expected results:
eth0 mac address on ovs-interface through 'nmstatectl show' output
eth0 mac address on ovs-interface through 'nmcli c show mybr0' output

Additional info:
log of the upper state:
nmstatectl set mystate.yaml
2019-12-29 18:36:18,870 root         DEBUG    Checkpoint /org/freedesktop/NetworkManager/Checkpoint/111 created for all devices: 60
2019-12-29 18:36:18,870 root         DEBUG    Adding new interfaces: ['mybr0', 'mybr']
2019-12-29 18:36:18,871 root         DEBUG    Connection settings for ConnectionSetting.create:
id: mybr0
iface: mybr0
uuid: eeb01956-7b12-4fe3-be2f-2452cbfec830
type: ovs-interface
autoconnect: True
autoconnect_slaves: <enum NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES of type NM.SettingConnectionAutoconnectSlaves>
2019-12-29 18:36:18,872 root         DEBUG    Connection settings for ConnectionSetting.create:
id: mybr
iface: mybr
uuid: da02fe6a-bd9a-484d-9624-db661fe6b2fd
type: ovs-bridge
autoconnect: True
autoconnect_slaves: <enum NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES of type NM.SettingConnectionAutoconnectSlaves>
2019-12-29 18:36:18,873 root         DEBUG    Connection settings for ConnectionSetting.create:
id: ovs-port-mybr0
iface: ovs-port-mybr0
uuid: 71a96c02-0f49-4b86-8a02-e9a3c7f3a6b4
type: ovs-port
autoconnect: True
autoconnect_slaves: <enum NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES of type NM.SettingConnectionAutoconnectSlaves>
2019-12-29 18:36:18,874 root         DEBUG    Editing interfaces: ['eth0']
2019-12-29 18:36:18,874 root         DEBUG    Connection settings for ConnectionSetting.import_by_profile:
id: eth0
iface: eth0
uuid: 11bb6566-1e31-496e-9347-7a66549fc677
type: 802-3-ethernet
autoconnect: True
autoconnect_slaves: <enum NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT of type NM.SettingConnectionAutoconnectSlaves>
2019-12-29 18:36:18,875 root         DEBUG    Connection settings for ConnectionSetting.create:
id: ovs-port-eth0
iface: ovs-port-eth0
uuid: f1117796-15df-4aa6-8f45-879114fa4bc7
type: ovs-port
autoconnect: True
autoconnect_slaves: <enum NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES of type NM.SettingConnectionAutoconnectSlaves>
2019-12-29 18:36:18,877 root         DEBUG    Executing NM action: func=add_connection_async
2019-12-29 18:36:18,884 root         DEBUG    Connection adding succeeded: dev=mybr0
2019-12-29 18:36:18,884 root         DEBUG    Executing NM action: func=add_connection_async
2019-12-29 18:36:18,911 root         DEBUG    Connection adding succeeded: dev=mybr
2019-12-29 18:36:18,911 root         DEBUG    Executing NM action: func=add_connection_async
2019-12-29 18:36:18,942 root         DEBUG    Connection adding succeeded: dev=ovs-port-mybr0
2019-12-29 18:36:18,942 root         DEBUG    Executing NM action: func=commit_changes_async
2019-12-29 18:36:18,949 root         DEBUG    Connection update succeeded: dev=eth0
2019-12-29 18:36:18,949 root         DEBUG    Executing NM action: func=add_connection_async
2019-12-29 18:36:18,951 root         DEBUG    Connection adding succeeded: dev=ovs-port-eth0
2019-12-29 18:36:18,952 root         DEBUG    Executing NM action: func=safe_activate_async
2019-12-29 18:36:18,988 root         DEBUG    Connection activation initiated: dev=mybr, con-state=<enum NM_ACTIVE_CONNECTION_STATE_ACTIVATING of type NM.ActiveConnectionState>
2019-12-29 18:36:19,063 root         DEBUG    Connection activation succeeded: dev=mybr, con-state=<enum NM_ACTIVE_CONNECTION_STATE_ACTIVATING of type NM.ActiveConnectionState>, dev-state= <enum NM_DEVICE_STATE_IP_CONFIG of type NM.DeviceState>
2019-12-29 18:36:19,063 root         DEBUG    Executing NM action: func=safe_activate_async
2019-12-29 18:36:19,098 root         DEBUG    Connection activation initiated: dev=ovs-port-eth0, con-state=<enum NM_ACTIVE_CONNECTION_STATE_ACTIVATING of type NM.ActiveConnectionState>
2019-12-29 18:36:19,209 root         DEBUG    Connection activation succeeded: dev=ovs-port-eth0, con-state=<enum NM_ACTIVE_CONNECTION_STATE_ACTIVATED of type NM.ActiveConnectionState>, dev-state= <enum NM_DEVICE_STATE_ACTIVATED of type NM.DeviceState>
2019-12-29 18:36:19,210 root         DEBUG    Executing NM action: func=safe_activate_async
2019-12-29 18:36:19,243 root         DEBUG    Connection activation initiated: dev=ovs-port-mybr0, con-state=<enum NM_ACTIVE_CONNECTION_STATE_ACTIVATING of type NM.ActiveConnectionState>
2019-12-29 18:36:19,329 root         DEBUG    Connection activation succeeded: dev=ovs-port-mybr0, con-state=<enum NM_ACTIVE_CONNECTION_STATE_ACTIVATED of type NM.ActiveConnectionState>, dev-state= <enum NM_DEVICE_STATE_ACTIVATED of type NM.DeviceState>
2019-12-29 18:36:19,329 root         DEBUG    Executing NM action: func=safe_activate_async
2019-12-29 18:36:19,343 root         DEBUG    Connection activation initiated: dev=mybr0, con-state=<enum NM_ACTIVE_CONNECTION_STATE_ACTIVATING of type NM.ActiveConnectionState>
2019-12-29 18:36:19,383 root         DEBUG    Connection activation succeeded: dev=mybr0, con-state=<enum NM_ACTIVE_CONNECTION_STATE_ACTIVATING of type NM.ActiveConnectionState>, dev-state= <enum NM_DEVICE_STATE_IP_CONFIG of type NM.DeviceState>
2019-12-29 18:36:19,383 root         DEBUG    Executing NM action: func=_safe_modify_async
2019-12-29 18:36:19,385 root         DEBUG    Device reapply succeeded: dev=eth0
2019-12-29 18:36:19,385 root         DEBUG    NM action queue exhausted, quiting mainloop
2019-12-29 18:36:19,474 root         DEBUG    Checkpoint /org/freedesktop/NetworkManager/Checkpoint/111 rollback executed: dbus.Dictionary({dbus.String('/org/freedesktop/NetworkManager/Devices/3'): dbus.UInt32(0), dbus.String('/org/freedesktop/NetworkManager/Devices/2'): dbus.UInt32(0), dbus.String('/org/freedesktop/NetworkManager/Devices/1'): 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.1.2', 'console_scripts', 'nmstatectl')()
  File "/usr/lib/python3.7/site-packages/nmstatectl/nmstatectl.py", line 59, in main
    return args.func(args)
  File "/usr/lib/python3.7/site-packages/nmstatectl/nmstatectl.py", line 217, in apply
    statedata, args.verify, args.commit, args.timeout
  File "/usr/lib/python3.7/site-packages/nmstatectl/nmstatectl.py", line 237, in apply_state
    checkpoint = libnmstate.apply(state, verify_change, commit, timeout)
  File "/usr/lib/python3.7/site-packages/libnmstate/netapplier.py", line 66, in apply
    state.State(desired_state), verify_change, commit, rollback_timeout
  File "/usr/lib/python3.7/site-packages/libnmstate/netapplier.py", line 153, in _apply_ifaces_state
    _verify_change(desired_state)
  File "/usr/lib/python3.7/site-packages/libnmstate/netapplier.py", line 200, in _verify_change
    desired_state.verify_interfaces(current_state)
  File "/usr/lib/python3.7/site-packages/libnmstate/state.py", line 327, in verify_interfaces
    self._assert_interfaces_equal(other_state)
  File "/usr/lib/python3.7/site-packages/libnmstate/state.py", line 615, in _assert_interfaces_equal
    current_state.interfaces[ifname],
libnmstate.error.NmstateVerificationError: 
desired
=======
---
name: mybr0
type: ovs-interface
state: up
ipv4:
  address: []
  auto-dns: true
  auto-gateway: true
  auto-routes: true
  dhcp: true
  enabled: true
ipv6:
  enabled: false
mac-address: 52:54:00:50:0D:F4
mtu: 1500

current
=======
---
name: mybr0
type: ovs-interface
state: up
ipv4:
  address: []
  auto-dns: true
  auto-gateway: true
  auto-routes: true
  dhcp: true
  enabled: true
ipv6:
  enabled: false
mtu: 1500

difference
==========
--- desired
+++ current
@@ -11,5 +11,4 @@
   enabled: true
 ipv6:
   enabled: false
-mac-address: 52:54:00:50:0D:F4
 mtu: 1500

Comment 1 Gris Ge 2020-02-12 10:53:10 UTC
nmstate-0.2.3-1 can query OVS mac address and also set MAC address at creation.

But when editing MAC address of existing OVS interface, got failure https://github.com/nmstate/nmstate/issues/777

Comment 2 Gris Ge 2020-02-13 05:30:47 UTC
Fix post to upstream: https://github.com/nmstate/nmstate/pull/787

Comment 7 errata-xmlrpc 2020-04-28 16:00:10 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, 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-2020:1696