From a2dc3c35e3d35c6a5f2099fee819e87b4fa216e9 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Mon, 18 Jul 2016 11:52:12 +0100 Subject: [PATCH] Add new configuration test in sanity check: vf_extended_management This test will check if 'ip link' version installed in this server supports extended VF management parameter 'min_tx_rate'. This parameter set the minimum egress rate for an interface. This test is executed when SR-IOV back-end and QoS extension are enabled. DocImpact Partial-Bug: #1560963 Change-Id: Ie9334f4ad2f6b047bf56689edf3333a8a612364a --- neutron/agent/linux/ip_link_support.py | 1 + neutron/cmd/sanity/checks.py | 24 +++++++++++++++---- neutron/cmd/sanity_check.py | 15 ++++++++++++ .../tests/functional/sanity/test_sanity.py | 3 +++ 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/neutron/agent/linux/ip_link_support.py b/neutron/agent/linux/ip_link_support.py index b633bbfb0dd..225a39beaf6 100644 --- a/neutron/agent/linux/ip_link_support.py +++ b/neutron/agent/linux/ip_link_support.py @@ -41,6 +41,7 @@ class IpLinkConstants(object): IP_LINK_CAPABILITY_STATE = "state" IP_LINK_CAPABILITY_VLAN = "vlan" IP_LINK_CAPABILITY_RATE = "rate" + IP_LINK_CAPABILITY_MIN_TX_RATE = "min_tx_rate" IP_LINK_CAPABILITY_SPOOFCHK = "spoofchk" IP_LINK_SUB_CAPABILITY_QOS = "qos" diff --git a/neutron/cmd/sanity/checks.py b/neutron/cmd/sanity/checks.py index 8973757e49b..dd9fc30fbcc 100644 --- a/neutron/cmd/sanity/checks.py +++ b/neutron/cmd/sanity/checks.py @@ -144,12 +144,8 @@ def icmpv6_header_match_supported(): actions="NORMAL") -def vf_management_supported(): +def _vf_management_support(required_caps): is_supported = True - required_caps = ( - ip_link_support.IpLinkConstants.IP_LINK_CAPABILITY_STATE, - ip_link_support.IpLinkConstants.IP_LINK_CAPABILITY_SPOOFCHK, - ip_link_support.IpLinkConstants.IP_LINK_CAPABILITY_RATE) try: vf_section = ip_link_support.IpLinkSupport.get_vf_mgmt_section() for cap in required_caps: @@ -165,6 +161,24 @@ def vf_management_supported(): return is_supported +def vf_management_supported(): + required_caps = ( + ip_link_support.IpLinkConstants.IP_LINK_CAPABILITY_STATE, + ip_link_support.IpLinkConstants.IP_LINK_CAPABILITY_SPOOFCHK, + ip_link_support.IpLinkConstants.IP_LINK_CAPABILITY_RATE) + return _vf_management_support(required_caps) + + +def vf_extended_management_supported(): + required_caps = ( + ip_link_support.IpLinkConstants.IP_LINK_CAPABILITY_STATE, + ip_link_support.IpLinkConstants.IP_LINK_CAPABILITY_SPOOFCHK, + ip_link_support.IpLinkConstants.IP_LINK_CAPABILITY_RATE, + ip_link_support.IpLinkConstants.IP_LINK_CAPABILITY_MIN_TX_RATE, + ) + return _vf_management_support(required_caps) + + def netns_read_requires_helper(): ipw = ip_lib.IPWrapper() nsname = "netnsreadtest-" + uuidutils.generate_uuid() diff --git a/neutron/cmd/sanity_check.py b/neutron/cmd/sanity_check.py index 6d7a4c17700..56dbe4ec6d8 100644 --- a/neutron/cmd/sanity_check.py +++ b/neutron/cmd/sanity_check.py @@ -185,6 +185,16 @@ def check_vf_management(): return result +def check_vf_extended_management(): + result = checks.vf_extended_management_supported() + if not result: + LOG.error(_LE('Check for VF extended management support failed. ' + 'Please ensure that the version of ip link ' + 'being used has VF extended support: version ' + '"iproute2-ss140804", git tag "v3.16.0"')) + return result + + def check_ovsdb_native(): cfg.CONF.set_override('ovsdb_interface', 'native', group='OVS') result = checks.ovsdb_native_supported() @@ -248,6 +258,8 @@ OPTS = [ help=_('Check for ICMPv6 header match support')), BoolOptCallback('vf_management', check_vf_management, help=_('Check for VF management support')), + BoolOptCallback('vf_extended_management', check_vf_extended_management, + help=_('Check for VF extended management support')), BoolOptCallback('read_netns', check_read_netns, help=_('Check netns permission settings')), BoolOptCallback('dnsmasq_version', check_dnsmasq_version, @@ -307,6 +319,9 @@ def enable_tests_from_config(): cfg.CONF.set_default('ipset_installed', True) if cfg.CONF.SECURITYGROUP.enable_security_group: cfg.CONF.set_default('ip6tables_installed', True) + if ('sriovnicswitch' in cfg.CONF.ml2.mechanism_drivers and + 'qos' in cfg.CONF.ml2.extension_drivers): + cfg.CONF.set_default('vf_extended_management', True) def all_tests_passed(): diff --git a/neutron/tests/functional/sanity/test_sanity.py b/neutron/tests/functional/sanity/test_sanity.py index b6aec474b33..cd1599ade21 100644 --- a/neutron/tests/functional/sanity/test_sanity.py +++ b/neutron/tests/functional/sanity/test_sanity.py @@ -77,6 +77,9 @@ class SanityTestCaseRoot(functional_base.BaseSudoTestCase): def test_vf_management_runs(self): checks.vf_management_supported() + def test_vf_extended_management_runs(self): + checks.vf_extended_management_supported() + def test_namespace_root_read_detection_runs(self): checks.netns_read_requires_helper()