Merge "Parametrize ipset locking with network namespace"
This commit is contained in:
@@ -14,9 +14,9 @@
|
||||
import copy
|
||||
|
||||
import netaddr
|
||||
from neutron_lib.utils import runtime
|
||||
|
||||
from neutron.agent.linux import utils as linux_utils
|
||||
from oslo_concurrency import lockutils
|
||||
|
||||
IPSET_ADD_BULK_THRESHOLD = 5
|
||||
NET_PREFIX = 'N'
|
||||
@@ -83,8 +83,9 @@ class IpsetManager(object):
|
||||
self.set_members_mutate(set_name, ethertype, member_ips)
|
||||
return add_ips, del_ips
|
||||
|
||||
@runtime.synchronized('ipset', external=True)
|
||||
def set_members_mutate(self, set_name, ethertype, member_ips):
|
||||
with lockutils.lock('neutron-ipset-%s' % self.namespace,
|
||||
external=True):
|
||||
if not self.set_name_exists(set_name):
|
||||
# The initial creation is handled with create/refresh to
|
||||
# avoid any downtime for existing sets (i.e. avoiding
|
||||
@@ -105,8 +106,9 @@ class IpsetManager(object):
|
||||
else:
|
||||
self._refresh_set(set_name, member_ips, ethertype)
|
||||
|
||||
@runtime.synchronized('ipset', external=True)
|
||||
def destroy(self, id, ethertype, forced=False):
|
||||
with lockutils.lock('neutron-ipset-%s' % self.namespace,
|
||||
external=True):
|
||||
set_name = self.get_name(id, ethertype)
|
||||
self._destroy(set_name, forced)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user