Browse Source

Fix pylint E1128 (assignment-from-no-return) in l3-agent

Changed migrate_centralized_floating_ip() to return a
status in DvrLocalRouter class.  Also changed the parent
method in RouterInfo class to return FLOATINGIP_STATUS_NOCHANGE,
which will cause the agent to not send an updated status for
the floating IP.

Also changed floating_ip_added_dist() to not use an
intermediate variable and just return directly.

Change-Id: I7dc4934308da95cf00a36b4ef1020aac7cef7d99
Closes-bug: #1816874
tags/14.0.0.0rc1
Brian Haley 4 months ago
parent
commit
2ac0ee0b28
2 changed files with 6 additions and 8 deletions
  1. 2
    5
      neutron/agent/l3/dvr_local_router.py
  2. 4
    3
      neutron/agent/l3/router_info.py

+ 2
- 5
neutron/agent/l3/dvr_local_router.py View File

@@ -53,7 +53,7 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
53 53
         ip_cidr = common_utils.ip_to_cidr(fip['floating_ip_address'])
54 54
         self.floating_ip_removed_dist(ip_cidr)
55 55
         # Now add the floating_ip to the current host
56
-        self.floating_ip_added_dist(fip, ip_cidr)
56
+        return self.floating_ip_added_dist(fip, ip_cidr)
57 57
 
58 58
     def floating_forward_rules(self, fip):
59 59
         """Override this function defined in router_info for dvr routers."""
@@ -108,10 +108,7 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
108 108
     def floating_ip_added_dist(self, fip, fip_cidr):
109 109
         """Add floating IP to respective namespace based on agent mode."""
110 110
         if fip.get(lib_constants.DVR_SNAT_BOUND):
111
-            # TODO(dougwig) - remove this disable when fixing bug #1816874
112
-            # pylint: disable=assignment-from-no-return
113
-            floating_ip_status = self.add_centralized_floatingip(fip, fip_cidr)
114
-            return floating_ip_status
111
+            return self.add_centralized_floatingip(fip, fip_cidr)
115 112
         if not self._check_if_floatingip_bound_to_host(fip):
116 113
             # TODO(Swami): Need to figure out what status
117 114
             # should be returned when the floating IP is

+ 4
- 3
neutron/agent/l3/router_info.py View File

@@ -314,7 +314,10 @@ class RouterInfo(object):
314 314
         raise NotImplementedError()
315 315
 
316 316
     def migrate_centralized_floating_ip(self, fip, interface_name, device):
317
-        pass
317
+        """Implements centralized->distributed floating IP migration.
318
+        Overridden in dvr_local_router.py
319
+        """
320
+        return FLOATINGIP_STATUS_NOCHANGE
318 321
 
319 322
     def gateway_redirect_cleanup(self, rtr_interface):
320 323
         pass
@@ -377,8 +380,6 @@ class RouterInfo(object):
377 380
                 fip.get('host') == self.host):
378 381
                 LOG.debug("Floating IP is migrating from centralized "
379 382
                           "to distributed: %s", fip)
380
-                # TODO(dougwig) - remove this disable when fixing bug #1816874
381
-                # pylint: disable=assignment-from-no-return
382 383
                 fip_statuses[fip['id']] = self.migrate_centralized_floating_ip(
383 384
                     fip, interface_name, device)
384 385
             elif fip_statuses[fip['id']] == fip['status']:

Loading…
Cancel
Save