Merge "[OVN] External ports (SR-IOV) QoS is handled by SR-IOV agent" into stable/victoria

This commit is contained in:
Zuul 2021-04-06 18:57:41 +00:00 committed by Gerrit Code Review
commit d3ef3b86b9
3 changed files with 20 additions and 5 deletions

View File

@ -23,6 +23,7 @@ from neutron_lib.plugins import directory
from neutron_lib.services.qos import constants as qos_consts
from oslo_log import log as logging
from neutron.common.ovn import constants as ovn_const
from neutron.common.ovn import utils
@ -180,14 +181,19 @@ class OVNClientQosExtension(object):
if ovn_rule:
txn.add(self._driver._nb_idl.qos_add(**ovn_rule))
def create_port(self, txn, port):
self.update_port(txn, port, None, reset=True)
def create_port(self, txn, port, port_type=None):
self.update_port(txn, port, None, reset=True, port_type=port_type)
def delete_port(self, txn, port):
self.update_port(txn, port, None, delete=True)
def update_port(self, txn, port, original_port, reset=False, delete=False,
qos_rules=None):
qos_rules=None, port_type=None):
if port_type == ovn_const.LSP_TYPE_EXTERNAL:
# External ports (SR-IOV) QoS is handled the SR-IOV agent QoS
# extension.
return
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

View File

@ -419,7 +419,7 @@ class OVNClient(object):
if self.is_dns_required_for_port(port):
self.add_txns_to_sync_port_dns_records(txn, port)
self._qos_driver.create_port(txn, port)
self._qos_driver.create_port(txn, port, port_type=port_info.type)
db_rev.bump_revision(context, port, ovn_const.TYPE_PORTS)
@ -564,7 +564,8 @@ class OVNClient(object):
utils.is_lsp_trusted(port)):
self._del_port_from_drop_port_group(port['id'], txn)
self._qos_driver.update_port(txn, port, port_object)
self._qos_driver.update_port(txn, port, port_object,
port_type=port_info.type)
if self.is_dns_required_for_port(port):
self.add_txns_to_sync_port_dns_records(

View File

@ -21,6 +21,7 @@ from neutron_lib.services.qos import constants as qos_constants
from oslo_config import cfg
from oslo_utils import uuidutils
from neutron.common.ovn import constants as ovn_const
from neutron.core_extensions import qos as core_qos
from neutron import manager
from neutron.objects import network as network_obj
@ -253,6 +254,13 @@ 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)
# External port, OVN QoS extension does not apply.
self.mock_rules.reset_mock()
port.qos_policy_id = self.qos_policies[0].id
self.qos_driver.update_port(mock.ANY, port, original_port,
port_type=ovn_const.LSP_TYPE_EXTERNAL)
self.mock_rules.assert_not_called()
def test_delete_port(self):
self.mock_rules.reset_mock()
self.qos_driver.delete_port(mock.ANY, self.ports[1])