← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1417908] [NEW] Empty subnet list results in returning all the ports

 

Public bug reported:

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.

** Affects: neutron
     Importance: Undecided
     Assignee: Zhiyuan Cai (luckyvega-g)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Zhiyuan Cai (luckyvega-g)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1417908

Title:
  Empty subnet list results in returning all the ports

Status in OpenStack Neutron (virtual network service):
  New

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1417908/+subscriptions


Follow ups

References