Bug 1559056

Summary: Provider does not check if generated port MAC address is already assigned
Product: [oVirt] ovirt-provider-ovn Reporter: Mor <mkalfon>
Component: providerAssignee: Marcin Mirecki <mmirecki>
Status: CLOSED CURRENTRELEASE QA Contact: Roni <reliezer>
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: bugs, danken, dholler, mburman, mmirecki, reliezer, ylavi
Target Milestone: ovirt-4.2.4Flags: rule-engine: ovirt-4.2+
ylavi: exception+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-26 08:42:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Network RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1586094    

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):
RHV 4.2.2.4-0.1.el7

How reproducible:
100%

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: 4.2.4.2-0.1.el7_3

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.