duplicately fetch subnet_id in get_subnet_for_dvr

Bug #1531065 reported by ZongKai LI on 2016-01-05
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Low
Unassigned

Bug Description

In https://github.com/openstack/neutron/blob/77a6d114eae9de8078b358a9bd8502fb7c393641/neutron/db/dvr_mac_db.py#L159-L163, get_subnet_for_dvr will try to get subnet_id when fixed_ips is not None:
    ...
    def get_subnet_for_dvr(self, context, subnet, fixed_ips=None):
        if fixed_ips:
            subnet_data = fixed_ips[0]['subnet_id']
        else:
            subnet_data = subnet
    ...

But checking its callers :
https://github.com/openstack/neutron/blob/77a6d114eae9de8078b358a9bd8502fb7c393641/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py#L509-L531 ,
and
https://github.com/openstack/neutron/blob/77a6d114eae9de8078b358a9bd8502fb7c393641/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py#L366-L380 , they all have similar logic:
        ...
        fixed_ip = fixed_ips[0]
        ...
        subnet_uuid = fixed_ip['subnet_id']
        ...
            subnet_info = self.plugin_rpc.get_subnet_for_dvr(
                self.context, subnet_uuid, fixed_ips=fixed_ips)

subnet_id has already be fetched and passed into get_subnet_for_dvr. So in get_subnet_for_dvr, there is no need to fetch again.

ZongKai LI (zongkai) on 2016-01-05
Changed in neutron:
assignee: nobody → ZongKai LI (lzklibj)

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

Changed in neutron:
status: New → In Progress
Akihiro Motoki (amotoki) on 2016-01-05
tags: added: l3-dvr-backlog
Changed in neutron:
importance: Undecided → Low

Change abandoned by Armando Migliaccio (<email address hidden>) on branch: master
Review: https://review.openstack.org/263563
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Changed in neutron:
status: In Progress → Incomplete
assignee: ZongKai LI (lzklibj) → nobody
Launchpad Janitor (janitor) wrote :

[Expired for neutron because there has been no activity for 60 days.]

Changed in neutron:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers