Add support for direct ports with QoS in OVS

Today OVS mechanism driver can bind Direct port see [1] for OVS hardware
offloads.
OVS was extended with tc-offload to support rate limit see [2].
The OVS QoS driver [3] is limited to work only with Normal Ports, so we
can't put QoS rules on direct port.
This patch proposes to add support in OVS QoS driver for direct ports.
The mechanism to enforce such policies is the same with normal and
hardware offloaded direct ports.

[1] - e7f6ba220e
[2] - 3b074128ca/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py (L83)
[3] - 3b074128ca/neutron/services/qos/drivers/openvswitch/driver.py (L56)

Change-Id: I24b5cd6c022e479080fc84e4c445c9cddfc88e38
Closes-Bug: #1843165
This commit is contained in:
waleed mousa 2018-10-18 09:41:38 -04:00 committed by abdallahyas
parent ae67ae824c
commit 12089a526e
5 changed files with 52 additions and 1 deletions

View File

@ -363,6 +363,11 @@ integration bridge functions:
The DSCP markings are in fact configured on the port by means of
openflow rules.
.. note::
As of Ussuri release, the QoS rules can be applied for direct ports with hardware
offload capability (switchdev), this requires Open vSwitch version 2.11.0 or newer
and Linux kernel based on kernel 5.4.0 or newer.
SR-IOV
++++++

View File

@ -23,6 +23,7 @@ from neutron_lib import exceptions
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import uuidutils
from oslo_utils import versionutils
from neutron.agent.common import ovs_lib
from neutron.agent.l3 import ha_router
@ -42,6 +43,7 @@ LOG = logging.getLogger(__name__)
MINIMUM_DNSMASQ_VERSION = 2.67
DNSMASQ_VERSION_DHCP_RELEASE6 = 2.76
DIRECT_PORT_QOS_MIN_OVS_VERSION = '2.11'
MINIMUM_DIBBLER_VERSION = '1.0.1'
CONNTRACK_GRE_MODULE = 'nf_conntrack_proto_gre'
@ -199,6 +201,10 @@ def get_dnsmasq_version_with_dhcp_release6():
return DNSMASQ_VERSION_DHCP_RELEASE6
def get_ovs_version_for_qos_direct_port_support():
return DIRECT_PORT_QOS_MIN_OVS_VERSION
def dnsmasq_local_service_supported():
cmd = ['dnsmasq', '--test', '--local-service']
env = {'LC_ALL': 'C'}
@ -230,6 +236,26 @@ def dnsmasq_version_supported():
return True
def ovs_qos_direct_port_supported():
try:
cmd = ['ovs-vsctl', '-V']
out = agent_utils.execute(cmd)
matched_line = re.search(r"ovs-vsctl.*", out)
matched_version = re.search(r"(\d+\.\d+)", matched_line.group(0))
ver = versionutils.convert_version_to_tuple(matched_version.group(1) if
matched_version else '0.0')
minver = versionutils.convert_version_to_tuple(
DIRECT_PORT_QOS_MIN_OVS_VERSION)
if ver < minver:
return False
except (OSError, RuntimeError, ValueError) as e:
LOG.debug("Exception while checking minimal ovs version "
"required for supporting direct ports QoS rules. "
"Exception: %s", e)
return False
return True
def dhcp_release6_supported():
return runtime_checks.dhcp_release6_supported()

View File

@ -118,6 +118,16 @@ def check_dnsmasq_version():
return result
def check_ovs_qos_direct_ports_supported():
result = checks.ovs_qos_direct_port_supported()
if not result:
LOG.error('The installed version of OVS does not support '
'QoS rules for direct ports. '
'Please update to version %s or newer.',
checks.get_ovs_version_for_qos_direct_port_support())
return result
def check_dnsmasq_local_service_supported():
result = checks.dnsmasq_local_service_supported()
if not result:
@ -324,6 +334,9 @@ OPTS = [
BoolOptCallback('dnsmasq_local_service_supported',
check_dnsmasq_local_service_supported,
help=_('Check for local-service support in dnsmasq')),
BoolOptCallback('ovs_qos_direct_port_supported',
check_ovs_qos_direct_ports_supported,
help=_('Check if the ovs supports QoS for direct ports')),
BoolOptCallback('dnsmasq_version', check_dnsmasq_version,
help=_('Check minimal dnsmasq version'),
deprecated_for_removal=True,

View File

@ -53,7 +53,7 @@ class OVSDriver(base.DriverBase):
name='openvswitch',
vif_types=[portbindings.VIF_TYPE_OVS,
portbindings.VIF_TYPE_VHOST_USER],
vnic_types=[portbindings.VNIC_NORMAL],
vnic_types=[portbindings.VNIC_NORMAL, portbindings.VNIC_DIRECT],
supported_rules=SUPPORTED_RULES,
requires_rpc_notifications=True)

View File

@ -0,0 +1,7 @@
---
other:
- |
Added QoS support for direct ports in neutron.
The support requires Open vSwitch 2.11.0 or newer and is based on Linux kernel 5.4.0 or newer.
[`bug 1843165 <https://bugs.launchpad.net/neutron/+bug/1843165>`_].