Bug 1550484 - Cannot create a port without specifying a MAC address
Summary: Cannot create a port without specifying a MAC address
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-provider-ovn
Classification: oVirt
Component: provider
Version: 1.2.7
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ovirt-4.2.2
: ---
Assignee: Marcin Mirecki
QA Contact: Mor
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-01 09:53 UTC by Mor
Modified: 2018-03-29 11:04 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-03-29 11:04:04 UTC
oVirt Team: Network
Embargoed:
rule-engine: ovirt-4.2+
rule-engine: exception+


Attachments (Terms of Use)
ovirt-provider-ovn log (1.44 MB, application/zip)
2018-03-01 09:53 UTC, Mor
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 88385 0 master MERGED Allow creating port without specifying mac address 2018-03-05 14:56:35 UTC

Description Mor 2018-03-01 09:53:49 UTC
Created attachment 1402372 [details]
ovirt-provider-ovn log

Description of problem:
When trying to create a port without specifying a MAC address, the provider throws exception: "Unable to set fixed_ips on a port with no mac address defined". Neutron API: https://developer.openstack.org/api-ref/network/v2/#ports states that this property is optional, and if set to undefined a MAC address will be generated. 

Version-Release number of selected component (if applicable):
ovirt-provider-ovn-1.2.7-2.el7ev.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create network.
2. Create subnet (CIDR, IP GW, IPv).
3. Create port and attach it to the network, use 'fixed_ips' to assign IP to the port from the subnet.

Actual results:
Request:
2018-03-01 11:40:55,776 root Request body:
{"port": {"network_id": "2ae5d6b0-031d-43c5-a327-995c12842584", "fixed_ips": [{"subnet_id": "43db2bcb-b3b6-47ba-8eba-e91ccd0a8cd4"}], "name": "ovn_port_c7"}}

Response:
2018-03-01 11:40:55,953 root Unable to set fixed_ips on a port with no mac address defined
Traceback (most recent call last):
  File "/usr/share/ovirt-provider-ovn/handlers/base_handler.py", line 131, in _handle_request
    method, path_parts, content)
  File "/usr/share/ovirt-provider-ovn/handlers/selecting_handler.py", line 175, in handle_request
    return self.call_response_handler(handler, content, parameters)
  File "/usr/share/ovirt-provider-ovn/handlers/neutron.py", line 36, in call_response_handler
    return response_handler(ovn_north, content, parameters)
  File "/usr/share/ovirt-provider-ovn/handlers/neutron_responses.py", line 143, in post_ports
    port = nb_db.add_port(received_port)
  File "/usr/share/ovirt-provider-ovn/ovndb/ovn_north_mappers.py", line 63, in wrapper
    else f(wrapped_self, rest_data))
  File "/usr/share/ovirt-provider-ovn/ovndb/ovn_north_mappers.py", line 46, in wrapper
    return cls.rest2row(wrapped_self, f, rest_data, entity_id)
  File "/usr/share/ovirt-provider-ovn/ovndb/ovn_north_mappers.py", line 269, in rest2row
    fixed_ips=fixed_ips
  File "/usr/share/ovirt-provider-ovn/ovndb/ovn_north.py", line 256, in add_port
    port, network_id=network_id, mac=mac, fixed_ips=fixed_ips)
  File "/usr/share/ovirt-provider-ovn/ovndb/ovn_north.py", line 339, in _update_port_address
    validate.fixed_ip_port_has_mac(mac, fixed_ips)
  File "/usr/share/ovirt-provider-ovn/ovndb/validation.py", line 69, in fixed_ip_port_has_mac
    .format(fixed_ips=PortMapper.REST_PORT_FIXED_IPS,)
RestDataError

Expected results:
MAC address should be automatically generated by the provider.

Additional info:

Comment 1 Marcin Mirecki 2018-03-15 11:48:54 UTC
Available in provider 1.2.9

Comment 2 Mor 2018-03-18 08:03:37 UTC
Checked on:
RHV 4.2.2.4-0.1.el7

Marcin, I see that your code generates random MAC address, but it doesn't verify if the MAC address is already in use. Can you check if the MAC address is already assigned and to generate a new one?

Comment 3 Marcin Mirecki 2018-03-21 15:19:18 UTC
Needs a fix.
Please open a new bug for this.

Comment 4 Mor 2018-03-21 15:39:06 UTC
RHV 4.2.2.4-0.1.el7

Comment 5 Mor 2018-03-21 15:47:07 UTC
Created a bug for the fix:
https://bugzilla.redhat.com/show_bug.cgi?id=1559056

Comment 6 Sandro Bonazzola 2018-03-29 11:04:04 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 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.