Browse Source

Merge "Add locks for methods which sets nat rules in router" into stable/train

changes/06/772106/1
Zuul 6 months ago
committed by Gerrit Code Review
parent
commit
d44d85b810
  1. 6
      neutron/agent/l3/extensions/port_forwarding.py
  2. 3
      neutron/agent/l3/router_info.py

6
neutron/agent/l3/extensions/port_forwarding.py

@ -169,7 +169,7 @@ class PortForwardingAgentExtension(l3_extension.L3AgentExtension):
iptables_manager.ipv4['nat'].add_chain(chain)
iptables_manager.ipv4['nat'].add_rule(chain, rule, tag=rule_tag)
@coordination.synchronized('port-forwarding-{namespace}')
@coordination.synchronized('router-lock-ns-{namespace}')
def _process_create(self, port_forwardings, ri, interface_name, namespace,
iptables_manager):
if not port_forwardings:
@ -301,7 +301,7 @@ class PortForwardingAgentExtension(l3_extension.L3AgentExtension):
context, [port_forwarding], ri, interface_name, namespace,
iptables_manager)
@coordination.synchronized('port-forwarding-{namespace}')
@coordination.synchronized('router-lock-ns-{namespace}')
def _process_update(self, port_forwardings, iptables_manager,
interface_name, namespace):
if not port_forwardings:
@ -326,7 +326,7 @@ class PortForwardingAgentExtension(l3_extension.L3AgentExtension):
iptables_manager.apply()
self._store_local(port_forwardings, events.UPDATED)
@coordination.synchronized('port-forwarding-{namespace}')
@coordination.synchronized('router-lock-ns-{namespace}')
def _process_delete(self, context, port_forwardings, ri, interface_name,
namespace, iptables_manager):
if not port_forwardings:

3
neutron/agent/l3/router_info.py

@ -27,6 +27,7 @@ from neutron.agent.l3 import namespaces
from neutron.agent.linux import ip_lib
from neutron.agent.linux import iptables_manager
from neutron.agent.linux import ra
from neutron.common import coordination
from neutron.common import ipv6_utils
from neutron.common import utils as common_utils
from neutron.ipam import utils as ipam_utils
@ -983,6 +984,7 @@ class RouterInfo(BaseRouterInfo):
finally:
self.update_fip_statuses(fip_statuses)
@coordination.synchronized('router-lock-ns-{self.ns_name}')
def process_external(self):
fip_statuses = {}
try:
@ -1191,6 +1193,7 @@ class RouterInfo(BaseRouterInfo):
self.get_address_scope_mark_mask(address_scope))
iptables_manager.ipv4['nat'].add_rule('snat', rule)
@coordination.synchronized('router-lock-ns-{self.ns_name}')
def process_address_scope(self):
with self.iptables_manager.defer_apply():
self.process_ports_address_scope_iptables()

Loading…
Cancel
Save