Merge "Add port-resource-request-groups shim API ext"

This commit is contained in:
Zuul 2021-08-17 12:27:19 +00:00 committed by Gerrit Code Review
commit c37e94446f
11 changed files with 190 additions and 14 deletions

View File

@ -4627,10 +4627,19 @@ port-resource:
description: |
Expose Placement resources (i.e.: ``minimum-bandwidth``) and
traits (i.e.: ``vnic-type``, ``physnet``) requested by a port to
Nova and Placement. A ``resource_request`` object contains a
``required`` key for the traits (generated from the ``vnic_type``
and the ``physnet``) required by the port, and a ``resources`` key
for ``ingress`` and ``egress minimum-bandwidth`` need for the port.
Nova and Placement. A ``resource_request`` object contains
``request_groups`` and ``same_subtree`` keys. ``request_groups`` is a list
of dicts, where each dict represents one group of resources and traits
that needs to be fulfilled from a single resource provider. Every dict in
the list must contain ``id``, ``required`` and ``resources`` keys. The
``id`` field is a string which represents a unique UUID that is generated
for each group by combining the ``port_id`` and UUIDs of the QoS rules
contributing to the group via the UUID5 method. ``required`` key contains
the traits (generated from the ``vnic_type`` and the ``physnet``) required
by the port, and a ``resources`` key contains a mapping of requested
resource class name and requested amount from the QoS policy.
``same_subtree`` key contains a list of ``id`` values from every resource
group.
in: body
required: false
type: object

View File

@ -117,6 +117,20 @@ The port resource request extension (``port-resource-request``) allows
administrative users (including Nova) to retrieve the Placement resources and
traits needed by a port by introducing the ``resource_request`` to ``port`` resources.
Port resource request groups
============================
The port resource request groups extension (``port-resource-request-groups``)
introduces a new format of ``resource_request`` field for ``port`` resource.
The new structure enables Neutron to request multiple groups of resources and
traits from the same RP subtree.
Resource request new format example
-----------------------------------
.. literalinclude:: samples/ports/port-resource-request-new-format.json
:language: javascript
Port security
=============

View File

@ -65,8 +65,27 @@
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"port_security_enabled": true,
"resource_request": {
"required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {"NET_BW_EGR_KILOBIT_PER_SEC": 1000}
"request_groups": [
{
"id": "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
"required": ["CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {
"NET_PACKET_RATE_KILOPACKET_PER_SEC": 1000
}
},
{
"id": "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73",
"required": [
"CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {
"NET_BW_EGR_KILOBIT_PER_SEC": 1000
}
}
],
"same_subtree": [
"1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
"b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73"
]
},
"propagate_uplink_status": false
}

View File

@ -54,8 +54,27 @@
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"resource_request": {
"required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {"NET_BW_EGR_KILOBIT_PER_SEC": 1000}
"request_groups": [
{
"id": "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
"required": ["CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {
"NET_PACKET_RATE_KILOPACKET_PER_SEC": 1000
}
},
{
"id": "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73",
"required": [
"CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {
"NET_BW_EGR_KILOBIT_PER_SEC": 1000
}
}
],
"same_subtree": [
"1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
"b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73"
]
},
"propagate_uplink_status": false
}

View File

@ -52,8 +52,27 @@
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"port_security_enabled": false,
"resource_request": {
"required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {"NET_BW_EGR_KILOBIT_PER_SEC": 1000}
"request_groups": [
{
"id": "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
"required": ["CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {
"NET_PACKET_RATE_KILOPACKET_PER_SEC": 1000
}
},
{
"id": "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73",
"required": [
"CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {
"NET_BW_EGR_KILOBIT_PER_SEC": 1000
}
}
],
"same_subtree": [
"1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
"b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73"
]
},
"propagate_uplink_status": false
}

View File

@ -0,0 +1,22 @@
{
"request_groups": [
{
"id": "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
"required": ["CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {
"NET_PACKET_RATE_KILOPACKET_PER_SEC": 1000
}
},
{
"id": "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73",
"required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {
"NET_BW_EGR_KILOBIT_PER_SEC": 2000
}
}
],
"same_subtree": [
"1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
"b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73"
]
}

View File

@ -42,13 +42,31 @@
"revision_number": 1,
"security_groups": [],
"status": "ACTIVE",
"tenant_id": "",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": null,
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"resource_request": {
"required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {"NET_BW_EGR_KILOBIT_PER_SEC": 1000}
"request_groups": [
{
"id": "1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
"required": ["CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {
"NET_PACKET_RATE_KILOPACKET_PER_SEC": 1000
}
},
{
"id": "b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73",
"required": [
"CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
"resources": {
"NET_BW_EGR_KILOBIT_PER_SEC": 1000
}
}
],
"same_subtree": [
"1e4f3958-c0c9-4dec-82fa-ed2dc1c5cb34",
"b20bb47f-5d6d-45a6-8fe7-2c1b44f0db73"
]
},
"tags": ["tag1,tag2"],
"tenant_id": "",
@ -96,7 +114,6 @@
"revision_number": 2,
"security_groups": [],
"status": "ACTIVE",
"tenant_id": "d397de8a63f341818f198abb0966f6f3",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": null,

View File

@ -84,6 +84,7 @@ from neutron_lib.api.definitions import port_device_profile
from neutron_lib.api.definitions import port_mac_address_regenerate
from neutron_lib.api.definitions import port_numa_affinity_policy
from neutron_lib.api.definitions import port_resource_request
from neutron_lib.api.definitions import port_resource_request_groups
from neutron_lib.api.definitions import port_security
from neutron_lib.api.definitions import portbindings
from neutron_lib.api.definitions import portbindings_extended
@ -214,6 +215,7 @@ _ALL_API_DEFINITIONS = {
port_mac_address_regenerate,
port_numa_affinity_policy,
port_resource_request,
port_resource_request_groups,
port_security,
portbindings,
portbindings_extended,

View File

@ -0,0 +1,27 @@
# Copyright (c) 2021 Ericsson Software Technology
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
ALIAS = 'port-resource-request-groups'
IS_SHIM_EXTENSION = True
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'Port Resource Request Groups'
DESCRIPTION = ("Support requesting multiple groups of resources and traits "
"from the same RP subtree in resource_request")
UPDATED_TIMESTAMP = "2021-08-02T10:00:00-00:00"
RESOURCE_ATTRIBUTE_MAP = {}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
ACTION_STATUS = {}
REQUIRED_EXTENSIONS = []
OPTIONAL_EXTENSIONS = []

View File

@ -0,0 +1,22 @@
# Copyright (c) 2021 Ericsson Software Technology
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api.definitions import (port_resource_request_groups
as apidef)
from neutron_lib.tests.unit.api.definitions import base
class PortResourceRequestGroupsDefinitionTestCase(
base.DefinitionBaseTestCase):
extension_module = apidef

View File

@ -0,0 +1,6 @@
---
features:
- |
Add API extension ``port-resource-request-groups``. This extension
indicates that Neutron supports requesting multiple groups of resources
and traits from the same RP subtree in ``resource_request``.