Support server create with ports having resource request
A new API microversion, 2.72, is added that enables support for Neutron ports having resource request during server create. Note that server delete and port detach operations already handle such ports and will clean up the allocation properly. Change-Id: I7555914473e16782d8ba4513a09ce45679962c14 blueprint: bandwidth-resource-provider
This commit is contained in:
parent
c02e213d50
commit
3225fb61f9
@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"status": "CURRENT",
|
||||
"version": "2.71",
|
||||
"version": "2.72",
|
||||
"min_version": "2.1",
|
||||
"updated": "2013-07-23T11:33:21Z"
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
}
|
||||
],
|
||||
"status": "CURRENT",
|
||||
"version": "2.71",
|
||||
"version": "2.72",
|
||||
"min_version": "2.1",
|
||||
"updated": "2013-07-23T11:33:21Z"
|
||||
}
|
||||
|
@ -175,6 +175,9 @@ REST_API_VERSION_HISTORY = """REST API Version History:
|
||||
* 2.71 - Adds the ``server_groups`` field to ``GET /servers/{id}``,
|
||||
``PUT /servers/{server_id}`` and
|
||||
``POST /servers/{server_id}/action`` (rebuild) responses.
|
||||
* 2.72 - Add support for neutron ports with resource request during server
|
||||
create. Server move operations are not yet supported for servers
|
||||
with such ports.
|
||||
"""
|
||||
|
||||
# The minimum and maximum versions of the API supported
|
||||
@ -183,7 +186,7 @@ REST_API_VERSION_HISTORY = """REST API Version History:
|
||||
# Note(cyeoh): This only applies for the v2.1 API once microversions
|
||||
# support is fully merged. It does not affect the V2 API.
|
||||
_MIN_API_VERSION = "2.1"
|
||||
_MAX_API_VERSION = "2.71"
|
||||
_MAX_API_VERSION = "2.72"
|
||||
DEFAULT_API_VERSION = _MIN_API_VERSION
|
||||
|
||||
# Almost all proxy APIs which are related to network, images and baremetal
|
||||
|
@ -541,15 +541,11 @@ def supports_port_resource_request(req):
|
||||
"""Check to see if the requested API version is high enough for resource
|
||||
request
|
||||
|
||||
NOTE: At the moment there is no such microversion that supports port
|
||||
resource request. This function is added as a preparation for that
|
||||
microversion.
|
||||
|
||||
:param req: The incoming API request
|
||||
:returns: True if the requested API microversion is high enough for
|
||||
port resource request support, False otherwise.
|
||||
"""
|
||||
return False
|
||||
return api_version_request.is_supported(req, '2.72')
|
||||
|
||||
|
||||
def supports_port_resource_request_during_move(req):
|
||||
@ -571,8 +567,11 @@ def supports_port_resource_request_during_move(req):
|
||||
def instance_has_port_with_resource_request(
|
||||
context, instance_uuid, network_api):
|
||||
|
||||
# If we ever store any information about resource requests in the
|
||||
# instance info cache then we can replace this neutron API call.
|
||||
# TODO(gibi): Use instance.info_cache to see if there is VIFs with
|
||||
# allocation key in the profile. If there is no such VIF for an instance
|
||||
# and the instance is not shelve offloaded then we can be sure that the
|
||||
# instance has no port with resource request. If the instance is shelve
|
||||
# offloaded then we still have to hit neutron.
|
||||
search_opts = {'device_id': instance_uuid,
|
||||
'fields': ['resource_request']}
|
||||
ports = network_api.list_ports(context, **search_opts).get('ports', [])
|
||||
|
@ -909,3 +909,24 @@ APIs to list the server groups to which the server belongs:
|
||||
* ``PUT /servers/{server_id}``
|
||||
* ``POST /servers/{server_id}/action (rebuild)``
|
||||
|
||||
2.72
|
||||
----
|
||||
|
||||
API microversion 2.72 adds support for creating servers with neutron ports
|
||||
that has resource request, e.g. neutron ports with
|
||||
`QoS minimum bandwidth rule`_. Deleting servers with such ports have
|
||||
already been handled properly as well as detaching these type of ports.
|
||||
|
||||
API limitations:
|
||||
|
||||
* Creating servers with Neutron networks having QoS minimum bandwidth rule
|
||||
is not supported.
|
||||
|
||||
* Attaching Neutron ports and networks having QoS minimum bandwidth rule
|
||||
is not supported.
|
||||
|
||||
* Moving (resizing, migrating, live-migrating, evacuating,
|
||||
unshelving after shelve offload) servers with ports having resource
|
||||
request is not yet supported.
|
||||
|
||||
.. _QoS minimum bandwidth rule: https://docs.openstack.org/neutron/latest/admin/config-qos.html
|
||||
|
@ -2160,11 +2160,9 @@ class NetworksWithQoSPolicyNotSupported(Invalid):
|
||||
|
||||
|
||||
class CreateWithPortResourceRequestOldVersion(Invalid):
|
||||
# TODO(gibi): Mention the specific microversion needed for the support
|
||||
# after such microversion is merged
|
||||
msg_fmt = _("Creating servers with ports having resource requests, like a "
|
||||
"port with a QoS minimum bandwidth policy, is not supported "
|
||||
"with this microversion")
|
||||
"until microversion 2.72.")
|
||||
|
||||
|
||||
class InvalidReservedMemoryPagesOption(Invalid):
|
||||
|
@ -17,7 +17,6 @@ from __future__ import absolute_import
|
||||
import collections
|
||||
import copy
|
||||
import datetime
|
||||
import fixtures
|
||||
import time
|
||||
import zlib
|
||||
|
||||
@ -6089,7 +6088,7 @@ class PortResourceRequestBasedSchedulingTestBase(
|
||||
amount))
|
||||
|
||||
|
||||
class PortResourceRequestBasedSchedulingTest(
|
||||
class UnsupportedPortResourceRequestBasedSchedulingTest(
|
||||
PortResourceRequestBasedSchedulingTestBase):
|
||||
"""Tests for handling servers with ports having resource requests """
|
||||
|
||||
@ -6169,6 +6168,10 @@ class PortResourceRequestBasedSchedulingTest(
|
||||
server['fault']['message'])
|
||||
|
||||
def test_create_server_with_port_resource_request_old_microversion(self):
|
||||
|
||||
# NOTE(gibi): 2.71 is the last microversion where nova does not support
|
||||
# this kind of create server
|
||||
self.api.microversion = '2.71'
|
||||
ex = self.assertRaises(
|
||||
client.OpenStackApiException, self._create_server,
|
||||
flavor=self.flavor,
|
||||
@ -6177,8 +6180,9 @@ class PortResourceRequestBasedSchedulingTest(
|
||||
self.assertEqual(400, ex.response.status_code)
|
||||
self.assertIn(
|
||||
"Creating servers with ports having resource requests, like a "
|
||||
"port with a QoS minimum bandwidth policy, is not supported with "
|
||||
"this microversion", six.text_type(ex))
|
||||
"port with a QoS minimum bandwidth policy, is not supported "
|
||||
"until microversion 2.72.",
|
||||
six.text_type(ex))
|
||||
|
||||
def test_resize_server_with_port_resource_request_old_microversion(self):
|
||||
server = self._create_server(
|
||||
@ -6332,32 +6336,12 @@ class PortResourceRequestBasedSchedulingTest(
|
||||
self._wait_for_state_change(self.admin_api, server, 'ACTIVE')
|
||||
|
||||
|
||||
class PortResourceRequestBasedSchedulingTestIgnoreMicroversionCheck(
|
||||
class PortResourceRequestBasedSchedulingTest(
|
||||
PortResourceRequestBasedSchedulingTestBase):
|
||||
"""Tests creating a server with a pre-existing port that has a resource
|
||||
request for a QoS minimum bandwidth policy. Stubs out the
|
||||
supports_port_resource_request control method in the API in order to
|
||||
test the functionality between the API and scheduler before the
|
||||
microversion is added.
|
||||
request for a QoS minimum bandwidth policy.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(
|
||||
PortResourceRequestBasedSchedulingTestIgnoreMicroversionCheck,
|
||||
self).setUp()
|
||||
|
||||
# NOTE(gibi): This mock turns off the api microversion that prevents
|
||||
# handling of instances operations if the request involves ports with
|
||||
# resource request with old microversion. The new microversion does not
|
||||
# exists yet as the whole feature is not read for end user consumption.
|
||||
# This functional tests however would like to prove that some use cases
|
||||
# already work.
|
||||
self.useFixture(
|
||||
fixtures.MockPatch(
|
||||
'nova.api.openstack.common.'
|
||||
'supports_port_resource_request',
|
||||
return_value=True))
|
||||
|
||||
def test_boot_server_with_two_ports_one_having_resource_request(self):
|
||||
non_qos_port = self.neutron.port_1
|
||||
qos_port = self.neutron.port_with_resource_request
|
||||
@ -6613,9 +6597,9 @@ class PortResourceRequestBasedSchedulingTestIgnoreMicroversionCheck(
|
||||
server['fault']['message'])
|
||||
|
||||
|
||||
class PortResourceRequestReSchedulingTestIgnoreMicroversionCheck(
|
||||
class PortResourceRequestReSchedulingTest(
|
||||
PortResourceRequestBasedSchedulingTestBase):
|
||||
"""Similar to PortResourceRequestBasedSchedulingTestIgnoreMicroversionCheck
|
||||
"""Similar to PortResourceRequestBasedSchedulingTest
|
||||
except this test uses FakeRescheduleDriver which will test reschedules
|
||||
during server create work as expected, i.e. that the resource request
|
||||
allocations are moved from the initially selected compute to the
|
||||
@ -6625,25 +6609,11 @@ class PortResourceRequestReSchedulingTestIgnoreMicroversionCheck(
|
||||
compute_driver = 'fake.FakeRescheduleDriver'
|
||||
|
||||
def setUp(self):
|
||||
super(
|
||||
PortResourceRequestReSchedulingTestIgnoreMicroversionCheck,
|
||||
self).setUp()
|
||||
super(PortResourceRequestReSchedulingTest, self).setUp()
|
||||
self.compute2 = self._start_compute('host2')
|
||||
self.compute2_rp_uuid = self._get_provider_uuid_by_host('host2')
|
||||
self._create_networking_rp_tree(self.compute2_rp_uuid)
|
||||
|
||||
# NOTE(gibi): This mock turns off the api microversion that prevents
|
||||
# handling of instances operations if the request involves ports with
|
||||
# resource request with old microversion. The new microversion does not
|
||||
# exists yet as the whole feature is not read for end user consumption.
|
||||
# This functional tests however would like to prove that some use cases
|
||||
# already work.
|
||||
self.useFixture(
|
||||
fixtures.MockPatch(
|
||||
'nova.api.openstack.common.'
|
||||
'supports_port_resource_request',
|
||||
return_value=True))
|
||||
|
||||
def _create_networking_rp_tree(self, compute_rp_uuid):
|
||||
# let's simulate what the neutron would do
|
||||
self._create_ovs_networking_rp_tree(compute_rp_uuid)
|
||||
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
API microversion 2.72 adds support for creating servers with neutron ports
|
||||
that has resource request, e.g. neutron ports with
|
||||
`QoS minimum bandwidth rule`_. Deleting servers with such ports have
|
||||
already been handled properly as well as detaching these type of ports.
|
||||
|
||||
API limitations:
|
||||
|
||||
* Creating servers with Neutron networks having QoS minimum bandwidth rule
|
||||
is not supported.
|
||||
|
||||
* Attaching Neutron ports and networks having QoS minimum bandwidth rule
|
||||
is not supported.
|
||||
|
||||
* Moving (resizing, migrating, live-migrating, evacuating,
|
||||
unshelving after shelve offload) servers with ports having resource
|
||||
request is not yet supported.
|
||||
|
||||
.. _QoS minimum bandwidth rule: https://docs.openstack.org/neutron/latest/admin/config-qos.html
|
||||
|
Loading…
Reference in New Issue
Block a user