Introduce Port resource request extension
The resources needed by a port are expressed to nova via resource_request extending the port. If the port requested by nova boot has resource_request attribute, that means that placement must enforce the minimum bandwidth requirements. Change-Id: I53a77c4d0aa951480abef614febf810772400621 Needed-By: https://review.openstack.org/584906 Partial-Bug: #1578989 See-Also: https://review.openstack.org/502306 (nova spec) See-Also: https://review.openstack.org/508149 (neutron spec)
This commit is contained in:
parent
579e0ccabb
commit
061a77b4f2
@ -63,6 +63,7 @@ from neutron_lib.api.definitions import network_mtu_writable
|
|||||||
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_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
|
||||||
from neutron_lib.api.definitions import portbindings_extended
|
from neutron_lib.api.definitions import portbindings_extended
|
||||||
@ -152,6 +153,7 @@ _ALL_API_DEFINITIONS = {
|
|||||||
pagination,
|
pagination,
|
||||||
port,
|
port,
|
||||||
port_mac_address_regenerate,
|
port_mac_address_regenerate,
|
||||||
|
port_resource_request,
|
||||||
port_security,
|
port_security,
|
||||||
portbindings,
|
portbindings,
|
||||||
portbindings_extended,
|
portbindings_extended,
|
||||||
|
@ -107,6 +107,7 @@ KNOWN_EXTENSIONS = (
|
|||||||
'network-ip-availability',
|
'network-ip-availability',
|
||||||
'network_availability_zone',
|
'network_availability_zone',
|
||||||
'pagination',
|
'pagination',
|
||||||
|
'port-resource-request',
|
||||||
'port-security',
|
'port-security',
|
||||||
'project-id',
|
'project-id',
|
||||||
'provider',
|
'provider',
|
||||||
|
42
neutron_lib/api/definitions/port_resource_request.py
Normal file
42
neutron_lib/api/definitions/port_resource_request.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Copyright (c) 2018 Ericsson
|
||||||
|
#
|
||||||
|
# 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-resource-request'
|
||||||
|
IS_SHIM_EXTENSION = False
|
||||||
|
IS_STANDARD_ATTR_EXTENSION = False
|
||||||
|
NAME = 'Port Resource Request'
|
||||||
|
DESCRIPTION = "Expose resource request to Port"
|
||||||
|
UPDATED_TIMESTAMP = "2018-05-08T10:00:00-00:00"
|
||||||
|
RESOURCE_NAME = port.RESOURCE_NAME
|
||||||
|
COLLECTION_NAME = port.COLLECTION_NAME
|
||||||
|
RESOURCE_REQUEST = 'resource_request'
|
||||||
|
|
||||||
|
RESOURCE_ATTRIBUTE_MAP = {
|
||||||
|
COLLECTION_NAME: {
|
||||||
|
RESOURCE_REQUEST: {'allow_post': False,
|
||||||
|
'allow_put': False,
|
||||||
|
'default': constants.ATTR_NOT_SPECIFIED,
|
||||||
|
'is_visible': True}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
SUB_RESOURCE_ATTRIBUTE_MAP = None
|
||||||
|
ACTION_MAP = {}
|
||||||
|
ACTION_STATUS = {}
|
||||||
|
REQUIRED_EXTENSIONS = []
|
||||||
|
OPTIONAL_EXTENSIONS = []
|
@ -0,0 +1,21 @@
|
|||||||
|
# Copyright (c) 2018 Ericsson
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
from neutron_lib.tests.unit.api.definitions import base
|
||||||
|
|
||||||
|
|
||||||
|
class PortResourceRequestDefinitionTestCase(base.DefinitionBaseTestCase):
|
||||||
|
extension_module = port_resource_request
|
||||||
|
extension_attributes = (port_resource_request.RESOURCE_REQUEST,)
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- The new extension ``port-resource-request`` adds the ``resource_request``
|
||||||
|
attribute to port responses. This attribute enables Neutron to communicate
|
||||||
|
to Nova resources needed by the port, such as physnet, VNIC type and
|
||||||
|
bandwidth. If the port requested by Nova boot has the ``resource_request``
|
||||||
|
attribute, then the Nova Scheduler will try to allocate the VM in a host
|
||||||
|
that can satisfy those requirements.
|
Loading…
x
Reference in New Issue
Block a user