Merge "New api-def: port-numa-affinity-policy"
This commit is contained in:
commit
26ad0f23d5
@ -4150,6 +4150,20 @@ networks:
|
|||||||
in: body
|
in: body
|
||||||
required: true
|
required: true
|
||||||
type: array
|
type: array
|
||||||
|
numa_affinity_policy:
|
||||||
|
description: |
|
||||||
|
The port NUMA affinity policy requested during the virtual machine
|
||||||
|
scheduling. Values: ``None``, ``requiered``, ``preferred`` or ``legacy``.
|
||||||
|
in: body
|
||||||
|
required: False
|
||||||
|
type: string
|
||||||
|
numa_affinity_policy-request:
|
||||||
|
description: |
|
||||||
|
The port NUMA affinity policy requested during the virtual machine
|
||||||
|
scheduling. Values: ``None``, ``requiered``, ``preferred`` or ``legacy``.
|
||||||
|
in: body
|
||||||
|
required: False
|
||||||
|
type: string
|
||||||
object_id:
|
object_id:
|
||||||
description: |
|
description: |
|
||||||
The ID of the ``object_type`` resource. An ``object_type`` of ``network``
|
The ID of the ``object_type`` resource. An ``object_type`` of ``network``
|
||||||
|
@ -85,6 +85,13 @@ The ``mac_learning_enabled`` extension extends neutron ports providing the
|
|||||||
ability to enable MAC learning on the associated port via the
|
ability to enable MAC learning on the associated port via the
|
||||||
```mac_learning_enabled``` attribute.
|
```mac_learning_enabled``` attribute.
|
||||||
|
|
||||||
|
NUMA affinity policy
|
||||||
|
====================
|
||||||
|
|
||||||
|
The NUMA affinity policy extension (``port-numa-affinity-policy``) defines
|
||||||
|
the Nova scheduling strategy according to the network backend NUMA topology.
|
||||||
|
This parameter could be ``required``, ``preferred``, ``legacy`` or ``None``.
|
||||||
|
|
||||||
Port binding extended attributes
|
Port binding extended attributes
|
||||||
================================
|
================================
|
||||||
|
|
||||||
@ -206,6 +213,7 @@ Response Parameters
|
|||||||
- mac_address: mac_address
|
- mac_address: mac_address
|
||||||
- name: name
|
- name: name
|
||||||
- network_id: network_id
|
- network_id: network_id
|
||||||
|
- numa_affinity_policy: numa_affinity_policy
|
||||||
- port_security_enabled: port_security_enabled
|
- port_security_enabled: port_security_enabled
|
||||||
- project_id: project_id
|
- project_id: project_id
|
||||||
- qos_network_policy_id: qos_network_policy_id-port-response
|
- qos_network_policy_id: qos_network_policy_id-port-response
|
||||||
@ -289,6 +297,7 @@ Request
|
|||||||
- fixed_ips: fixed_ips-request
|
- fixed_ips: fixed_ips-request
|
||||||
- mac_address: mac_address-request-put
|
- mac_address: mac_address-request-put
|
||||||
- name: name-request
|
- name: name-request
|
||||||
|
- numa_affinity_policy: numa_affinity_policy-request
|
||||||
- port_security_enabled: port_security_enabled-request
|
- port_security_enabled: port_security_enabled-request
|
||||||
- qos_policy_id: qos_policy_id-port-request
|
- qos_policy_id: qos_policy_id-port-request
|
||||||
- security_groups: port-security_groups-request
|
- security_groups: port-security_groups-request
|
||||||
@ -334,6 +343,7 @@ Response Parameters
|
|||||||
- mac_address: mac_address
|
- mac_address: mac_address
|
||||||
- name: name
|
- name: name
|
||||||
- network_id: network_id
|
- network_id: network_id
|
||||||
|
- numa_affinity_policy: numa_affinity_policy
|
||||||
- port_security_enabled: port_security_enabled
|
- port_security_enabled: port_security_enabled
|
||||||
- project_id: project_id
|
- project_id: project_id
|
||||||
- qos_network_policy_id: qos_network_policy_id-port-response
|
- qos_network_policy_id: qos_network_policy_id-port-response
|
||||||
@ -470,6 +480,7 @@ Response Parameters
|
|||||||
- mac_address: mac_address
|
- mac_address: mac_address
|
||||||
- name: name
|
- name: name
|
||||||
- network_id: network_id
|
- network_id: network_id
|
||||||
|
- numa_affinity_policy: numa_affinity_policy
|
||||||
- port_security_enabled: port_security_enabled
|
- port_security_enabled: port_security_enabled
|
||||||
- project_id: project_id
|
- project_id: project_id
|
||||||
- qos_network_policy_id: qos_network_policy_id-port-response
|
- qos_network_policy_id: qos_network_policy_id-port-response
|
||||||
@ -531,6 +542,7 @@ Request
|
|||||||
- mac_address: mac_address-request
|
- mac_address: mac_address-request
|
||||||
- name: name-request
|
- name: name-request
|
||||||
- network_id: network_id
|
- network_id: network_id
|
||||||
|
- numa_affinity_policy: numa_affinity_policy-request
|
||||||
- port_security_enabled: port_security_enabled-request
|
- port_security_enabled: port_security_enabled-request
|
||||||
- project_id: project_id-request
|
- project_id: project_id-request
|
||||||
- qos_policy_id: qos_policy_id-port-request
|
- qos_policy_id: qos_policy_id-port-request
|
||||||
@ -579,6 +591,7 @@ Response Parameters
|
|||||||
- mac_address: mac_address
|
- mac_address: mac_address
|
||||||
- name: name
|
- name: name
|
||||||
- network_id: network_id
|
- network_id: network_id
|
||||||
|
- numa_affinity_policy: numa_affinity_policy
|
||||||
- port_security_enabled: port_security_enabled
|
- port_security_enabled: port_security_enabled
|
||||||
- project_id: project_id
|
- project_id: project_id
|
||||||
- qos_network_policy_id: qos_network_policy_id-port-response
|
- qos_network_policy_id: qos_network_policy_id-port-response
|
||||||
@ -639,6 +652,7 @@ Request
|
|||||||
- mac_address: mac_address-request
|
- mac_address: mac_address-request
|
||||||
- name: name-request
|
- name: name-request
|
||||||
- network_id: network_id
|
- network_id: network_id
|
||||||
|
- numa_affinity_policy: numa_affinity_policy-request
|
||||||
- port_security_enabled: port_security_enabled-request
|
- port_security_enabled: port_security_enabled-request
|
||||||
- project_id: project_id-request
|
- project_id: project_id-request
|
||||||
- qos_policy_id: qos_policy_id-port-request
|
- qos_policy_id: qos_policy_id-port-request
|
||||||
@ -681,6 +695,7 @@ Response Parameters
|
|||||||
- mac_address: mac_address
|
- mac_address: mac_address
|
||||||
- name: name
|
- name: name
|
||||||
- network_id: network_id
|
- network_id: network_id
|
||||||
|
- numa_affinity_policy: numa_affinity_policy
|
||||||
- port_security_enabled: port_security_enabled
|
- port_security_enabled: port_security_enabled
|
||||||
- project_id: project_id
|
- project_id: project_id
|
||||||
- qos_network_policy_id: qos_network_policy_id-port-response
|
- qos_network_policy_id: qos_network_policy_id-port-response
|
||||||
|
@ -72,6 +72,7 @@ from neutron_lib.api.definitions import network_segment_range
|
|||||||
from neutron_lib.api.definitions import pagination
|
from neutron_lib.api.definitions import pagination
|
||||||
from neutron_lib.api.definitions import port
|
from neutron_lib.api.definitions import port
|
||||||
from neutron_lib.api.definitions import port_mac_address_regenerate
|
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
|
||||||
from neutron_lib.api.definitions import port_security
|
from neutron_lib.api.definitions import port_security
|
||||||
from neutron_lib.api.definitions import portbindings
|
from neutron_lib.api.definitions import portbindings
|
||||||
@ -186,6 +187,7 @@ _ALL_API_DEFINITIONS = {
|
|||||||
pagination,
|
pagination,
|
||||||
port,
|
port,
|
||||||
port_mac_address_regenerate,
|
port_mac_address_regenerate,
|
||||||
|
port_numa_affinity_policy,
|
||||||
port_resource_request,
|
port_resource_request,
|
||||||
port_security,
|
port_security,
|
||||||
portbindings,
|
portbindings,
|
||||||
|
45
neutron_lib/api/definitions/port_numa_affinity_policy.py
Normal file
45
neutron_lib/api/definitions/port_numa_affinity_policy.py
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Copyright (c) 2020 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
from neutron_lib import constants
|
||||||
|
|
||||||
|
|
||||||
|
ALIAS = 'port-numa-affinity-policy'
|
||||||
|
IS_SHIM_EXTENSION = False
|
||||||
|
IS_STANDARD_ATTR_EXTENSION = False
|
||||||
|
NAME = 'Port NUMA affinity policy'
|
||||||
|
DESCRIPTION = "Expose the port NUMA affinity policy"
|
||||||
|
UPDATED_TIMESTAMP = "2020-07-08T10:00:00-00:00"
|
||||||
|
RESOURCE_NAME = port.RESOURCE_NAME
|
||||||
|
COLLECTION_NAME = port.COLLECTION_NAME
|
||||||
|
NUMA_AFFINITY_POLICY = 'numa_affinity_policy'
|
||||||
|
|
||||||
|
RESOURCE_ATTRIBUTE_MAP = {
|
||||||
|
COLLECTION_NAME: {
|
||||||
|
NUMA_AFFINITY_POLICY: {
|
||||||
|
'allow_post': True,
|
||||||
|
'allow_put': True,
|
||||||
|
'validate': {
|
||||||
|
'type:values': constants.PORT_NUMA_POLICIES + (None, )},
|
||||||
|
'default': None,
|
||||||
|
'is_visible': True}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
SUB_RESOURCE_ATTRIBUTE_MAP = None
|
||||||
|
ACTION_MAP = {}
|
||||||
|
ACTION_STATUS = {}
|
||||||
|
REQUIRED_EXTENSIONS = []
|
||||||
|
OPTIONAL_EXTENSIONS = []
|
@ -105,6 +105,8 @@ VIF_TYPE_AGILIO_OVS = 'agilio_ovs'
|
|||||||
VIF_TYPE_HW_VEB = 'hw_veb'
|
VIF_TYPE_HW_VEB = 'hw_veb'
|
||||||
VIF_TYPE_HOSTDEV_PHY = 'hostdev_physical'
|
VIF_TYPE_HOSTDEV_PHY = 'hostdev_physical'
|
||||||
|
|
||||||
|
VIF_UNPLUGGED_TYPES = (VIF_TYPE_BINDING_FAILED, VIF_TYPE_UNBOUND)
|
||||||
|
|
||||||
# VNIC_TYPE: It's used to determine which mechanism driver to use to bind a
|
# VNIC_TYPE: It's used to determine which mechanism driver to use to bind a
|
||||||
# port. It can be specified via the Neutron API. Default is normal,
|
# port. It can be specified via the Neutron API. Default is normal,
|
||||||
# used by OVS and LinuxBridge agent.
|
# used by OVS and LinuxBridge agent.
|
||||||
|
@ -658,3 +658,10 @@ EXT_PARENT_PREFIX = 'ext_parent'
|
|||||||
|
|
||||||
RP_BANDWIDTHS = 'resource_provider_bandwidths'
|
RP_BANDWIDTHS = 'resource_provider_bandwidths'
|
||||||
RP_INVENTORY_DEFAULTS = 'resource_provider_inventory_defaults'
|
RP_INVENTORY_DEFAULTS = 'resource_provider_inventory_defaults'
|
||||||
|
|
||||||
|
# Port NUMA affinity policies, matching Nova NUMA affinity policy constants
|
||||||
|
PORT_NUMA_POLICY_REQUIRED = 'required'
|
||||||
|
PORT_NUMA_POLICY_PREFERRED = 'preferred'
|
||||||
|
PORT_NUMA_POLICY_LEGACY = 'legacy'
|
||||||
|
PORT_NUMA_POLICIES = (PORT_NUMA_POLICY_REQUIRED, PORT_NUMA_POLICY_PREFERRED,
|
||||||
|
PORT_NUMA_POLICY_LEGACY)
|
||||||
|
@ -266,6 +266,20 @@ class PortBound(InUse):
|
|||||||
"old_mac %(old_mac)s, new_mac %(new_mac)s.")
|
"old_mac %(old_mac)s, new_mac %(new_mac)s.")
|
||||||
|
|
||||||
|
|
||||||
|
class PortBoundNUMAAffinityPolicy(InUse):
|
||||||
|
"""An operational error indicating a port is already bound.
|
||||||
|
|
||||||
|
NUMA affinity policy cannot be modified when the port is bound.
|
||||||
|
|
||||||
|
:param port_id: The UUID of the port requested.
|
||||||
|
:param host_id: The host ID where the port is bound.
|
||||||
|
:param numa_affinity_policy: value passed to be updated.
|
||||||
|
"""
|
||||||
|
message = _("Unable to complete operation on port %(port_id)s, "
|
||||||
|
"port is already bound to host %(host_id)s, "
|
||||||
|
"numa_affinity_policy value given %(numa_affinity_policy)s.")
|
||||||
|
|
||||||
|
|
||||||
class MacAddressInUse(InUse):
|
class MacAddressInUse(InUse):
|
||||||
"""An network operational error indicating a MAC address is already in use.
|
"""An network operational error indicating a MAC address is already in use.
|
||||||
|
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
# Copyright 2020 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# 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_numa_affinity_policy
|
||||||
|
from neutron_lib.tests.unit.api.definitions import base
|
||||||
|
|
||||||
|
|
||||||
|
class PortNumaAffinityPolicyDefinitionTestCase(base.DefinitionBaseTestCase):
|
||||||
|
extension_module = port_numa_affinity_policy
|
||||||
|
extension_resources = (port_numa_affinity_policy.COLLECTION_NAME,)
|
||||||
|
extension_attributes = (port_numa_affinity_policy.NUMA_AFFINITY_POLICY,)
|
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
New API definition: ``port-numa-affinity-policy``. The new field added to
|
||||||
|
``ports`` API, ``numa_affinity_policy``, represents the NUMA affinity
|
||||||
|
policy requested by this port during the virtual machine scheduling.
|
||||||
|
Values: None, "required", "preferred", "legacy".
|
Loading…
Reference in New Issue
Block a user