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
(cherry picked from commit 9be7b62f77)
This commit is contained in:
Brian Haley 2017-11-17 16:53:41 -05:00 committed by Jan Zerebecki
parent abb60c6175
commit 4593069cd1
1 changed files with 7 additions and 4 deletions

View File

@ -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'])