conf: Remove deprecated 'project_id_regex' opt

The 'project_id_regex' opt is used as a workaround for the test
like 'fake' 'openstack' etc, it's deprecated since 13.0.0
so time to remove it.

Co-Authored-By: jichenjc <jichenjc@cn.ibm.com>
Change-Id: I3eac9ac0a2a698a3c72b4e646cdcaf293ec4b057
This commit is contained in:
Takashi NATSUME 2019-09-27 15:40:49 +09:00
parent 2ec3b73f35
commit 088f237e59
28 changed files with 597 additions and 520 deletions

View File

@ -166,11 +166,7 @@ class ProjectMapper(APIMapper):
# NOTE(sdague): project_id parameter is only valid if its hex
# or hex + dashes (note, integers are a subset of this). This
# is required to hand our overlaping routes issues.
project_id_regex = '[0-9a-f-]+'
if CONF.osapi_v21.project_id_regex:
project_id_regex = CONF.osapi_v21.project_id_regex
return '{project_id:%s}' % project_id_regex
return '{project_id:[0-9a-f-]+}'
def resource(self, member_name, collection_name, **kwargs):
project_id_token = self._get_project_id_token()

View File

@ -45,7 +45,6 @@ from nova.conf import network
from nova.conf import neutron
from nova.conf import notifications
from nova.conf import novnc
from nova.conf import osapi_v21
from nova.conf import paths
from nova.conf import pci
from nova.conf import placement
@ -98,7 +97,6 @@ network.register_opts(CONF)
neutron.register_opts(CONF)
notifications.register_opts(CONF)
novnc.register_opts(CONF)
osapi_v21.register_opts(CONF)
paths.register_opts(CONF)
pci.register_opts(CONF)
placement.register_opts(CONF)

View File

@ -1,47 +0,0 @@
# Copyright 2015 OpenStack Foundation
# All Rights Reserved.
#
# 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 oslo_config import cfg
api_opts_group = cfg.OptGroup(name="osapi_v21", title="API v2.1 Options")
api_opts = [
cfg.StrOpt("project_id_regex",
deprecated_for_removal=True,
deprecated_since="13.0.0",
deprecated_reason="""
Recent versions of nova constrain project IDs to hexadecimal characters and
dashes. If your installation uses IDs outside of this range, you should use
this option to provide your own regex and give you time to migrate offending
projects to valid IDs before the next release.""",
help="""
This option is a string representing a regular expression (regex) that matches
the project_id as contained in URLs. If not set, it will match normal UUIDs
created by keystone.
Possible values:
* A string representing any legal regular expression
"""),
]
def register_opts(conf):
conf.register_group(api_opts_group)
conf.register_opts(api_opts, api_opts_group)
def list_opts():
return {api_opts_group: api_opts}

View File

@ -40,7 +40,7 @@ class AccessIPsAPIValidationTestV21(test.TestCase):
fake.stub_out_image_service(self)
self.stub_out('nova.compute.api.API.get',
# This project_id matches fakes.HTTPRequest.blank.
fakes.fake_compute_get(project_id='fake'))
fakes.fake_compute_get(project_id=fakes.FAKE_PROJECT_ID))
self.stub_out('nova.objects.instance.Instance.save', fake_save)
self.stub_out('nova.compute.api.API.rebuild', fake_rebuild)

View File

