File 0005-DVR-verify-subnet-has-gateway_ip-before-installing-IPv4-flow.patch of Package openstack-neutron

commit 9be7b62f773d3f61da57c151bfbd5c8fe4d4e863
Author: Brian Haley <bhaley@redhat.com>
Date:   Fri Nov 17 16:53:41 2017 -0500

    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

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 87a54bc18..3de6a023a 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
@@ -426,8 +426,9 @@
         # 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'])
@@ -621,8 +622,10 @@
             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'])
openSUSE Build Service is sponsored by