From b40f98b57e3274892c893d30139e03bb6b21d6d2 Mon Sep 17 00:00:00 2001 From: Litao Gao Date: Mon, 25 Jan 2021 03:46:08 -0500 Subject: [PATCH] Interface profile support for VF rate limiting configuration This feature is part of 'Single NIC support'. This commit eanbles interface profile creation and apply of interface configuration which includes VF max-tx-rate config. Story: 2008470 Task: 41683 Depends-On: https://review.opendev.org/c/starlingx/config/+/770135 Signed-off-by: Litao Gao Change-Id: Ib8a8a1844d5a151c15454f446129642ed4f4dfe8 --- sysinv/sysinv/sysinv/etc/sysinv/profileSchema.xsd | 1 + sysinv/sysinv/sysinv/sysinv/api/controllers/v1/profile.py | 5 ++++- .../sysinv/sysinv/sysinv/api/controllers/v1/profile_utils.py | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sysinv/sysinv/sysinv/etc/sysinv/profileSchema.xsd b/sysinv/sysinv/sysinv/etc/sysinv/profileSchema.xsd index 5dfdbddd2f..c8aee238bf 100644 --- a/sysinv/sysinv/sysinv/etc/sysinv/profileSchema.xsd +++ b/sysinv/sysinv/sysinv/etc/sysinv/profileSchema.xsd @@ -163,6 +163,7 @@ + diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/profile.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/profile.py index 66ddf6d93a..7fc7514bee 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/profile.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/profile.py @@ -79,7 +79,7 @@ INTERFACE_PROFILE_FIELDS = ['ifname', 'iftype', 'imtu', 'networktype', 'txhashpolicy', 'forihostid', 'datanetworks', 'vlan_id', 'ipv4_mode', 'ipv6_mode', 'ipv4_pool', 'ipv6_pool', - 'sriov_numvfs', 'sriov_vf_driver'] + 'sriov_numvfs', 'sriov_vf_driver', 'max_tx_rate'] class Profile(base.APIBase): @@ -1355,6 +1355,7 @@ def _create_if_profile(profile_name, profile_node): 'ipv6_pool': ipv6_mode['pool'], 'sriov_numvfs': ethIf.virtualFunctions, 'sriov_vf_driver': ethIf.virtualFunctionDriver, + 'max_tx_rate': ethIf.maxTxRate, 'interface_profile': True } newIf = interface_api._create(idict, from_profile=True) @@ -1397,6 +1398,7 @@ def _create_if_profile(profile_name, profile_node): 'imtu': aeIf.mtu, 'sriov_numvfs': ethIf.virtualFunctions, 'sriov_vf_driver': ethIf.virtualFunctionDriver, + 'max_tx_rate': ethIf.maxTxRate, 'interface_profile': True } @@ -1425,6 +1427,7 @@ def _create_if_profile(profile_name, profile_node): 'imtu': vlanIf.mtu, 'sriov_numvfs': ethIf.virtualFunctions, 'sriov_vf_driver': ethIf.virtualFunctionDriver, + 'max_tx_rate': ethIf.maxTxRate, 'interface_profile': True } diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/profile_utils.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/profile_utils.py index 67c5073958..b42fc68375 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/profile_utils.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/profile_utils.py @@ -136,6 +136,7 @@ class PciSriov(Network): super(PciSriov, self).__init__(node, constants.NETWORK_TYPE_PCI_SRIOV) self.virtualFunctions = int(node.get('virtualFunctions')) self.virtualFunctionDriver = node.get('virtualFunctionDriver') + self.maxTxRate = node.get('maxTxRate') class Interface(object): @@ -150,6 +151,7 @@ class Interface(object): self.routes = [] self.virtualFunctions = 0 self.virtualFunctionDriver = None + self.maxTxRate = None networksNode = ifNode.find('networks') if networksNode is not None: for netNode in networksNode: @@ -171,6 +173,7 @@ class Interface(object): elif network.networkType == constants.NETWORK_TYPE_PCI_SRIOV: self.virtualFunctions = network.virtualFunctions self.virtualFunctionDriver = network.virtualFunctionDriver + self.maxTxRate = network.maxTxRate if isinstance(network, Network): self.providerNetworks = network.providerNetworks