Nested loop breaking out doesn't handle correctly

Bug #1659169 reported by Zhenguo Niu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
In Progress
Wishlist
Zhenguo Niu

Bug Description

https://github.com/openstack/nova/blob/master/nova/network/neutronv2/api.py#L1674-L1681

for p in ports:
    for ip in p['fixed_ips']:
        if ip['ip_address'] == address:
            port_id = p['id']
            break

in the above nested loops, when we find the port_id, it just break one for loop, the outside loop will continue, it's a bit waste, should handle this gracefully.

Changed in nova:
assignee: nobody → Zhenguo Niu (niu-zglinux)
status: New → In Progress
Revision history for this message
Sean Dague (sdague) wrote :

There are no currently open reviews on this bug, changing
the status back to the previous state and unassigning. If
there are active reviews related to this bug, please include
links in comments.

Changed in nova:
status: In Progress → New
assignee: Zhenguo Niu (niu-zglinux) → nobody
Revision history for this message
Sean Dague (sdague) wrote :

This only would be an issue with extremely large numbers of ports, marking as Opinion.

Changed in nova:
status: New → Opinion
importance: Undecided → Wishlist
Revision history for this message
Sean Dague (sdague) wrote :

Found open reviews for this bug in gerrit, setting to In Progress.

review: https://review.openstack.org/424931 in branch: master

Changed in nova:
status: Opinion → In Progress
assignee: nobody → Zhenguo Niu (niu-zglinux)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Stephen Finucane (<email address hidden>) on branch: master
Review: https://review.opendev.org/424931

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.