Revert "Add lock for security group rules"
This reverts commit da526e783e
.
DBDeadlock was seen during testing with this patch applied.
Change-Id: I50335507fc1b50cb4c0b4818d5e070e5bcbd147a
This commit is contained in:
parent
da526e783e
commit
2e4ff341e9
|
@ -55,7 +55,6 @@ from neutron_lib.plugins import directory
|
||||||
from opflexagent import constants as ofcst
|
from opflexagent import constants as ofcst
|
||||||
from opflexagent import host_agent_rpc as arpc
|
from opflexagent import host_agent_rpc as arpc
|
||||||
from opflexagent import rpc as ofrpc
|
from opflexagent import rpc as ofrpc
|
||||||
from oslo_concurrency import lockutils
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_db import exception as db_exc
|
from oslo_db import exception as db_exc
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
@ -1786,26 +1785,23 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
|
||||||
security_group_name=sg_rule['security_group_id'],
|
security_group_name=sg_rule['security_group_id'],
|
||||||
security_group_subject_name='default',
|
security_group_subject_name='default',
|
||||||
name=sg_rule['id'])
|
name=sg_rule['id'])
|
||||||
# REVISIT: remove locking once a more robust solution
|
aim_sg_rule = self.aim.get(aim_ctx, sg_rule_aim)
|
||||||
# has been implemented
|
if not aim_sg_rule:
|
||||||
with lockutils.lock(sg_rule['id'], external=True):
|
continue
|
||||||
aim_sg_rule = self.aim.get(aim_ctx, sg_rule_aim)
|
ip_version = 0
|
||||||
if not aim_sg_rule:
|
if sg_rule['ethertype'] == 'IPv4':
|
||||||
continue
|
ip_version = 4
|
||||||
ip_version = 0
|
elif sg_rule['ethertype'] == 'IPv6':
|
||||||
if sg_rule['ethertype'] == 'IPv4':
|
ip_version = 6
|
||||||
ip_version = 4
|
for fixed_ip in fixed_ips:
|
||||||
elif sg_rule['ethertype'] == 'IPv6':
|
if is_delete:
|
||||||
ip_version = 6
|
if fixed_ip in aim_sg_rule.remote_ips:
|
||||||
for fixed_ip in fixed_ips:
|
aim_sg_rule.remote_ips.remove(fixed_ip)
|
||||||
if is_delete:
|
elif ip_version == netaddr.IPAddress(fixed_ip).version:
|
||||||
if fixed_ip in aim_sg_rule.remote_ips:
|
if fixed_ip not in aim_sg_rule.remote_ips:
|
||||||
aim_sg_rule.remote_ips.remove(fixed_ip)
|
aim_sg_rule.remote_ips.append(fixed_ip)
|
||||||
elif ip_version == netaddr.IPAddress(fixed_ip).version:
|
self.aim.update(aim_ctx, sg_rule_aim,
|
||||||
if fixed_ip not in aim_sg_rule.remote_ips:
|
remote_ips=aim_sg_rule.remote_ips)
|
||||||
aim_sg_rule.remote_ips.append(fixed_ip)
|
|
||||||
self.aim.update(aim_ctx, sg_rule_aim,
|
|
||||||
remote_ips=aim_sg_rule.remote_ips)
|
|
||||||
|
|
||||||
def create_port_precommit(self, context):
|
def create_port_precommit(self, context):
|
||||||
port = context.current
|
port = context.current
|
||||||
|
|
Loading…
Reference in New Issue