Browse Source

Merge "[OVN] Fix logic issue while deleting port with QoS" into stable/train

changes/66/743166/1
Zuul 1 week ago
committed by Gerrit Code Review
parent
commit
cb24eb9d0d
3 changed files with 13 additions and 9 deletions
  1. +1
    -1
      networking_ovn/common/client_extensions/qos.py
  2. +4
    -8
      networking_ovn/common/ovn_client.py
  3. +8
    -0
      networking_ovn/tests/unit/common/client_extensions/test_qos.py

+ 1
- 1
networking_ovn/common/client_extensions/qos.py View File

@@ -194,7 +194,7 @@ class OVNClientQosExtension(object):

def update_port(self, txn, port, original_port, reset=False, delete=False,
qos_rules=None):
if not reset and not original_port:
if (not reset and not original_port) and not delete:
# If there is no information about the previous QoS policy, do not
# make any change, unless the port is new or the QoS information
# must be reset (delete any previous configuration and set new


+ 4
- 8
networking_ovn/common/ovn_client.py View File

@@ -580,17 +580,13 @@ class OVNClient(object):
if ovn_port is None:
return

network_id = ovn_port.external_ids.get(
ovn_network_name = ovn_port.external_ids.get(
ovn_const.OVN_NETWORK_NAME_EXT_ID_KEY)

# TODO(lucasagomes): For backward compatibility, if network_id
# is not in the OVNDB, look at the port_object
if not network_id and port_object:
network_id = port_object['network_id']
network_id = ovn_network_name.strip('neutron-')

with self._nb_idl.transaction(check_error=True) as txn:
txn.add(self._nb_idl.delete_lswitch_port(
port_id, network_id))
port_id, ovn_network_name))

p_object = ({'id': port_id, 'network_id': network_id}
if not port_object else port_object)
@@ -602,7 +598,7 @@ class OVNClient(object):
# Check if the port being deleted is a virtual parent
if (ovn_port.type != ovn_const.LSP_TYPE_VIRTUAL and
self._is_virtual_port_supported()):
ls = self._nb_idl.ls_get(network_id).execute(
ls = self._nb_idl.ls_get(ovn_network_name).execute(
check_error=True)
cmd = self._nb_idl.unset_lswitch_port_to_virtual_type
for lsp in ls.ports:


+ 8
- 0
networking_ovn/tests/unit/common/client_extensions/test_qos.py View File

@@ -251,6 +251,14 @@ class TestOVNClientQosExtension(test_plugin.Ml2PluginV2TestCase):
self.mock_rules.assert_called_once_with(
mock.ANY, port.id, port.network_id, self.qos_policies[0].id, None)

def test_delete_port(self):
self.mock_rules.reset_mock()
self.qos_driver.delete_port(mock.ANY, self.ports[1])

# Assert that rules are deleted
self.mock_rules.assert_called_once_with(
mock.ANY, self.ports[1].id, self.ports[1].network_id, None, None)

def test_update_network(self):
"""Test update network.



Loading…
Cancel
Save