Browse Source

Merge "Check SG members instead of ports to skip flow update" into stable/queens

changes/33/709133/1
Zuul 4 months ago
committed by Gerrit Code Review
parent
commit
dad3dc704e
3 changed files with 26 additions and 3 deletions
  1. +1
    -1
      neutron/agent/linux/openvswitch_firewall/firewall.py
  2. +17
    -2
      neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py
  3. +8
    -0
      releasenotes/notes/fix-remote-security-group-no-port-on-host-9177e66d4b16e90c.yaml

+ 1
- 1
neutron/agent/linux/openvswitch_firewall/firewall.py View File

@@ -293,7 +293,7 @@ class ConjIPFlowManager(object):
addr_to_conj = collections.defaultdict(list)
for remote_id, conj_id_set in sg_conj_id_map.items():
remote_group = self.driver.sg_port_map.get_sg(remote_id)
if not remote_group or not remote_group.ports:
if not remote_group or not remote_group.members:
LOG.debug('No member for SG %s', remote_id)
continue
for addr in remote_group.get_ethertype_filtered_addresses(


+ 17
- 2
neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py View File

@@ -303,9 +303,9 @@ class TestConjIPFlowManager(base.BaseTestCase):
self.vlan_tag = 100
self.conj_id = 16

def test_update_flows_for_vlan_no_ports(self):
def test_update_flows_for_vlan_no_members(self):
remote_group = self.driver.sg_port_map.get_sg.return_value
remote_group.ports = {}
remote_group.members = {}
with mock.patch.object(self.manager.conj_id_map,
'get_conj_id') as get_conj_id_mock:
get_conj_id_mock.return_value = self.conj_id
@@ -315,6 +315,21 @@ class TestConjIPFlowManager(base.BaseTestCase):
self.assertFalse(remote_group.get_ethertype_filtered_addresses.called)
self.assertFalse(self.driver._add_flow.called)

def test_update_flows_for_vlan_no_ports_but_members(self):
remote_group = self.driver.sg_port_map.get_sg.return_value
remote_group.ports = set()
remote_group.members = {constants.IPv4: ['10.22.3.4']}
remote_group.get_ethertype_filtered_addresses.return_value = [
'10.22.3.4']
with mock.patch.object(self.manager.conj_id_map,
'get_conj_id') as get_conj_id_mock:
get_conj_id_mock.return_value = self.conj_id
self.manager.add(self.vlan_tag, 'sg', 'remote_id',
constants.INGRESS_DIRECTION, constants.IPv4, 0)
self.manager.update_flows_for_vlan(self.vlan_tag)
self.assertTrue(remote_group.get_ethertype_filtered_addresses.called)
self.assertTrue(self.driver._add_flow.called)

def test_update_flows_for_vlan(self):
remote_group = self.driver.sg_port_map.get_sg.return_value
remote_group.get_ethertype_filtered_addresses.return_value = [


+ 8
- 0
releasenotes/notes/fix-remote-security-group-no-port-on-host-9177e66d4b16e90c.yaml View File

@@ -0,0 +1,8 @@
---
fixes:
- |
Fixes an issue that the OVS firewall driver does not configure security
group rules using remote group properly when a corresponding remote group
has no port on a local hypervisor. For more information
see bugs: `1862703 <https://bugs.launchpad.net/neutron/+bug/1862703>`_
and `1854131 <https://bugs.launchpad.net/neutron/+bug/1854131>`__.

Loading…
Cancel
Save