From 32ada008d4e2fa86c152f3f30ee2b66f10912de9 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Thu, 29 Dec 2016 00:46:31 -0800 Subject: [PATCH] Save neutron calls if plugin does not support dns-integration Some plugins may not suopprt this extension. If this is the case then there is no need to read and update ports. Change-Id: If0bf386d68d764fdf6ec52631230a7d00d0dc733 --- .../network/drivers/neutron/allowed_address_pairs.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/octavia/network/drivers/neutron/allowed_address_pairs.py b/octavia/network/drivers/neutron/allowed_address_pairs.py index 6c32517ece..e32aaa3f82 100644 --- a/octavia/network/drivers/neutron/allowed_address_pairs.py +++ b/octavia/network/drivers/neutron/allowed_address_pairs.py @@ -460,6 +460,10 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver): self._update_security_group_rules(load_balancer, sec_grp.get('id')) def failover_preparation(self, amphora): + if self.dns_integration_enabled: + self._failover_preparation(amphora) + + def _failover_preparation(self, amphora): interfaces = self.get_plugged_networks(compute_id=amphora.compute_id) ports = [] @@ -475,10 +479,8 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver): for port in ports: try: - - if self.dns_integration_enabled: - self.neutron_client.update_port(port.id, - {'port': {'dns_name': ''}}) + self.neutron_client.update_port(port.id, + {'port': {'dns_name': ''}}) except (neutron_client_exceptions.NotFound, neutron_client_exceptions.PortNotFoundClient):