From 2e43aae37029c49d066a085731adc246e45ee941 Mon Sep 17 00:00:00 2001
From: Slawek Kaplonski <skaplons@redhat.com>
Date: Mon, 15 Oct 2018 14:09:41 +0200
Subject: [PATCH] Use l3plugin property in neutron/db/l3_dvr_db.py module

Class DVRResourceOperationHandler has got property called
l3plugin which returns directory.get_plugin(plugin_constants.L3)
so there is no need to use directory.get_plugin(plugin_constants.L3)
in other places in this class.

TrivialFix

Change-Id: I6cc0fb4cd5edb798569dabe8f9c8696020e79008
---
 neutron/db/l3_dvr_db.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/neutron/db/l3_dvr_db.py b/neutron/db/l3_dvr_db.py
index 416ff7bb336..c5ee807ee8b 100644
--- a/neutron/db/l3_dvr_db.py
+++ b/neutron/db/l3_dvr_db.py
@@ -527,19 +527,17 @@ class DVRResourceOperationHandler(object):
         if not router.extra_attributes.distributed:
             return
 
-        plugin = directory.get_plugin(plugin_constants.L3)
-
         # we calculate which hosts to notify by checking the hosts for
         # the removed port's subnets and then subtract out any hosts still
         # hosting the router for the remaining interfaces
-        router_hosts_for_removed = plugin._get_dvr_hosts_for_subnets(
+        router_hosts_for_removed = self.l3plugin._get_dvr_hosts_for_subnets(
             context, subnet_ids={ip['subnet_id'] for ip in port['fixed_ips']})
-        router_hosts_after = plugin._get_dvr_hosts_for_router(
+        router_hosts_after = self.l3plugin._get_dvr_hosts_for_router(
             context, router_id)
         removed_hosts = set(router_hosts_for_removed) - set(router_hosts_after)
         if removed_hosts:
-            agents = plugin.get_l3_agents(context,
-                                          filters={'host': removed_hosts})
+            agents = self.l3plugin.get_l3_agents(
+                context, filters={'host': removed_hosts})
             bindings = rb_obj.RouterL3AgentBinding.get_objects(
                 context, router_id=router_id)
             snat_binding = bindings.pop() if bindings else None