Merge "Introduce Port resource request extension"

This commit is contained in:
Zuul 2018-08-24 23:54:33 +00:00 committed by Gerrit Code Review
commit 24eee17749
5 changed files with 74 additions and 0 deletions

View File

@ -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 port
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 portbindings
from neutron_lib.api.definitions import portbindings_extended
@ -152,6 +153,7 @@ _ALL_API_DEFINITIONS = {
pagination,
port,
port_mac_address_regenerate,
port_resource_request,
port_security,
portbindings,
portbindings_extended,

View File

@ -107,6 +107,7 @@ KNOWN_EXTENSIONS = (
'network-ip-availability',
'network_availability_zone',
'pagination',
'port-resource-request',
'port-security',
'project-id',
'provider',

View 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 = []

View File

@ -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,)

View File

@ -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.