[ipam] Port ID is not present in port dict that is passed to AddressRequestFactory

Bug #1527089 reported by Pavel Bondar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
networking-infoblox
Fix Released
High
Pavel Bondar
neutron
Fix Released
High
Carl Baldwin

Bug Description

Port dict is passed into AddressRequestFactory [1] to help make ipam decision based on various port info.
For reference IPAM driver this information is not used, but it is helpful for creating custom AddressRequests for 3rd party ipam driver.

Observed that port dict passed into AddressRequestFactory does not contain port id information.
Here is example of port_dict info captured in AddressRequestFactory:

{
'status': 'DOWN',
'dns_name': '',
'binding:host_id': u'vagrant-ubuntu-trusty-64.localdomain',
u'name': u'',
'allowed_address_pairs': <object object at 0x7f8bd204e270>,
u'admin_state_up': True,
u'network_id': u'9fc7128d-b4bd-4544-829c-96d19105eb5b',
u'tenant_id': u'bf0806763e32436bbdb8fd9b6ebfac93',
'extra_dhcp_opts': None,
'binding:vnic_type': 'normal',
'device_owner': 'network:dhcp',
'mac_address': 'fa:16:3e:63:de:76',
'binding:profile': <object object at 0x7f8bd204e270>,
'port_security_enabled': <object object at 0x7f8bd204e270>,
u'fixed_ips': [{u'subnet_id': u'7ca565f8-9cc4-4330-81c9-d3c671beb7b0'}],
'security_groups': <object object at x7f8bd204e270>,
u'device_id': u'dhcpd439385c-2745-50dd-91dd-8a252bf35915-9fc7128d-b4bd-4544-829c-96d19105eb5b'}

'id' or 'port_id' is not present in this dict.
It happens because of the way how create_port() handles id generation [2].
Port id is generated as uuid (if not set in incoming request, which is typically no),
but not populated back to original port_dict.
And original dict(without port_id) is passed down to ipam methods (allocate_ips_for_port_and_store).

[1] https://github.com/openstack/neutron/blob/master/neutron/ipam/requests.py#L253
[2] https://github.com/openstack/neutron/blob/master/neutron/db/db_base_plugin_v2.py#L1164

Pavel Bondar (pasha117)
tags: added: l3-ipam-dhcp
Revision history for this message
Carl Baldwin (carl-baldwin) wrote :

@John, could you triage?

Changed in neutron:
assignee: nobody → John Belamaric (jbelamaric)
Changed in networking-infoblox:
importance: Undecided → High
status: New → Triaged
Changed in neutron:
status: New → Confirmed
Changed in networking-infoblox:
assignee: nobody → Pavel Bondar (pasha117)
Changed in neutron:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/259697

Changed in neutron:
assignee: John Belamaric (jbelamaric) → Pavel Bondar (pasha117)
status: Confirmed → In Progress
Changed in neutron:
assignee: Pavel Bondar (pasha117) → Carl Baldwin (carl-baldwin)
Changed in neutron:
assignee: Carl Baldwin (carl-baldwin) → Pavel Bondar (pasha117)
Changed in neutron:
assignee: Pavel Bondar (pasha117) → Carl Baldwin (carl-baldwin)
tags: added: liberty-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/259697
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=b2d656aff46ac5a2aa9700fc9ff682ef82ecf8e9
Submitter: Jenkins
Branch: master

commit b2d656aff46ac5a2aa9700fc9ff682ef82ecf8e9
Author: Pavel Bondar <email address hidden>
Date: Sat Dec 19 16:08:36 2015 +0300

    Add generated port id to port dict

    Port id generated in create_port was not populated back to port_dict.
    As a result port id information was not available on
    AddressRequestFactory level (used by 3rd party ipam providers).

    This fix populates port_id into copied port dict (to prevent affecting
    incoming port dict).
    Added UT to make sure that port id is added to port dict which is passed
    to AddressFactory.

    Change-Id: I62e4d9e887488b9ceeafb90b044f95a22c1765b0
    Closes-Bug: #1527089

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/276704

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/liberty)

Reviewed: https://review.openstack.org/276704
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=c83b04d4f4c2a3537e1e5d66e3c2ec2dbf592bb1
Submitter: Jenkins
Branch: stable/liberty

commit c83b04d4f4c2a3537e1e5d66e3c2ec2dbf592bb1
Author: Pavel Bondar <email address hidden>
Date: Sat Dec 19 16:08:36 2015 +0300

    Add generated port id to port dict

    Port id generated in create_port was not populated back to port_dict.
    As a result port id information was not available on
    AddressRequestFactory level (used by 3rd party ipam providers).

    This fix populates port_id into copied port dict (to prevent affecting
    incoming port dict).
    Added UT to make sure that port id is added to port dict which is passed
    to AddressFactory.

    Change-Id: I62e4d9e887488b9ceeafb90b044f95a22c1765b0
    Closes-Bug: #1527089
    (cherry picked from commit b2d656aff46ac5a2aa9700fc9ff682ef82ecf8e9)

tags: added: in-stable-liberty
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/neutron 8.0.0.0b3

This issue was fixed in the openstack/neutron 8.0.0.0b3 development milestone.

Changed in networking-infoblox:
status: Triaged → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/neutron 7.0.4

This issue was fixed in the openstack/neutron 7.0.4 release.

tags: removed: liberty-backport-potential
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.