@ -37,6 +37,7 @@ API_DISK_CONFIG = 'OS-DCF:diskConfig'
class DiskConfigTestCaseV21(test.TestCase):
project_id = fakes.FAKE_PROJECT_ID
def setUp(self):
super(DiskConfigTestCaseV21, self).setUp()
@ -46,7 +47,7 @@ class DiskConfigTestCaseV21(test.TestCase):
self._setup_fake_image_service()
ctxt = nova_context.RequestContext(
# These values match what is used in fakes.HTTPRequest.blank.
user_id='fake_user', project_id='fake')
user_id='fake_user', project_id=self.project_id)
FAKE_INSTANCES = [
fakes.stub_instance_obj(ctxt,
uuid=MANUAL_INSTANCE_UUID,
@ -132,19 +133,19 @@ class DiskConfigTestCaseV21(test.TestCase):
def test_show_server(self):
req = fakes.HTTPRequest.blank(
'/fake/servers/%s' % MANUAL_INSTANCE_UUID)
'/%s/servers/%s' % (self.project_id, MANUAL_INSTANCE_UUID))
res = req.get_response(self.app)
server_dict = jsonutils.loads(res.body)['server']
self.assertDiskConfig(server_dict, 'MANUAL')
req = fakes.HTTPRequest.blank(
'/fake/servers/%s' % AUTO_INSTANCE_UUID)
'/%s/servers/%s' % (self.project_id, AUTO_INSTANCE_UUID))
res = req.get_response(self.app)
server_dict = jsonutils.loads(res.body)['server']
self.assertDiskConfig(server_dict, 'AUTO')
def test_detail_servers(self):
req = fakes.HTTPRequest.blank('/fake/servers/detail')
req = fakes.HTTPRequest.blank('/%s/servers/detail' % self.project_id)
res = req.get_response(self.app)
server_dicts = jsonutils.loads(res.body)['servers']
@ -156,19 +157,21 @@ class DiskConfigTestCaseV21(test.TestCase):
self.flags(group='glance', api_servers=['http://localhost:9292'])
req = fakes.HTTPRequest.blank(
'/fake/images/a440c04b-79fa-479c-bed1-0b816eaec379')
'/%s/images/a440c04b-79fa-479c-bed1-0b816eaec379' %
self.project_id)
res = req.get_response(self.app)
image_dict = jsonutils.loads(res.body)['image']
self.assertDiskConfig(image_dict, 'MANUAL')
req = fakes.HTTPRequest.blank(
'/fake/images/70a599e0-31e7-49b7-b260-868f441e862b')
'/%s/images/70a599e0-31e7-49b7-b260-868f441e862b' %
self.project_id)
res = req.get_response(self.app)
image_dict = jsonutils.loads(res.body)['image']
self.assertDiskConfig(image_dict, 'AUTO')
def test_detail_image(self):
req = fakes.HTTPRequest.blank('/fake/images/detail')
req = fakes.HTTPRequest.blank('/%s/images/detail' % self.project_id)
res = req.get_response(self.app)
image_dicts = jsonutils.loads(res.body)['images']
@ -180,7 +183,7 @@ class DiskConfigTestCaseV21(test.TestCase):
self.assertDiskConfig(image_dict, expected)
def test_create_server_override_auto(self):
req = fakes.HTTPRequest.blank('/fake/servers')
req = fakes.HTTPRequest.blank('/%s/servers' % self.project_id)
req.method = 'POST'
req.content_type = 'application/json'
body = {'server': {
@ -196,7 +199,7 @@ class DiskConfigTestCaseV21(test.TestCase):
self.assertDiskConfig(server_dict, 'AUTO')
def test_create_server_override_manual(self):
req = fakes.HTTPRequest.blank('/fake/servers')
req = fakes.HTTPRequest.blank('/%s/servers' % self.project_id)
req.method = 'POST'
req.content_type = 'application/json'
body = {'server': {
@ -215,7 +218,7 @@ class DiskConfigTestCaseV21(test.TestCase):
"""If user doesn't pass in diskConfig for server, use image metadata
to specify AUTO or MANUAL.
"""
req = fakes.HTTPRequest.blank('/fake/servers')
req = fakes.HTTPRequest.blank('/%s/servers' % self.project_id)
req.method = 'POST'
req.content_type = 'application/json'
body = {'server': {
@ -229,7 +232,7 @@ class DiskConfigTestCaseV21(test.TestCase):
server_dict = jsonutils.loads(res.body)['server']
self.assertDiskConfig(server_dict, 'MANUAL')
req = fakes.HTTPRequest.blank('/fake/servers')
req = fakes.HTTPRequest.blank('/%s/servers' % self.project_id)
req.method = 'POST'
req.content_type = 'application/json'
body = {'server': {
@ -244,7 +247,7 @@ class DiskConfigTestCaseV21(test.TestCase):
self.assertDiskConfig(server_dict, 'AUTO')
def test_create_server_detect_from_image_disabled_goes_to_manual(self):
req = fakes.HTTPRequest.blank('/fake/servers')
req = fakes.HTTPRequest.blank('/%s/servers' % self.project_id)
req.method = 'POST'
req.content_type = 'application/json'
body = {'server': {
@ -259,7 +262,7 @@ class DiskConfigTestCaseV21(test.TestCase):
self.assertDiskConfig(server_dict, 'MANUAL')
def test_create_server_errors_when_disabled_and_auto(self):
req = fakes.HTTPRequest.blank('/fake/servers')
req = fakes.HTTPRequest.blank('/%s/servers' % self.project_id)
req.method = 'POST'
req.content_type = 'application/json'
body = {'server': {
@ -274,7 +277,7 @@ class DiskConfigTestCaseV21(test.TestCase):
self.assertEqual(res.status_int, 400)
def test_create_server_when_disabled_and_manual(self):
req = fakes.HTTPRequest.blank('/fake/servers')
req = fakes.HTTPRequest.blank('/%s/servers' % self.project_id)
req.method = 'POST'
req.content_type = 'application/json'
body = {'server': {
@ -293,7 +296,7 @@ class DiskConfigTestCaseV21(test.TestCase):
def _test_update_server_disk_config(self, uuid, disk_config,
get_instance_mock):
req = fakes.HTTPRequest.blank(
'/fake/servers/%s' % uuid)
'/%s/servers/%s' % (self.project_id, uuid))
req.method = 'PUT'
req.content_type = 'application/json'
body = {'server': {API_DISK_CONFIG: disk_config}}
@ -318,7 +321,7 @@ class DiskConfigTestCaseV21(test.TestCase):
def test_update_server_invalid_disk_config(self):
# Return BadRequest if user passes an invalid diskConfig value.
req = fakes.HTTPRequest.blank(
'/fake/servers/%s' % MANUAL_INSTANCE_UUID)
'/%s/servers/%s' % (self.project_id, MANUAL_INSTANCE_UUID))
req.method = 'PUT'
req.content_type = 'application/json'
body = {'server': {API_DISK_CONFIG: 'server_test'}}
@ -335,7 +338,7 @@ class DiskConfigTestCaseV21(test.TestCase):
def _test_rebuild_server_disk_config(self, uuid, disk_config,
get_instance_mock):
req = fakes.HTTPRequest.blank(
'/fake/servers/%s/action' % uuid)
'/%s/servers/%s/action' % (self.project_id, uuid))
req.method = 'POST'
req.content_type = 'application/json'
auto_disk_config = (disk_config == 'AUTO')
@ -361,7 +364,7 @@ class DiskConfigTestCaseV21(test.TestCase):
self._test_rebuild_server_disk_config(MANUAL_INSTANCE_UUID, 'MANUAL')
def test_create_server_with_auto_disk_config(self):
req = fakes.HTTPRequest.blank('/fake/servers')
req = fakes.HTTPRequest.blank('/%s/servers' % self.project_id)
req.method = 'POST'
req.content_type = 'application/json'
body = {'server': {
@ -387,7 +390,7 @@ class DiskConfigTestCaseV21(test.TestCase):
@mock.patch('nova.api.openstack.common.get_instance')
def test_rebuild_server_with_auto_disk_config(self, get_instance_mock):
req = fakes.HTTPRequest.blank(
'/fake/servers/%s/action' % AUTO_INSTANCE_UUID)
'/%s/servers/%s/action' % (self.project_id, AUTO_INSTANCE_UUID))
req.method = 'POST'
req.content_type = 'application/json'
instance = fakes.stub_instance_obj(
@ -414,7 +417,7 @@ class DiskConfigTestCaseV21(test.TestCase):
def test_resize_server_with_auto_disk_config(self):
req = fakes.HTTPRequest.blank(
'/fake/servers/%s/action' % AUTO_INSTANCE_UUID)
'/%s/servers/%s/action' % (self.project_id, AUTO_INSTANCE_UUID))
req.method = 'POST'
req.content_type = 'application/json'
body = {"resize": {

View File

@ -133,14 +133,14 @@ class ExtendedIpsTestV21(test.TestCase):
self.assertJsonEqual(ALL_IPS, results)
def test_show(self):
url = '/v2/fake/servers/%s' % UUID3
url = '/v2/%s/servers/%s' % (fakes.FAKE_PROJECT_ID, UUID3)
res = self._make_request(url)
self.assertEqual(res.status_int, 200)
self.assertServerStates(self._get_server(res.body))
def test_detail(self):
url = '/v2/fake/servers/detail'
url = '/v2/%s/servers/detail' % fakes.FAKE_PROJECT_ID
res = self._make_request(url)
self.assertEqual(res.status_int, 200)

View File

@ -138,14 +138,14 @@ class ExtendedIpsMacTestV21(test.TestCase):
self.assertJsonEqual(ALL_IPS, results)
def test_show(self):
url = '/v2/fake/servers/%s' % UUID3
url = '/v2/%s/servers/%s' % (fakes.FAKE_PROJECT_ID, UUID3)
res = self._make_request(url)
self.assertEqual(200, res.status_int)
self.assertServerStates(self._get_server(res.body))
def test_detail(self):
url = '/v2/fake/servers/detail'
url = '/v2/%s/servers/detail' % fakes.FAKE_PROJECT_ID
res = self._make_request(url)
self.assertEqual(200, res.status_int)

View File

@ -19,7 +19,7 @@ from nova.tests.unit.api.openstack import fakes
class FlavorDisabledTestV21(test.NoDBTestCase):
base_url = '/v2/fake/flavors'
base_url = '/v2/%s/flavors' % fakes.FAKE_PROJECT_ID
content_type = 'application/json'
prefix = "OS-FLV-DISABLED:"

View File

@ -61,7 +61,7 @@ def fake_create_without_swap(newflavor):
class FlavorManageTestV21(test.NoDBTestCase):
controller = flavormanage_v21.FlavorManageController()
validation_error = exception.ValidationError
base_url = '/v2/fake/flavors'
base_url = '/v2/%s/flavors' % fakes.FAKE_PROJECT_ID
microversion = '2.1'
def setUp(self):
@ -507,9 +507,8 @@ class FlavorManageTestV2_75(FlavorManageTestV2_61):
flavor = self._create_flavor_success_case(self.request_body,
version='2.74')['flavor']
mock_get.return_value = self.FLAVOR_WITH_NO_SWAP
req = fakes.HTTPRequest.blank(
'/fake/flavors',
version='2.74')
req = fakes.HTTPRequest.blank('/%s/flavors' % fakes.FAKE_PROJECT_ID,
version='2.74')
req.method = 'PUT'
response = self.controller._update(
req, flavor['id'],
@ -530,9 +529,8 @@ class FlavorManageTestV2_75(FlavorManageTestV2_61):
del self.request_body['flavor']['swap']
mock_get.return_value = self.FLAVOR_WITH_NO_SWAP
flavor = self._create_flavor_success_case(self.request_body)['flavor']
req = fakes.HTTPRequest.blank(
'/fake/flavors',
version=self.microversion)
req = fakes.HTTPRequest.blank('/%s/flavors' % fakes.FAKE_PROJECT_ID,
version=self.microversion)
response = self.controller._update(
req, flavor['id'],
body={'flavor': {'description': None}})['flavor']
@ -541,7 +539,7 @@ class FlavorManageTestV2_75(FlavorManageTestV2_61):
class PrivateFlavorManageTestV21(test.TestCase):
controller = flavormanage_v21.FlavorManageController()
base_url = '/v2/fake/flavors'
base_url = '/v2/%s/flavors' % fakes.FAKE_PROJECT_ID
def setUp(self):
super(PrivateFlavorManageTestV21, self).setUp()

View File

@ -20,7 +20,7 @@ from nova.tests.unit.api.openstack import fakes
class FlavorExtraDataTestV21(test.NoDBTestCase):
base_url = '/v2/fake/flavors'
base_url = '/v2/%s/flavors' % fakes.FAKE_PROJECT_ID
def setUp(self):
super(FlavorExtraDataTestV21, self).setUp()

View File

@ -44,11 +44,11 @@ def return_flavor_not_found(context, flavor_id, read_deleted=None):
class FlavorsTestV21(test.TestCase):
_prefix = "/v2/fake"
_prefix = "/v2/%s" % fakes.FAKE_PROJECT_ID
Controller = flavors_v21.FlavorsController
fake_request = fakes.HTTPRequestV21
_rspv = "v2/fake"
_fake = "/fake"
_rspv = "v2/%s" % fakes.FAKE_PROJECT_ID
_fake = "/%s" % fakes.FAKE_PROJECT_ID
microversion = '2.1'
# Flag to tell the test if a description should be expected in a response.
expect_description = False
@ -338,11 +338,13 @@ class FlavorsTestV21(test.TestCase):
"links": [
{
"rel": "self",
"href": "http://localhost/v2/fake/flavors/1",
"href": ("http://localhost/v2/%s/flavors/1" %
fakes.FAKE_PROJECT_ID),
},
{
"rel": "bookmark",
"href": "http://localhost/fake/flavors/1",
"href": ("http://localhost/%s/flavors/1" %
fakes.FAKE_PROJECT_ID),
}
]
}
@ -354,7 +356,8 @@ class FlavorsTestV21(test.TestCase):
self.assertEqual(response_list, expected_flavors)
self.assertEqual(response_links[0]['rel'], 'next')
href_parts = urlparse.urlparse(response_links[0]['href'])
self.assertEqual('/v2/fake/flavors', href_parts.path)
self.assertEqual('/v2/%s/flavors' % fakes.FAKE_PROJECT_ID,
href_parts.path)
params = urlparse.parse_qs(href_parts.query)
self.assertThat({'limit': ['2'], 'marker': ['1']},
matchers.DictMatches(params))
@ -813,10 +816,11 @@ class FlavorsTestV2_75(FlavorsTestV2_61):
def test_list_flavors_with_additional_filter_old_version(self):
req = self.fake_request.blank(
'/fake/flavors?limit=1&marker=1&additional=something',
version='2.74')
'/%s/flavors?limit=1&marker=1&additional=something' %
fakes.FAKE_PROJECT_ID, version='2.74')
self._test_list_flavors_with_allowed_filter(
'/fake/flavors?limit=1&marker=1&additional=something', req=req)
'/%s/flavors?limit=1&marker=1&additional=something' %
fakes.FAKE_PROJECT_ID, req=req)
def test_list_detail_flavors_with_additional_filter_old_version(self):
expected = {
@ -830,11 +834,11 @@ class FlavorsTestV2_75(FlavorsTestV2_61):
"swap": fakes.FLAVORS['2'].swap
}
req = self.fake_request.blank(
'/fake/flavors?limit=1&marker=1&additional=something',
version='2.74')
'/%s/flavors?limit=1&marker=1&additional=something' %
fakes.FAKE_PROJECT_ID, version='2.74')
self._test_list_flavors_with_allowed_filter(
'/fake/flavors/detail?limit=1&marker=1&additional=something',
expected, req=req)
'/%s/flavors/detail?limit=1&marker=1&additional=something' %
fakes.FAKE_PROJECT_ID, expected, req=req)
def _test_list_flavors_with_additional_filter(self, url):
controller_list = self.controller.index
@ -857,7 +861,7 @@ class FlavorsTestV2_75(FlavorsTestV2_61):
mock_get.return_value = objects.FlavorList(
objects=[self.FLAVOR_WITH_NO_SWAP])
req = self.fake_request.blank(
'/fake/flavors/detail?limit=1',
'/%s/flavors/detail?limit=1' % fakes.FAKE_PROJECT_ID,
version='2.74')
response = self.controller.detail(req)
response_list = response["flavors"]
@ -867,7 +871,7 @@ class FlavorsTestV2_75(FlavorsTestV2_61):
def test_show_flavor_default_swap_value_old_version(self, mock_get):
mock_get.return_value = self.FLAVOR_WITH_NO_SWAP
req = self.fake_request.blank(
'/fake/flavors/detail?limit=1',
'/%s/flavors/detail?limit=1' % fakes.FAKE_PROJECT_ID,
version='2.74')
response = self.controller.show(req, 1)
response_list = response["flavor"]
@ -878,7 +882,7 @@ class FlavorsTestV2_75(FlavorsTestV2_61):
mock_get.return_value = objects.FlavorList(
objects=[self.FLAVOR_WITH_NO_SWAP])
req = self.fake_request.blank(
'/fake/flavors/detail?limit=1',
'/%s/flavors/detail?limit=1' % fakes.FAKE_PROJECT_ID,
version=self.microversion)
response = self.controller.detail(req)
response_list = response["flavors"]
@ -888,7 +892,7 @@ class FlavorsTestV2_75(FlavorsTestV2_61):
def test_show_flavor_default_swap_value(self, mock_get):
mock_get.return_value = self.FLAVOR_WITH_NO_SWAP
req = self.fake_request.blank(
'/fake/flavors/detail?limit=1',
'/%s/flavors/detail?limit=1' % fakes.FAKE_PROJECT_ID,
version=self.microversion)
response = self.controller.show(req, 1)
response_list = response["flavor"]

View File

@ -43,8 +43,8 @@ class ImagesControllerTestV21(test.NoDBTestCase):
"""Test of the OpenStack API /images application controller w/Glance.
"""
image_controller_class = images_v21.ImagesController
url_base = '/v2/fake'
bookmark_base = '/fake'
url_base = '/v2/%s' % fakes.FAKE_PROJECT_ID
bookmark_base = '/%s' % fakes.FAKE_PROJECT_ID
http_request = fakes.HTTPRequestV21
def setUp(self):

View File

@ -64,7 +64,7 @@ def db_key_pair_create_duplicate(context):
class KeypairsTestV21(test.TestCase):
base_url = '/v2/fake'
base_url = '/v2/%s' % fakes.FAKE_PROJECT_ID
validation_error = exception.ValidationError
wsgi_api_version = os_wsgi.DEFAULT_API_VERSION
@ -545,7 +545,7 @@ class KeypairsTestV210(KeypairsTestV22):
class KeypairsTestV235(test.TestCase):
base_url = '/v2/fake'
base_url = '/v2/%s' % fakes.FAKE_PROJECT_ID
wsgi_api_version = '2.35'
def _setup_app_and_controller(self):

View File

@ -49,14 +49,17 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
return headers
def test_microversions_no_header(self):
req = fakes.HTTPRequest.blank('/v2/fake/microversions', method='GET')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions' % fakes.FAKE_PROJECT_ID,
method='GET')
res = req.get_response(self.app)
self.assertEqual(200, res.status_int)
resp_json = jsonutils.loads(res.body)
self.assertEqual('val', resp_json['param'])
def test_microversions_return_header(self):
req = fakes.HTTPRequest.blank('/v2/fake/microversions')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions' % fakes.FAKE_PROJECT_ID)
res = req.get_response(self.app)
self.assertEqual(200, res.status_int)
resp_json = jsonutils.loads(res.body)
@ -72,7 +75,8 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
mock_maxver):
mock_maxver.return_value = api_version.APIVersionRequest("2.3")
req = fakes.HTTPRequest.blank('/v2/fake/microversions')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions' % fakes.FAKE_PROJECT_ID)
req.headers = self._make_header('2.3')
res = req.get_response(self.app)
self.assertEqual(200, res.status_int)
@ -88,7 +92,8 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
def test_microversions_return_header_fault(self, mock_maxver):
mock_maxver.return_value = api_version.APIVersionRequest("3.0")
req = fakes.HTTPRequest.blank('/v2/fake/microversions')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions' % fakes.FAKE_PROJECT_ID)
req.headers = self._make_header('3.0')
res = req.get_response(self.app)
self.assertEqual(400, res.status_int)
@ -111,22 +116,26 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
self.assertEqual(resp_param, resp_json['param'])
def test_microversions_with_header(self):
self._check_microversion_response('/v2/fake/microversions',
'2.3', 'val2')
self._check_microversion_response(
'/v2/%s/microversions' % fakes.FAKE_PROJECT_ID,
'2.3', 'val2')
def test_microversions_with_header_exact_match(self):
self._check_microversion_response('/v2/fake/microversions',
'2.2', 'val2')
self._check_microversion_response(
'/v2/%s/microversions' % fakes.FAKE_PROJECT_ID,
'2.2', 'val2')
def test_microversions2_no_2_1_version(self):
self._check_microversion_response('/v2/fake/microversions2',
'2.3', 'controller2_val1')
self._check_microversion_response(
'/v2/%s/microversions2' % fakes.FAKE_PROJECT_ID,
'2.3', 'controller2_val1')
@mock.patch("nova.api.openstack.api_version_request.max_api_version")
def test_microversions2_later_version(self, mock_maxver):
mock_maxver.return_value = api_version.APIVersionRequest("3.1")
req = fakes.HTTPRequest.blank('/v2/fake/microversions2')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions2' % fakes.FAKE_PROJECT_ID)
req.headers = self._make_header('3.0')
res = req.get_response(self.app)
self.assertEqual(202, res.status_int)
@ -137,13 +146,15 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
def test_microversions2_version_too_high(self, mock_maxver):
mock_maxver.return_value = api_version.APIVersionRequest("3.5")
req = fakes.HTTPRequest.blank('/v2/fake/microversions2')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions2' % fakes.FAKE_PROJECT_ID)
req.headers = {self.header_name: '3.2'}
res = req.get_response(self.app)
self.assertEqual(404, res.status_int)
def test_microversions2_version_too_low(self):
req = fakes.HTTPRequest.blank('/v2/fake/microversions2')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions2' % fakes.FAKE_PROJECT_ID)
req.headers = {self.header_name: '2.1'}
res = req.get_response(self.app)
self.assertEqual(404, res.status_int)
@ -153,7 +164,8 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
mock_maxver):
mock_maxver.return_value = api_version.APIVersionRequest("3.5")
req = fakes.HTTPRequest.blank('/v2/fake/microversions2')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions2' % fakes.FAKE_PROJECT_ID)
req.headers = self._make_header('3.7')
res = req.get_response(self.app)
self.assertEqual(406, res.status_int)
@ -166,7 +178,8 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
def test_microversions_schema(self, mock_maxver):
mock_maxver.return_value = api_version.APIVersionRequest("3.3")
req = fakes.HTTPRequest.blank('/v2/fake/microversions3')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions3' % fakes.FAKE_PROJECT_ID)
req.method = 'POST'
req.headers = self._make_header('2.2')
req.environ['CONTENT_TYPE'] = "application/json"
@ -186,7 +199,8 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
def test_microversions_schema_fail(self, mock_maxver):
mock_maxver.return_value = api_version.APIVersionRequest("3.3")
req = fakes.HTTPRequest.blank('/v2/fake/microversions3')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions3' % fakes.FAKE_PROJECT_ID)
req.method = 'POST'
req.headers = {self.header_name: '2.2'}
req.environ['CONTENT_TYPE'] = "application/json"
@ -203,7 +217,8 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
mock_maxver):
mock_maxver.return_value = api_version.APIVersionRequest("3.3")
req = fakes.HTTPRequest.blank('/v2/fake/microversions3/1')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions3/1' % fakes.FAKE_PROJECT_ID)
req.method = 'PUT'
req.headers = self._make_header('2.2')
req.body = jsonutils.dump_as_bytes({'dummy': {'inv_val': 'foo'}})
@ -223,7 +238,8 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
mock_maxver):
mock_maxver.return_value = api_version.APIVersionRequest("3.3")
req = fakes.HTTPRequest.blank('/v2/fake/microversions3/1')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions3/1' % fakes.FAKE_PROJECT_ID)
req.headers = self._make_header('2.10')
req.environ['CONTENT_TYPE'] = "application/json"
req.method = 'PUT'
@ -242,7 +258,8 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
def _test_microversions_inner_function(self, version, expected_resp,
mock_maxver):
mock_maxver.return_value = api_version.APIVersionRequest("2.2")
req = fakes.HTTPRequest.blank('/v2/fake/microversions4')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions4' % fakes.FAKE_PROJECT_ID)
req.headers = self._make_header(version)
req.environ['CONTENT_TYPE'] = "application/json"
req.method = 'POST'
@ -267,7 +284,8 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
mock_maxver):
mock_maxver.return_value = api_version.APIVersionRequest("2.3")
req = fakes.HTTPRequest.blank('/v2/fake/microversions3/1/action')
req = fakes.HTTPRequest.blank(
'/v2/%s/microversions3/1/action' % fakes.FAKE_PROJECT_ID)
if req_header:
req.headers = self._make_header(req_header)
req.method = 'POST'

View File

@ -143,12 +143,14 @@ class TestNeutronSecurityGroupsV21(
def test_get_security_group_list(self):
self._create_sg_template().get('security_group')
req = fakes.HTTPRequest.blank('/v2/fake/os-security-groups')
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-groups' % fakes.FAKE_PROJECT_ID)
list_dict = self.controller.index(req)
self.assertEqual(len(list_dict['security_groups']), 2)
def test_get_security_group_list_offset_and_limit(self):
path = '/v2/fake/os-security-groups?offset=1&limit=1'
path = ('/v2/%s/os-security-groups?offset=1&limit=1' %
fakes.FAKE_PROJECT_ID)
self._create_sg_template().get('security_group')
req = fakes.HTTPRequest.blank(path)
list_dict = self.controller.index(req)
@ -165,30 +167,34 @@ class TestNeutronSecurityGroupsV21(
device_id=test_security_groups.UUID_SERVER)
expected = [{'rules': [], 'tenant_id': 'fake', 'id': sg['id'],
'name': 'test', 'description': 'test-description'}]
req = fakes.HTTPRequest.blank('/v2/fake/servers/%s/os-security-groups'
% test_security_groups.UUID_SERVER)
req = fakes.HTTPRequest.blank(
'/v2/%s/servers/%s/os-security-groups'
% (fakes.FAKE_PROJECT_ID, test_security_groups.UUID_SERVER))
res_dict = self.server_controller.index(
req, test_security_groups.UUID_SERVER)['security_groups']
self.assertEqual(expected, res_dict)
def test_get_security_group_by_id(self):
sg = self._create_sg_template().get('security_group')
req = fakes.HTTPRequest.blank('/v2/fake/os-security-groups/%s'
% sg['id'])
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-groups/%s'
% (fakes.FAKE_PROJECT_ID, sg['id']))
res_dict = self.controller.show(req, sg['id'])
expected = {'security_group': sg}
self.assertEqual(res_dict, expected)
def test_delete_security_group_by_id(self):
sg = self._create_sg_template().get('security_group')
req = fakes.HTTPRequest.blank('/v2/fake/os-security-groups/%s' %
sg['id'])
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-groups/%s' %
(fakes.FAKE_PROJECT_ID, sg['id']))
self.controller.delete(req, sg['id'])
def test_delete_security_group_by_admin(self):
sg = self._create_sg_template().get('security_group')
req = fakes.HTTPRequest.blank('/v2/fake/os-security-groups/%s' %
sg['id'], use_admin_context=True)
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-groups/%s' %
(fakes.FAKE_PROJECT_ID, sg['id']), use_admin_context=True)
self.controller.delete(req, sg['id'])
@mock.patch('nova.compute.utils.refresh_info_cache_for_instance')
@ -206,8 +212,9 @@ class TestNeutronSecurityGroupsV21(
neutron.allocate_for_instance(_context, instance, False, None,
security_groups=[sg['id']])
req = fakes.HTTPRequest.blank('/v2/fake/os-security-groups/%s'
% sg['id'])
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-groups/%s'
% (fakes.FAKE_PROJECT_ID, sg['id']))
self.assertRaises(webob.exc.HTTPBadRequest, self.controller.delete,
req, sg['id'])
@ -232,8 +239,9 @@ class TestNeutronSecurityGroupsV21(
body = dict(addSecurityGroup=dict(name="test"))
req = fakes.HTTPRequest.blank('/v2/fake/servers/%s/action' %
UUID_SERVER)
req = fakes.HTTPRequest.blank(
'/v2/%s/servers/%s/action' %
(fakes.FAKE_PROJECT_ID, UUID_SERVER))
self.manager._addSecurityGroup(req, UUID_SERVER, body)
def test_associate_duplicate_names(self):
@ -248,8 +256,9 @@ class TestNeutronSecurityGroupsV21(
body = dict(addSecurityGroup=dict(name="sg1"))
req = fakes.HTTPRequest.blank('/v2/fake/servers/%s/action' %
UUID_SERVER)
req = fakes.HTTPRequest.blank(
'/v2/%s/servers/%s/action' %
(fakes.FAKE_PROJECT_ID, UUID_SERVER))
self.assertRaises(webob.exc.HTTPConflict,
self.manager._addSecurityGroup,
req, UUID_SERVER, body)
@ -264,8 +273,9 @@ class TestNeutronSecurityGroupsV21(
body = dict(addSecurityGroup=dict(name="test"))
req = fakes.HTTPRequest.blank('/v2/fake/servers/%s/action' %
UUID_SERVER)
req = fakes.HTTPRequest.blank(
'/v2/%s/servers/%s/action' %
(fakes.FAKE_PROJECT_ID, UUID_SERVER))
self.manager._addSecurityGroup(req, UUID_SERVER, body)
def test_associate_port_security_enabled_false(self):
@ -277,8 +287,9 @@ class TestNeutronSecurityGroupsV21(
body = dict(addSecurityGroup=dict(name="test"))
req = fakes.HTTPRequest.blank('/v2/fake/servers/%s/action' %
UUID_SERVER)
req = fakes.HTTPRequest.blank(
'/v2/%s/servers/%s/action' %
(fakes.FAKE_PROJECT_ID, UUID_SERVER))
self.assertRaises(webob.exc.HTTPBadRequest,
self.manager._addSecurityGroup,
req, UUID_SERVER, body)
@ -293,15 +304,17 @@ class TestNeutronSecurityGroupsV21(
body = dict(addSecurityGroup=dict(name="test"))
req = fakes.HTTPRequest.blank('/v2/fake/servers/%s/action' %
UUID_SERVER)
req = fakes.HTTPRequest.blank(
'/v2/%s/servers/%s/action' %
(fakes.FAKE_PROJECT_ID, UUID_SERVER))
self.manager._addSecurityGroup(req, UUID_SERVER, body)
def test_disassociate_by_non_existing_security_group_name(self):
body = dict(removeSecurityGroup=dict(name='non-existing'))
req = fakes.HTTPRequest.blank('/v2/fake/servers/%s/action' %
UUID_SERVER)
req = fakes.HTTPRequest.blank(
'/v2/%s/servers/%s/action' %
(fakes.FAKE_PROJECT_ID, UUID_SERVER))
self.assertRaises(webob.exc.HTTPNotFound,
self.manager._removeSecurityGroup,
req, UUID_SERVER, body)
@ -327,8 +340,9 @@ class TestNeutronSecurityGroupsV21(
body = dict(removeSecurityGroup=dict(name="test"))
req = fakes.HTTPRequest.blank('/v2/fake/servers/%s/action' %
UUID_SERVER)
req = fakes.HTTPRequest.blank(
'/v2/%s/servers/%s/action' %
(fakes.FAKE_PROJECT_ID, UUID_SERVER))
self.manager._removeSecurityGroup(req, UUID_SERVER, body)
def test_get_instances_security_groups_bindings(self):
@ -439,22 +453,26 @@ class _TestNeutronSecurityGroupRulesBase(object):
def test_create_add_existing_rules_by_cidr(self):
sg = test_security_groups.security_group_template()
req = fakes.HTTPRequest.blank('/v2/fake/os-security-groups')
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-groups' % fakes.FAKE_PROJECT_ID)
self.controller_sg.create(req, {'security_group': sg})
rule = test_security_groups.security_group_rule_template(
cidr='15.0.0.0/8', parent_group_id=self.sg2['id'])
req = fakes.HTTPRequest.blank('/v2/fake/os-security-group-rules')
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-group-rules' % fakes.FAKE_PROJECT_ID)
self.controller.create(req, {'security_group_rule': rule})
self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create,
req, {'security_group_rule': rule})
def test_create_add_existing_rules_by_group_id(self):
sg = test_security_groups.security_group_template()
req = fakes.HTTPRequest.blank('/v2/fake/os-security-groups')
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-groups' % fakes.FAKE_PROJECT_ID)
self.controller_sg.create(req, {'security_group': sg})
rule = test_security_groups.security_group_rule_template(
group=self.sg1['id'], parent_group_id=self.sg2['id'])
req = fakes.HTTPRequest.blank('/v2/fake/os-security-group-rules')
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-group-rules' % fakes.FAKE_PROJECT_ID)
self.controller.create(req, {'security_group_rule': rule})
self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create,
req, {'security_group_rule': rule})
@ -463,11 +481,12 @@ class _TestNeutronSecurityGroupRulesBase(object):
rule = test_security_groups.security_group_rule_template(
parent_group_id=self.sg2['id'])
req = fakes.HTTPRequest.blank('/v2/fake/os-security-group-rules')
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-group-rules' % fakes.FAKE_PROJECT_ID)
res_dict = self.controller.create(req, {'security_group_rule': rule})
security_group_rule = res_dict['security_group_rule']
req = fakes.HTTPRequest.blank('/v2/fake/os-security-group-rules/%s'
% security_group_rule['id'])
req = fakes.HTTPRequest.blank('/v2/%s/os-security-group-rules/%s' % (
fakes.FAKE_PROJECT_ID, security_group_rule['id']))
self.controller.delete(req, security_group_rule['id'])
def test_create_rule_quota_limit(self):
@ -549,9 +568,10 @@ class TestNeutronSecurityGroupsOutputTest(TestNeutronSecurityGroupsTestCase):
return server.get('security_groups')
def test_create(self):
url = '/v2/fake/servers'
url = '/v2/%s/servers' % fakes.FAKE_PROJECT_ID
image_uuid = 'c905cedb-7281-47e4-8a62-f26bc5fc4c77'
req = fakes.HTTPRequest.blank('/v2/fake/os-security-groups')
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-groups' % fakes.FAKE_PROJECT_ID)
security_groups = [{'name': 'fake-2-0'}, {'name': 'fake-2-1'}]
for security_group in security_groups:
sg = test_security_groups.security_group_template(
@ -568,7 +588,7 @@ class TestNeutronSecurityGroupsOutputTest(TestNeutronSecurityGroupsTestCase):
self.assertEqual(group.get('name'), name)
def test_create_server_get_default_security_group(self):
url = '/v2/fake/servers'
url = '/v2/%s/servers' % fakes.FAKE_PROJECT_ID
image_uuid = 'c905cedb-7281-47e4-8a62-f26bc5fc4c77'
server = dict(name='server_test', imageRef=image_uuid, flavorRef=2)
res = self._make_request(url, {'server': server})
@ -583,9 +603,10 @@ class TestNeutronSecurityGroupsOutputTest(TestNeutronSecurityGroupsTestCase):
lambda self, inst, context, id:
[{'name': 'fake-2-0'}, {'name': 'fake-2-1'}])
url = '/v2/fake/servers'
url = '/v2/%s/servers' % fakes.FAKE_PROJECT_ID
image_uuid = 'c905cedb-7281-47e4-8a62-f26bc5fc4c77'
req = fakes.HTTPRequest.blank('/v2/fake/os-security-groups')
req = fakes.HTTPRequest.blank(
'/v2/%s/os-security-groups' % fakes.FAKE_PROJECT_ID)
security_groups = [{'name': 'fake-2-0'}, {'name': 'fake-2-1'}]
for security_group in security_groups:
sg = test_security_groups.security_group_template(
@ -602,7 +623,8 @@ class TestNeutronSecurityGroupsOutputTest(TestNeutronSecurityGroupsTestCase):
self.assertEqual(group.get('name'), name)
# Test that show (GET) returns the same information as create (POST)
url = '/v2/fake/servers/' + test_security_groups.UUID3
url = ('/v2/%s/servers/%s' % (fakes.FAKE_PROJECT_ID,
test_security_groups.UUID3))
res = self._make_request(url)
self.assertEqual(res.status_int, 200)
server = self._get_server(res.body)
@ -612,7 +634,7 @@ class TestNeutronSecurityGroupsOutputTest(TestNeutronSecurityGroupsTestCase):
self.assertEqual(group.get('name'), name)
def test_detail(self):
url = '/v2/fake/servers/detail'
url = '/v2/%s/servers/detail' % fakes.FAKE_PROJECT_ID
res = self._make_request(url)
self.assertEqual(res.status_int, 200)
@ -624,7 +646,8 @@ class TestNeutronSecurityGroupsOutputTest(TestNeutronSecurityGroupsTestCase):
@mock.patch('nova.compute.api.API.get',
side_effect=exception.InstanceNotFound(instance_id='fake'))
def test_no_instance_passthrough_404(self, mock_get):
url = '/v2/fake/servers/70f6db34-de8d-4fbd-aafb-4065bdfa6115'
url = ('/v2/%s/servers/70f6db34-de8d-4fbd-aafb-4065bdfa6115' %
fakes.FAKE_PROJECT_ID)
res = self._make_request(url)
self.assertEqual(res.status_int, 404)

View File

@ -311,7 +311,7 @@ class TestSecurityGroupsV21(test.TestCase):
self.stub_out('nova.db.api.security_group_get_by_project',
return_security_groups)
path = '/v2/fake/os-security-groups'
path = '/v2/%s/os-security-groups' % fakes.FAKE_PROJECT_ID
if limited:
path += '?offset=1&limit=1'
req = fakes.HTTPRequest.blank(path, use_admin_context=True)
@ -359,7 +359,8 @@ class TestSecurityGroupsV21(test.TestCase):
self.assertEqual(res_dict, expected)
mock_list.assert_called_once_with(self.req.environ['nova.context'],
project='fake', search_opts={})
project=fakes.FAKE_PROJECT_ID,
search_opts={})
def test_get_security_group_list_all_tenants(self):
all_groups = []
@ -389,7 +390,7 @@ class TestSecurityGroupsV21(test.TestCase):
self.stub_out('nova.db.api.security_group_get_by_project',
return_tenant_security_groups)
path = '/v2/fake/os-security-groups'
path = '/v2/%s/os-security-groups' % fakes.FAKE_PROJECT_ID
req = fakes.HTTPRequest.blank(path, use_admin_context=True)
res_dict = self.controller.index(req)
@ -1350,7 +1351,7 @@ def fake_compute_create(*args, **kwargs):
class SecurityGroupsOutputTestV21(test.TestCase):
base_url = '/v2/fake/servers'
base_url = '/v2/%s/servers' % fakes.FAKE_PROJECT_ID
content_type = 'application/json'
def setUp(self):

View File

@ -45,7 +45,7 @@ class ServerDiagnosticsTestV21(test.NoDBTestCase):
def _get_request(self):
return fakes.HTTPRequest.blank(
'/v2/fake/servers/%s/diagnostics' % UUID,
'/v2/%s/servers/%s/diagnostics' % (fakes.FAKE_PROJECT_ID, UUID),
version=self.api_version,
headers = {os_wsgi.API_VERSION_REQUEST_HEADER:
'compute %s' % self.api_version})

View File

@ -191,7 +191,8 @@ class ServerGroupTestV21(test.NoDBTestCase):
instance = objects.Instance(context=cctx,
image_ref=uuidsentinel.fake_image_ref,
node='node1', reservation_id='a',
host='host1', project_id='fake',
host='host1',
project_id=fakes.FAKE_PROJECT_ID,
vm_state='fake',
system_metadata={'key': 'value'})
instance.create()
@ -205,7 +206,7 @@ class ServerGroupTestV21(test.NoDBTestCase):
def _create_instance_group(self, context, members):
ig = objects.InstanceGroup(context=context, name='fake_name',
user_id='fake_user', project_id='fake',
user_id='fake_user', project_id=fakes.FAKE_PROJECT_ID,
members=members)
ig.create()
return ig.uuid
@ -373,7 +374,7 @@ class ServerGroupTestV21(test.NoDBTestCase):
self.assertEqual(expected, res_dict)
def test_display_members(self):
ctx = context.RequestContext('fake_user', 'fake')
ctx = context.RequestContext('fake_user', fakes.FAKE_PROJECT_ID)
(ig_uuid, instances, members) = self._create_groups_and_instances(ctx)
res_dict = self.controller.show(self.req, ig_uuid)
result_members = res_dict['server_group']['members']
@ -386,7 +387,7 @@ class ServerGroupTestV21(test.NoDBTestCase):
self.controller.show, self.req, uuidsentinel.group)
def test_display_active_members_only(self):
ctx = context.RequestContext('fake_user', 'fake')
ctx = context.RequestContext('fake_user', fakes.FAKE_PROJECT_ID)
(ig_uuid, instances, members) = self._create_groups_and_instances(ctx)
# delete an instance
@ -407,7 +408,7 @@ class ServerGroupTestV21(test.NoDBTestCase):
self.assertIn(instances[0].uuid, result_members)
def test_display_members_rbac_default(self):
ctx = context.RequestContext('fake_user', 'fake')
ctx = context.RequestContext('fake_user', fakes.FAKE_PROJECT_ID)
ig_uuid = self._create_groups_and_instances(ctx)[0]
# test as admin
@ -421,7 +422,7 @@ class ServerGroupTestV21(test.NoDBTestCase):
self.controller.show, self.foo_req, ig_uuid)
def test_display_members_rbac_admin_only(self):
ctx = context.RequestContext('fake_user', 'fake')
ctx = context.RequestContext('fake_user', fakes.FAKE_PROJECT_ID)
ig_uuid = self._create_groups_and_instances(ctx)[0]
# override policy to restrict to admin
@ -670,7 +671,7 @@ class ServerGroupTestV21(test.NoDBTestCase):
self.req, 'invalid')
def test_delete_server_group_rbac_default(self):
ctx = context.RequestContext('fake_user', 'fake')
ctx = context.RequestContext('fake_user', fakes.FAKE_PROJECT_ID)
# test as admin
ig_uuid = self._create_groups_and_instances(ctx)[0]

View File

@ -37,7 +37,8 @@ class ServerStartStopTestV21(test.TestCase):
self.req = fakes.HTTPRequest.blank('')
self.useFixture(nova_fixtures.SingleCellSimple())
self.stub_out('nova.db.api.instance_get_by_uuid',
fakes.fake_instance_get())
fakes.fake_instance_get(
project_id=fakes.FAKE_PROJECT_ID))
def _setup_controller(self):
self.controller = server_v21.ServersController()

View File

@ -71,7 +71,8 @@ class ServerTagsTest(test.TestCase):
def test_show(self, mock_exists):
mock_exists.return_value = True
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (UUID, TAG1), 'GET')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, UUID, TAG1), 'GET')
self.controller.show(req, UUID, TAG1)
mock_exists.assert_called_once_with(mock.ANY, UUID, TAG1)
@ -81,7 +82,8 @@ class ServerTagsTest(test.TestCase):
fake_tags = [self._get_tag(tag) for tag in TAGS]
mock_db_get_inst_tags.return_value = fake_tags
req = self._get_request('/v2/fake/servers/%s/tags' % UUID, 'GET')
req = self._get_request('/v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, UUID), 'GET')
res = self.controller.index(req, UUID)
self.assertEqual(TAGS, res.get('tags'))
@ -94,7 +96,7 @@ class ServerTagsTest(test.TestCase):
fake_tags = [self._get_tag(tag) for tag in TAGS]
mock_db_set_inst_tags.return_value = fake_tags
req = self._get_request(
'/v2/fake/servers/%s/tags' % UUID, 'PUT')
'/v2/%s/servers/%s/tags' % (fakes.FAKE_PROJECT_ID, UUID), 'PUT')
res = self.controller.update_all(req, UUID, body={'tags': TAGS})
self.assertEqual(TAGS, res['tags'])
@ -107,41 +109,46 @@ class ServerTagsTest(test.TestCase):
instance.MAX_TAG_COUNT + 1)]}
req = self._get_request(
'/v2/fake/servers/%s/tags' % UUID, 'PUT')
'/v2/%s/servers/%s/tags' % (fakes.FAKE_PROJECT_ID, UUID), 'PUT')
self.assertRaises(exception.ValidationError,
self.controller.update_all,
req, UUID, body=fake_tags)
def test_update_all_forbidden_characters(self):
self.stub_out('nova.api.openstack.common.get_instance', return_server)
req = self._get_request('/v2/fake/servers/%s/tags' % UUID, 'PUT')
req = self._get_request('/v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, UUID), 'PUT')
for tag in ['tag,1', 'tag/1']:
self.assertRaises(exception.ValidationError,
self.controller.update_all,
req, UUID, body={'tags': [tag, 'tag2']})
def test_update_all_invalid_tag_type(self):
req = self._get_request('/v2/fake/servers/%s/tags' % UUID, 'PUT')
req = self._get_request('/v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, UUID), 'PUT')
self.assertRaises(exception.ValidationError,
self.controller.update_all,
req, UUID, body={'tags': [1]})
def test_update_all_tags_with_one_tag_empty_string(self):
req = self._get_request('/v2/fake/servers/%s/tags' % UUID, 'PUT')
req = self._get_request('/v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, UUID), 'PUT')
self.assertRaises(exception.ValidationError,
self.controller.update_all,
req, UUID, body={'tags': ['tag1', '']})
def test_update_all_too_long_tag(self):
self.stub_out('nova.api.openstack.common.get_instance', return_server)
req = self._get_request('/v2/fake/servers/%s/tags' % UUID, 'PUT')
req = self._get_request('/v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, UUID), 'PUT')
tag = "a" * (tag_obj.MAX_TAG_LENGTH + 1)
self.assertRaises(exception.ValidationError,
self.controller.update_all,
req, UUID, body={'tags': [tag]})
def test_update_all_invalid_tag_list_type(self):
req = self._get_request('/v2/ake/servers/%s/tags' % UUID, 'PUT')
req = self._get_request('/v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, UUID), 'PUT')
self.assertRaises(exception.ValidationError,
self.controller.update_all,
req, UUID, body={'tags': {'tag': 'tag'}})
@ -149,7 +156,8 @@ class ServerTagsTest(test.TestCase):
def test_update_all_invalid_instance_state(self):
self.stub_out('nova.api.openstack.common.get_instance',
return_invalid_server)
req = self._get_request('/v2/fake/servers/%s/tags' % UUID, 'PUT')
req = self._get_request('/v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, UUID), 'PUT')
self.assertRaises(exc.HTTPConflict, self.controller.update_all,
req, UUID, body={'tags': TAGS})
@ -157,7 +165,8 @@ class ServerTagsTest(test.TestCase):
def test_show_non_existing_tag(self, mock_exists):
mock_exists.return_value = False
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (UUID, TAG1), 'GET')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, UUID, TAG1), 'GET')
self.assertRaises(exc.HTTPNotFound, self.controller.show,
req, UUID, TAG1)
@ -170,7 +179,7 @@ class ServerTagsTest(test.TestCase):
mock_db_get_inst_tags.return_value = [self._get_tag(TAG1)]
mock_db_add_inst_tags.return_value = self._get_tag(TAG2)
url = '/v2/fake/servers/%s/tags/%s' % (UUID, TAG2)
url = '/v2/%s/servers/%s/tags/%s' % (fakes.FAKE_PROJECT_ID, UUID, TAG2)
location = 'http://localhost' + url
req = self._get_request(url, 'PUT')
res = self.controller.update(req, UUID, TAG2, body=None)
@ -188,7 +197,8 @@ class ServerTagsTest(test.TestCase):
mock_db_get_inst_tags.return_value = [self._get_tag(TAG1)]
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (UUID, TAG1), 'PUT')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, UUID, TAG1), 'PUT')
res = self.controller.update(req, UUID, TAG1, body=None)
self.assertEqual(204, res.status_int)
@ -203,7 +213,8 @@ class ServerTagsTest(test.TestCase):
mock_db_get_inst_tags.return_value = fake_tags
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (UUID, TAG2), 'PUT')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, UUID, TAG2), 'PUT')
self.assertRaises(exc.HTTPBadRequest, self.controller.update,
req, UUID, TAG2, body=None)
@ -214,7 +225,8 @@ class ServerTagsTest(test.TestCase):
tag = "a" * (tag_obj.MAX_TAG_LENGTH + 1)
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (UUID, tag), 'PUT')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, UUID, tag), 'PUT')
self.assertRaises(exc.HTTPBadRequest, self.controller.update,
req, UUID, tag, body=None)
@ -224,7 +236,8 @@ class ServerTagsTest(test.TestCase):
mock_db_get_inst_tags.return_value = []
for tag in ['tag,1', 'tag/1']:
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (UUID, tag), 'PUT')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, UUID, tag), 'PUT')
self.assertRaises(exc.HTTPBadRequest, self.controller.update,
req, UUID, tag, body=None)
@ -232,7 +245,8 @@ class ServerTagsTest(test.TestCase):
self.stub_out('nova.api.openstack.common.get_instance',
return_invalid_server)
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (UUID, TAG1), 'PUT')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, UUID, TAG1), 'PUT')
self.assertRaises(exc.HTTPConflict, self.controller.update, req, UUID,
TAG1, body=None)
@ -243,7 +257,8 @@ class ServerTagsTest(test.TestCase):
mock_db_get_inst_tags):
self.stub_out('nova.api.openstack.common.get_instance', return_server)
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (UUID, TAG2), 'DELETE')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, UUID, TAG2), 'DELETE')
self.controller.delete(req, UUID, TAG2)
mock_db_delete_inst_tags.assert_called_once_with(mock.ANY, UUID, TAG2)
mock_db_get_inst_tags.assert_called_once_with(mock.ANY, UUID)
@ -260,7 +275,8 @@ class ServerTagsTest(test.TestCase):
tag=tag)
mock_db_delete_inst_tags.side_effect = fake_db_delete_tag
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (UUID, TAG1), 'DELETE')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, UUID, TAG1), 'DELETE')
self.assertRaises(exc.HTTPNotFound, self.controller.delete,
req, UUID, TAG1)
@ -268,7 +284,8 @@ class ServerTagsTest(test.TestCase):
self.stub_out('nova.api.openstack.common.get_instance',
return_invalid_server)
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (UUID, TAG2), 'DELETE')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, UUID, TAG2), 'DELETE')
self.assertRaises(exc.HTTPConflict, self.controller.delete, req, UUID,
TAG1)
@ -276,7 +293,8 @@ class ServerTagsTest(test.TestCase):
@mock.patch('nova.db.api.instance_tag_delete_all')
def test_delete_all(self, mock_db_delete_inst_tags, mock_notify):
self.stub_out('nova.api.openstack.common.get_instance', return_server)
req = self._get_request('/v2/fake/servers/%s/tags' % UUID, 'DELETE')
req = self._get_request('/v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, UUID), 'DELETE')
self.controller.delete_all(req, UUID)
mock_db_delete_inst_tags.assert_called_once_with(mock.ANY, UUID)
self.assertEqual(1, mock_notify.call_count)
@ -284,50 +302,57 @@ class ServerTagsTest(test.TestCase):
def test_delete_all_invalid_instance_state(self):
self.stub_out('nova.api.openstack.common.get_instance',
return_invalid_server)
req = self._get_request('/v2/fake/servers/%s/tags' % UUID, 'DELETE')
req = self._get_request('/v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, UUID), 'DELETE')
self.assertRaises(exc.HTTPConflict, self.controller.delete_all, req,
UUID)
def test_show_non_existing_instance(self):
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (NON_EXISTING_UUID, TAG1), 'GET')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, NON_EXISTING_UUID, TAG1), 'GET')
self.assertRaises(exc.HTTPNotFound, self.controller.show, req,
NON_EXISTING_UUID, TAG1)
def test_show_with_details_information_non_existing_instance(self):
req = self._get_request(
'/v2/fake/servers/%s' % NON_EXISTING_UUID, 'GET')
'/v2/%s/servers/%s' % (
fakes.FAKE_PROJECT_ID, NON_EXISTING_UUID), 'GET')
servers_controller = servers.ServersController()
self.assertRaises(exc.HTTPNotFound, servers_controller.show, req,
NON_EXISTING_UUID)
def test_index_non_existing_instance(self):
req = self._get_request(
'v2/fake/servers/%s/tags' % NON_EXISTING_UUID, 'GET')
'v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, NON_EXISTING_UUID), 'GET')
self.assertRaises(exc.HTTPNotFound, self.controller.index, req,
NON_EXISTING_UUID)
def test_update_non_existing_instance(self):
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (NON_EXISTING_UUID, TAG1), 'PUT')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, NON_EXISTING_UUID, TAG1), 'PUT')
self.assertRaises(exc.HTTPNotFound, self.controller.update, req,
NON_EXISTING_UUID, TAG1, body=None)
def test_update_all_non_existing_instance(self):
req = self._get_request(
'/v2/fake/servers/%s/tags' % NON_EXISTING_UUID, 'PUT')
'/v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, NON_EXISTING_UUID), 'PUT')
self.assertRaises(exc.HTTPNotFound, self.controller.update_all, req,
NON_EXISTING_UUID, body={'tags': TAGS})
def test_delete_non_existing_instance(self):
req = self._get_request(
'/v2/fake/servers/%s/tags/%s' % (NON_EXISTING_UUID, TAG1),
'DELETE')
'/v2/%s/servers/%s/tags/%s' % (
fakes.FAKE_PROJECT_ID, NON_EXISTING_UUID, TAG1), 'DELETE')
self.assertRaises(exc.HTTPNotFound, self.controller.delete, req,
NON_EXISTING_UUID, TAG1)
def test_delete_all_non_existing_instance(self):
req = self._get_request(
'/v2/fake/servers/%s/tags' % NON_EXISTING_UUID, 'DELETE')
'/v2/%s/servers/%s/tags' % (
fakes.FAKE_PROJECT_ID, NON_EXISTING_UUID), 'DELETE')
self.assertRaises(exc.HTTPNotFound, self.controller.delete_all,
req, NON_EXISTING_UUID)

