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:
Available in provider 1.2.9
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?
Needs a fix. Please open a new bug for this.
RHV 4.2.2.4-0.1.el7
Created a bug for the fix: https://bugzilla.redhat.com/show_bug.cgi?id=1559056
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.