]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Use _is_this_snat_host and remove _get_gw_port_host
authorCarl Baldwin <carl.baldwin@hp.com>
Thu, 9 Jul 2015 21:14:39 +0000 (21:14 +0000)
committerCarl Baldwin <carl@ecbaldwin.net>
Fri, 10 Jul 2015 17:39:55 +0000 (17:39 +0000)
The _is_this_snat_host utility should be used consistently.  After
replacing a call to _get_gw_port_host with _is_this_snat_host,
_get_gw_port_host is left as just a simple helper method for
_is_this_snat_host.  The indirection is excessive and so they are
combined.

Change-Id: I880c5fdc9db9ba1304dba74a6e12f3df604793e5

neutron/agent/l3/dvr_edge_router.py

index dd128dc888e0ef7c21a9a1bb96374fe00eb309e1..8804be42f295501f82adcf3df3e7502ffbcf2923 100644 (file)
@@ -146,14 +146,11 @@ class DvrEdgeRouter(dvr_local_router.DvrLocalRouter):
         return long_name[:self.driver.DEV_NAME_LEN]
 
     def _is_this_snat_host(self):
-        return self._get_gw_port_host() == self.host
-
-    def _get_gw_port_host(self):
         host = self.router.get('gw_port_host')
         if not host:
             LOG.debug("gw_port_host missing from router: %s",
                       self.router['id'])
-        return host
+        return host == self.host
 
     def _handle_router_snat_rules(self, ex_gw_port,
                                   interface_name, action):
@@ -173,7 +170,7 @@ class DvrEdgeRouter(dvr_local_router.DvrLocalRouter):
         # NOTE DVR skips this step in a few cases...
         if not self.get_ex_gw_port():
             return
-        if self._get_gw_port_host() != self.host:
+        if not self._is_this_snat_host():
             return
 
         super(DvrEdgeRouter, self).perform_snat_action(snat_callback, *args)