Bug 1559056 - Provider does not check if generated port MAC address is already assigned
Summary: Provider does not check if generated port MAC address is already assigned
Alias: None
Product: ovirt-provider-ovn
Classification: oVirt
Component: provider
Version: unspecified
Hardware: Unspecified
OS: Unspecified
Target Milestone: ovirt-4.2.4
: ---
Assignee: Marcin Mirecki
QA Contact: Roni
Depends On:
Blocks: 1586094
TreeView+ depends on / blocked
Reported: 2018-03-21 15:46 UTC by Mor
Modified: 2018-06-26 08:42 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-06-26 08:42:16 UTC
oVirt Team: Network
rule-engine: ovirt-4.2+
ylavi: exception+

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
oVirt gerrit 89302 0 master MERGED Ensure generated mac does not exist in system 2018-04-06 18:54:07 UTC

Description Mor 2018-03-21 15:46:24 UTC
Description of problem:
When creating a port without MAC address, the provider needs to make sure the generated MAC address is not already assigned.

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

How reproducible:

Steps to Reproduce:
1. Create a port without specifying MAC address.

Actual results:
Provider generates a random MAC, but does not check if it is allocated.

Expected results:
Should check.

Additional info:

Comment 1 Dan Kenigsberg 2018-04-25 11:24:38 UTC
I would like to avoid respinning the provider for 4.2.3, if possible.

Comment 2 Sandro Bonazzola 2018-06-01 07:05:33 UTC
Any update on this? Is a build planned for 4.2.4?

Comment 4 Roni 2018-06-14 13:29:26 UTC
Verified on:

To verify:
0. at the Engine backup: /usr/share/ovirt-provider-ovn/ovndb/ip.py

1. open: vim /usr/share/ovirt-provider-ovn/ovndb/ip.py

2. at the function: _random_mac(): 
   change: macparts.extend([random.randint(0x00, 0xff) for i in range(5)])
   to:     macparts = [0,0,0,0,0,random.randint(0,2)]
   This will limit the MAC pull range to 3 items only

3. Restart OVN service:
   systemctl restart ovn-northd.service

4. Add a port using REST without the "mac_address" key, e.g.:
    properties = {
        "name": "port_1",
        "network_id": <network_id>,

5. Run section #4 until maximum of 3 MAC will be created
   verify by running: 'ovn-nbctl show' at the Engine

6. Verify that at the 4th REST call, it doesn't duplicate 
   one of the existing MACs

7. Restore original /usr/share/ovirt-provider-ovn/ovndb/ip.py
   from backup

8. Restart OVN service:
   systemctl restart ovn-northd.service

Comment 5 Sandro Bonazzola 2018-06-26 08:42:16 UTC
This bugzilla is included in oVirt 4.2.4 release, published on June 26th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.4 release, it has been closed with a resolution of CURRENT RELEASE.

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

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