File diff suppressed because it is too large Load Diff

View File

@ -62,7 +62,8 @@ class UrlmapTest(test.NoDBTestCase):
def test_accept_content_type(self):
# Test Accept header specifying JSON returns JSON content.
url = '/v2/fake/images/cedef40a-ed67-4d10-800e-17455edce175'
url = ('/v2/%s/images/cedef40a-ed67-4d10-800e-17455edce175' %
fakes.FAKE_PROJECT_ID)
req = fakes.HTTPRequest.blank(url)
req.accept = "application/xml;q=0.8, application/json"
res = req.get_response(fakes.wsgi_app_v21())

View File

@ -467,7 +467,9 @@ class VersionsTestV21(test.NoDBTestCase):
self.assertEqual(expected, version)
def test_get_version_21_versions_v21_detail(self):
req = fakes.HTTPRequest.blank('/v2.1/fake/versions/v2.1', base_url='')
req = fakes.HTTPRequest.blank(
'/v2.1/%s/versions/v2.1' % fakes.FAKE_PROJECT_ID,
base_url='')
req.accept = "application/json"
res = req.get_response(self.wsgi_app)
self.assertEqual(200, res.status_int)
@ -477,7 +479,9 @@ class VersionsTestV21(test.NoDBTestCase):
self.assertEqual(expected, version)
def test_get_version_21_versions_v20_detail(self):
req = fakes.HTTPRequest.blank('/v2.1/fake/versions/v2.0', base_url='')
req = fakes.HTTPRequest.blank(
'/v2.1/%s/versions/v2.0' % fakes.FAKE_PROJECT_ID,
base_url='')
req.accept = "application/json"
res = req.get_response(self.wsgi_app)
self.assertEqual(200, res.status_int)

View File

@ -159,7 +159,8 @@ class BootFromVolumeTest(test.TestCase):
delete_on_termination=False,
)]
))
req = fakes.HTTPRequest.blank('/v2/fake/os-volumes_boot')
req = fakes.HTTPRequest.blank('/v2/%s/os-volumes_boot' %
fakes.FAKE_PROJECT_ID)
req.method = 'POST'
req.body = jsonutils.dump_as_bytes(body)
req.headers['content-type'] = 'application/json'
@ -187,7 +188,8 @@ class BootFromVolumeTest(test.TestCase):
delete_on_termination=False,
)]
))
req = fakes.HTTPRequest.blank('/v2/fake/os-volumes_boot')
req = fakes.HTTPRequest.blank('/v2/%s/os-volumes_boot' %
fakes.FAKE_PROJECT_ID)
req.method = 'POST'
req.body = jsonutils.dump_as_bytes(body)
req.headers['content-type'] = 'application/json'
@ -205,7 +207,7 @@ class BootFromVolumeTest(test.TestCase):
class VolumeApiTestV21(test.NoDBTestCase):
url_prefix = '/v2/fake'
url_prefix = '/v2/%s' % fakes.FAKE_PROJECT_ID
def setUp(self):
super(VolumeApiTestV21, self).setUp()
@ -1183,7 +1185,8 @@ class CommonBadRequestTestCase(object):
self.controller = self.controller_cls()
def _bad_request_create(self, body):
req = fakes.HTTPRequest.blank('/v2/fake/' + self.resource)
req = fakes.HTTPRequest.blank('/v2/%s/%s' % (
fakes.FAKE_PROJECT_ID, self.resource))
req.method = 'POST'
kwargs = self.kwargs.copy()
@ -1238,10 +1241,12 @@ class AssistedSnapshotCreateTestCaseV21(test.NoDBTestCase):
self.controller = \
self.assisted_snaps.AssistedVolumeSnapshotsController()
self.url = ('/v2/%s/os-assisted-volume-snapshots' %
fakes.FAKE_PROJECT_ID)
@mock.patch.object(compute_api.API, 'volume_snapshot_create')
def test_assisted_create(self, mock_volume_snapshot_create):
req = fakes.HTTPRequest.blank('/v2/fake/os-assisted-volume-snapshots')
req = fakes.HTTPRequest.blank(self.url)
expected_create_info = {'type': 'qcow2',
'new_file': 'new_file',
'snapshot_id': 'snapshot_id'}
@ -1255,14 +1260,14 @@ class AssistedSnapshotCreateTestCaseV21(test.NoDBTestCase):
expected_create_info)
def test_assisted_create_missing_create_info(self):
req = fakes.HTTPRequest.blank('/v2/fake/os-assisted-volume-snapshots')
req = fakes.HTTPRequest.blank(self.url)
body = {'snapshot': {'volume_id': '1'}}
req.method = 'POST'
self.assertRaises(self.bad_request, self.controller.create,
req, body=body)
def test_assisted_create_with_unexpected_attr(self):
req = fakes.HTTPRequest.blank('/v2/fake/os-assisted-volume-snapshots')
req = fakes.HTTPRequest.blank(self.url)
body = {
'snapshot': {
'volume_id': '1',
@ -1281,7 +1286,7 @@ class AssistedSnapshotCreateTestCaseV21(test.NoDBTestCase):
@mock.patch('nova.objects.BlockDeviceMapping.get_by_volume',
side_effect=exception.VolumeBDMIsMultiAttach(volume_id='1'))
def test_assisted_create_multiattach_fails(self, bdm_get_by_volume):
req = fakes.HTTPRequest.blank('/v2/fake/os-assisted-volume-snapshots')
req = fakes.HTTPRequest.blank(self.url)
body = {'snapshot':
{'volume_id': '1',
'create_info': {'type': 'qcow2',
@ -1292,7 +1297,7 @@ class AssistedSnapshotCreateTestCaseV21(test.NoDBTestCase):
webob.exc.HTTPBadRequest, self.controller.create, req, body=body)
def _test_assisted_create_instance_conflict(self, api_error):
req = fakes.HTTPRequest.blank('/v2/fake/os-assisted-volume-snapshots')
req = fakes.HTTPRequest.blank(self.url)
body = {'snapshot':
{'volume_id': '1',
'create_info': {'type': 'qcow2',
@ -1332,13 +1337,15 @@ class AssistedSnapshotDeleteTestCaseV21(test.NoDBTestCase):
self.mock_volume_snapshot_delete = self.useFixture(
fixtures.MockPatchObject(compute_api.API,
'volume_snapshot_delete')).mock
self.url = ('/v2/%s/os-assisted-volume-snapshots' %
fakes.FAKE_PROJECT_ID)
def test_assisted_delete(self):
params = {
'delete_info': jsonutils.dumps({'volume_id': '1'}),
}
req = fakes.HTTPRequest.blank(
'/v2/fake/os-assisted-volume-snapshots?%s' %
self.url + '?%s' %
urllib.parse.urlencode(params),
version=self.microversion)
req.method = 'DELETE'
@ -1346,7 +1353,7 @@ class AssistedSnapshotDeleteTestCaseV21(test.NoDBTestCase):
self._check_status(204, result, self.controller.delete)
def test_assisted_delete_missing_delete_info(self):
req = fakes.HTTPRequest.blank('/v2/fake/os-assisted-volume-snapshots',
req = fakes.HTTPRequest.blank(self.url,
version=self.microversion)
req.method = 'DELETE'
self.assertRaises(webob.exc.HTTPBadRequest, self.controller.delete,
@ -1359,7 +1366,7 @@ class AssistedSnapshotDeleteTestCaseV21(test.NoDBTestCase):
'delete_info': jsonutils.dumps({'volume_id': '1'}),
}
req = fakes.HTTPRequest.blank(
'/v2/fake/os-assisted-volume-snapshots?%s' %
self.url + '?%s' %
urllib.parse.urlencode(params),
version=self.microversion)
req.method = 'DELETE'
@ -1385,7 +1392,7 @@ class AssistedSnapshotDeleteTestCaseV21(test.NoDBTestCase):
'additional': 123
}
req = fakes.HTTPRequest.blank(
'/v2/fake/os-assisted-volume-snapshots?%s' %
self.url + '?%s' %
urllib.parse.urlencode(params),
version=self.microversion)
req.method = 'DELETE'
@ -1397,7 +1404,7 @@ class AssistedSnapshotDeleteTestCaseV21(test.NoDBTestCase):
'delete_info': jsonutils.dumps({'volume_id': '2'})
}
req = fakes.HTTPRequest.blank(
'/v2/fake/os-assisted-volume-snapshots?%s' %
self.url + '?%s' %
urllib.parse.urlencode(params),
version=self.microversion)
req.method = 'DELETE'
@ -1408,7 +1415,7 @@ class AssistedSnapshotDeleteTestCaseV21(test.NoDBTestCase):
'delete_info': jsonutils.dumps({'something_else': '1'}),
}
req = fakes.HTTPRequest.blank(
'/v2/fake/os-assisted-volume-snapshots?%s' %
self.url + '?%s' %
urllib.parse.urlencode(params),
version=self.microversion)
@ -1430,14 +1437,14 @@ class AssistedSnapshotDeleteTestCaseV275(AssistedSnapshotDeleteTestCaseV21):
'additional': 123
}
req = fakes.HTTPRequest.blank(
'/v2/fake/os-assisted-volume-snapshots?%s' %
self.url + '?%s' %
urllib.parse.urlencode(params),
version='2.74')
self.controller.delete(req, 1)
def test_delete_additional_query_parameters(self):
req = fakes.HTTPRequest.blank(
'/v2/fake/os-assisted-volume-snapshots?unknown=1',
self.url + '?unknown=1',
version=self.microversion)
self.assertRaises(exception.ValidationError,
self.controller.delete, req, 1)

View File

@ -73,7 +73,8 @@ def wsgi_app_v21(fake_auth_context=None, v2_compatible=False,
if fake_auth_context is not None:
ctxt = fake_auth_context
else:
ctxt = context.RequestContext('fake', 'fake', auth_token=True)
ctxt = context.RequestContext(
'fake', FAKE_PROJECT_ID, auth_token=True)
api_v21 = openstack_api.FaultWrapper(
api_auth.InjectContext(ctxt, inner_app_v21))
mapper = urlmap.URLMap()
@ -269,7 +270,7 @@ class HTTPRequest(os_wsgi.Request):
def blank(cls, *args, **kwargs):
defaults = {'base_url': 'http://localhost/v2'}
use_admin_context = kwargs.pop('use_admin_context', False)
project_id = kwargs.pop('project_id', 'fake')
project_id = kwargs.pop('project_id', FAKE_PROJECT_ID)
version = kwargs.pop('version', os_wsgi.DEFAULT_API_VERSION)
defaults.update(kwargs)
out = super(HTTPRequest, cls).blank(*args, **defaults)

View File

@ -578,7 +578,7 @@ class UrlJoinTest(test.NoDBTestCase):
class ViewBuilderLinkTest(test.NoDBTestCase):
project_id = "fake"
project_id = fakes.FAKE_PROJECT_ID
api_version = "2.1"
def setUp(self):

View File

@ -42,11 +42,6 @@ class ConfFixture(config_fixture.Config):
self.conf.set_default('network_size', 8)
self.conf.set_default('num_networks', 2)
self.conf.set_default('periodic_enable', False)
# TODO(sdague): this makes our project_id match 'fake' as well.
# We should fix the tests to use real
# UUIDs then drop this work around.
self.conf.set_default('project_id_regex',
'[0-9a-fk-]+', 'osapi_v21')
self.conf.set_default('use_ipv6', True)
self.conf.set_default('vlan_interface', 'eth0')

View File

@ -0,0 +1,4 @@
---
upgrade:
- The ``[osapi_v21]/project_id_regex`` configuration option which has been
deprecated since the Mitaka 13.0.0 release has now been removed.