# Check if distributed router and then create the
# FloatingIP agent gateway port
if router_dict.get('distributed'):
- vm_hostid = self._get_vm_port_hostid(
+ hostid = self._get_dvr_service_port_hostid(
context, fip_port)
- if vm_hostid:
+ if hostid:
# FIXME (Swami): This FIP Agent Gateway port should be
# created only once and there should not be a duplicate
# for the same host. Until we find a good solution for
fip_agent_port = (
self.create_fip_agent_gw_port_if_not_exists(
admin_ctx, external_port['network_id'],
- vm_hostid))
+ hostid))
LOG.debug("FIP Agent gateway port: %s", fip_agent_port)
def _get_floatingip_on_port(self, context, port_id=None):
for fip in floating_ips:
vm_port = port_dict.get(fip['port_id'], None)
if vm_port:
- fip['host'] = self._get_vm_port_hostid(context,
- fip['port_id'],
- port=vm_port)
+ fip['host'] = self._get_dvr_service_port_hostid(
+ context, fip['port_id'], port=vm_port)
routers_dict = self._process_routers(context, routers)
self._process_floating_ips_dvr(context, routers_dict,
floating_ips, host, agent)
self._process_interfaces(routers_dict, interfaces)
return list(routers_dict.values())
- def _get_vm_port_hostid(self, context, port_id, port=None):
- """Return the portbinding host_id."""
- vm_port_db = port or self._core_plugin.get_port(context, port_id)
- device_owner = vm_port_db['device_owner'] if vm_port_db else ""
+ def _get_dvr_service_port_hostid(self, context, port_id, port=None):
+ """Returns the portbinding host_id for dvr service port."""
+ port_db = port or self._core_plugin.get_port(context, port_id)
+ device_owner = port_db['device_owner'] if port_db else ""
if (n_utils.is_dvr_serviced(device_owner) or
device_owner == l3_const.DEVICE_OWNER_AGENT_GW):
- return vm_port_db[portbindings.HOST_ID]
+ return port_db[portbindings.HOST_ID]
def _get_agent_gw_ports_exist_for_network(
self, context, network_id, host, agent_id):
return
if is_distributed_router(router):
- host = self._get_vm_port_hostid(context, fixed_port_id)
+ host = self._get_dvr_service_port_hostid(context, fixed_port_id)
self.l3_rpc_notifier.routers_updated_on_host(
context, [router_id], host)
else:
# NOTE: mock.patch is not needed here since self.mixin is created fresh
# for each test. It doesn't work with some methods since the mixin is
# tested in isolation (e.g. _get_agent_by_type_and_host).
- self.mixin._get_vm_port_hostid = mock.Mock(return_value=hostid)
+ self.mixin._get_dvr_service_port_hostid = mock.Mock(
+ return_value=hostid)
self.mixin._get_agent_by_type_and_host = mock.Mock(
return_value=fipagent)
self.mixin._get_fip_sync_interfaces = mock.Mock(
}
with mock.patch.object(self.mixin, 'get_router') as grtr,\
- mock.patch.object(self.mixin, '_get_vm_port_hostid') as vmp,\
+ mock.patch.object(self.mixin,
+ '_get_dvr_service_port_hostid') as vmp,\
mock.patch.object(
self.mixin,
'create_fip_agent_gw_port_if_not_exists') as c_fip,\