Empty subnet list results in returning all the ports

Bug #1417908 reported by Zhiyuan Cai
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
ZongKai LI

Bug Description

The motivation of method check_ports_exist_on_l3agent in l3_agentscheduler_db.py is to check if there exists one port whose binding host is the same as the input l3 agent, and whose subnet is attached to the input router.

    def check_ports_exist_on_l3agent(self, context, l3_agent, router_id):
        """
        This function checks for existence of dvr serviceable
        ports on the host, running the input l3agent.
        """
        subnet_ids = self.get_subnet_ids_on_router(context, router_id)

        core_plugin = manager.NeutronManager.get_plugin()
        filter = {'fixed_ips': {'subnet_id': subnet_ids}}
        ports = core_plugin.get_ports(context, filters=filter)
        for port in ports:
            if (n_utils.is_dvr_serviced(port['device_owner']) and
                l3_agent['host'] == port['binding:host_id']):
                    return True

        return False

But if subnet_ids returned by get_subnet_ids_on_router is empty, get_ports will return all the ports since filter with empty 'subnet_id' is ignored in get_ports.

I think this is not the expected behaviour. With empty subnet_ids, check_ports_exist_on_l3agent can just return False.

Changed in neutron:
assignee: nobody → Zhiyuan Cai (luckyvega-g)
Changed in neutron:
importance: Undecided → Medium
status: New → Confirmed
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/152845

Changed in neutron:
status: Confirmed → In Progress
Changed in neutron:
assignee: Zhiyuan Cai (luckyvega-g) → ZongKai LI (lzklibj)
Kyle Mestery (mestery)
Changed in neutron:
milestone: none → kilo-3
Revision history for this message
ZongKai LI (zongkai) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

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

commit e99f6e00cfd397bb74d44c9462dfcfa545dbed8c
Author: lzklibj <email address hidden>
Date: Wed Feb 25 21:19:07 2015 -0800

    fix check_ports_exist_on_l3agent in no subnet case

    If no subnets attached to the given router, this check
    should return False.

    Currently, if no subnets attached to given router, the
    following process in this method will fetch all ports
    to continue its checking, consider those ports are not
    related to the given router, the following checking
    should be invalid.

    To issue #1378066, after running "router-gateway-clear",
    _schedule_router will be triggered, and the invalid
    checking will make processing in get_candidates believe
    that all l3-agents are valid to schedule this router,
    and finally, invalid records are inserted into table
    RouterL3AgentBindings.

    Closes-Bug: #1378066
    Closes-Bug: #1417908
    Closes-Bug: #1420032

    Change-Id: If96d866c831330cca68a5fe5a0f27f178bbf40a6

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: kilo-3 → 2015.1.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Kyle Mestery (<email address hidden>) on branch: master
Review: https://review.openstack.org/152845
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.

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.