From 9be7b62f773d3f61da57c151bfbd5c8fe4d4e863 Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Fri, 17 Nov 2017 16:53:41 -0500 Subject: [PATCH] DVR: verify subnet has gateway_ip before installing IPv4 flow If a user clears the gateway_ip of a subnet and the OVS agent is re-started, it will throw an exception trying to install the DVR IPv4 flow. Do not install the flow in this case since it is not required. Change-Id: I79aba63498aa9af1156e37530627fcaec853a740 Closes-bug: #1728665 --- .../openvswitch/agent/ovs_dvr_neutron_agent.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py index 87a54bc186c..3de6a023a2a 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py @@ -421,8 +421,9 @@ class OVSDVRNeutronAgent(object): # TODO(vivek) remove the IPv6 related flows once SNAT is not # used for IPv6 DVR. if ip_version == 4: - br.install_dvr_process_ipv4( - vlan_tag=lvm.vlan, gateway_ip=subnet_info['gateway_ip']) + if subnet_info['gateway_ip']: + br.install_dvr_process_ipv4( + vlan_tag=lvm.vlan, gateway_ip=subnet_info['gateway_ip']) else: br.install_dvr_process_ipv6( vlan_tag=lvm.vlan, gateway_mac=subnet_info['gateway_mac']) @@ -616,8 +617,10 @@ class OVSDVRNeutronAgent(object): if network_type in constants.TUNNEL_NETWORK_TYPES: br = self.tun_br if ip_version == 4: - br.delete_dvr_process_ipv4( - vlan_tag=lvm.vlan, gateway_ip=subnet_info['gateway_ip']) + if subnet_info['gateway_ip']: + br.delete_dvr_process_ipv4( + vlan_tag=lvm.vlan, + gateway_ip=subnet_info['gateway_ip']) else: br.delete_dvr_process_ipv6( vlan_tag=lvm.vlan, gateway_mac=subnet_info['gateway_mac'])