summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Haley <bhaley@redhat.com>2019-02-20 23:09:05 -0500
committerBrian Haley <haleyb.dev@gmail.com>2019-03-12 13:43:58 +0000
commit2ac0ee0b28c9c408aeb501d311c880afe59c4fb5 (patch)
tree6b5bc4af9520a649d9946947f295c06eaef17732
parentd6fba30781c5f4e63beeda04d065226660fc92b6 (diff)
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
Notes
Notes (review): Code-Review+2: Hongbin Lu <hongbin.lu@huawei.com> Code-Review+2: Slawek Kaplonski <skaplons@redhat.com> Workflow+1: Slawek Kaplonski <skaplons@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 13 Mar 2019 16:51:58 +0000 Reviewed-on: https://review.openstack.org/638331 Project: openstack/neutron Branch: refs/heads/master
-rw-r--r--neutron/agent/l3/dvr_local_router.py7
-rw-r--r--neutron/agent/l3/router_info.py7
2 files changed, 6 insertions, 8 deletions
diff --git a/neutron/agent/l3/dvr_local_router.py b/neutron/agent/l3/dvr_local_router.py
index 8010ecd..fca95aa 100644
--- a/neutron/agent/l3/dvr_local_router.py
+++ b/neutron/agent/l3/dvr_local_router.py
@@ -53,7 +53,7 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
53 ip_cidr = common_utils.ip_to_cidr(fip['floating_ip_address']) 53 ip_cidr = common_utils.ip_to_cidr(fip['floating_ip_address'])
54 self.floating_ip_removed_dist(ip_cidr) 54 self.floating_ip_removed_dist(ip_cidr)
55 # Now add the floating_ip to the current host 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 def floating_forward_rules(self, fip): 58 def floating_forward_rules(self, fip):
59 """Override this function defined in router_info for dvr routers.""" 59 """Override this function defined in router_info for dvr routers."""
@@ -108,10 +108,7 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
108 def floating_ip_added_dist(self, fip, fip_cidr): 108 def floating_ip_added_dist(self, fip, fip_cidr):
109 """Add floating IP to respective namespace based on agent mode.""" 109 """Add floating IP to respective namespace based on agent mode."""
110 if fip.get(lib_constants.DVR_SNAT_BOUND): 110 if fip.get(lib_constants.DVR_SNAT_BOUND):
111 # TODO(dougwig) - remove this disable when fixing bug #1816874 111 return self.add_centralized_floatingip(fip, fip_cidr)
112 # pylint: disable=assignment-from-no-return
113 floating_ip_status = self.add_centralized_floatingip(fip, fip_cidr)
114 return floating_ip_status
115 if not self._check_if_floatingip_bound_to_host(fip): 112 if not self._check_if_floatingip_bound_to_host(fip):
116 # TODO(Swami): Need to figure out what status 113 # TODO(Swami): Need to figure out what status
117 # should be returned when the floating IP is 114 # should be returned when the floating IP is
diff --git a/neutron/agent/l3/router_info.py b/neutron/agent/l3/router_info.py
index 3d8b13a..a995879 100644
--- a/neutron/agent/l3/router_info.py
+++ b/neutron/agent/l3/router_info.py
@@ -314,7 +314,10 @@ class RouterInfo(object):
314 raise NotImplementedError() 314 raise NotImplementedError()
315 315
316 def migrate_centralized_floating_ip(self, fip, interface_name, device): 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 def gateway_redirect_cleanup(self, rtr_interface): 322 def gateway_redirect_cleanup(self, rtr_interface):
320 pass 323 pass
@@ -377,8 +380,6 @@ class RouterInfo(object):
377 fip.get('host') == self.host): 380 fip.get('host') == self.host):
378 LOG.debug("Floating IP is migrating from centralized " 381 LOG.debug("Floating IP is migrating from centralized "
379 "to distributed: %s", fip) 382 "to distributed: %s", fip)
380 # TODO(dougwig) - remove this disable when fixing bug #1816874
381 # pylint: disable=assignment-from-no-return
382 fip_statuses[fip['id']] = self.migrate_centralized_floating_ip( 383 fip_statuses[fip['id']] = self.migrate_centralized_floating_ip(
383 fip, interface_name, device) 384 fip, interface_name, device)
384 elif fip_statuses[fip['id']] == fip['status']: 385 elif fip_statuses[fip['id']] == fip['status']: