Revert "Ensure reaction to svc target-port update"
This reverts commit 374c5eeaf9
.
This patch was not fixing the problem regarding deleting rules associated to target-port removed and it is removing rules that should not be deleted
Change-Id: I521392075b1b7012af19b4649ee2180c08643243
This commit is contained in:
parent
3fbb26b011
commit
838dcf5360
|
@ -139,19 +139,6 @@ class LBaaSv2Driver(base.LBaaSDriver):
|
||||||
LOG.exception('Failed when creating security group rule '
|
LOG.exception('Failed when creating security group rule '
|
||||||
'for listener %s.', listener.name)
|
'for listener %s.', listener.name)
|
||||||
|
|
||||||
def _get_matched_sg_rule(self, rule, lbaas_sg_rules):
|
|
||||||
for lbaas_sg_rule in lbaas_sg_rules:
|
|
||||||
if lbaas_sg_rule['remote_ip_prefix'] == rule['remote_ip_prefix']:
|
|
||||||
return lbaas_sg_rule
|
|
||||||
return None
|
|
||||||
|
|
||||||
def _delete_sg_rule(self, rule, lbaas_sg_rules):
|
|
||||||
neutron = clients.get_neutron_client()
|
|
||||||
sg_rule = self._get_matched_sg_rule(rule, lbaas_sg_rules)
|
|
||||||
if sg_rule:
|
|
||||||
LOG.debug("Deleting sg rule: %r", sg_rule['id'])
|
|
||||||
neutron.delete_security_group_rule(sg_rule['id'])
|
|
||||||
|
|
||||||
def _apply_members_security_groups(self, loadbalancer, port, target_port,
|
def _apply_members_security_groups(self, loadbalancer, port, target_port,
|
||||||
protocol, sg_rule_name):
|
protocol, sg_rule_name):
|
||||||
neutron = clients.get_neutron_client()
|
neutron = clients.get_neutron_client()
|
||||||
|
@ -160,9 +147,6 @@ class LBaaSv2Driver(base.LBaaSDriver):
|
||||||
else:
|
else:
|
||||||
sg_id = self._get_vip_port(loadbalancer).get('security_groups')[0]
|
sg_id = self._get_vip_port(loadbalancer).get('security_groups')[0]
|
||||||
|
|
||||||
lbaas_sg_rules = neutron.list_security_group_rules(
|
|
||||||
security_group_id=sg_id)
|
|
||||||
|
|
||||||
# Check if Network Policy allows listener on the pods
|
# Check if Network Policy allows listener on the pods
|
||||||
for sg in loadbalancer.security_groups:
|
for sg in loadbalancer.security_groups:
|
||||||
if sg != sg_id:
|
if sg != sg_id:
|
||||||
|
@ -182,8 +166,6 @@ class LBaaSv2Driver(base.LBaaSDriver):
|
||||||
max_port = rule.get('port_range_max')
|
max_port = rule.get('port_range_max')
|
||||||
if (min_port and target_port not in range(min_port,
|
if (min_port and target_port not in range(min_port,
|
||||||
max_port+1)):
|
max_port+1)):
|
||||||
self._delete_sg_rule(
|
|
||||||
rule, lbaas_sg_rules['security_group_rules'])
|
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
neutron.create_security_group_rule({
|
neutron.create_security_group_rule({
|
||||||
|
|
Loading…
Reference in New Issue