Merge "Stop posting to os-volumes_boot"

This commit is contained in:
Zuul 2017-11-16 19:04:53 +00:00 committed by Gerrit Code Review
commit 1fd25bc78f
4 changed files with 17 additions and 30 deletions

View File

@ -293,15 +293,6 @@ class Base(base.Fixture):
return {'server': self.server_9012}
# NOTE(jamielennox): hack to make os_volumes mock go to the right place
base_url = self.base_url
self.base_url = None
self.requests_mock.post(self.url('os-volumes_boot'),
json=post_os_volumes_boot,
status_code=202,
headers=self.json_headers)
self.base_url = base_url
#
# Server password
#

View File

@ -188,7 +188,7 @@ class ServersTest(utils.FixturedTestCase):
nics=nics
)
self.assert_request_id(s, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/os-volumes_boot')
self.assert_called('POST', '/servers')
self.assertIsInstance(s, servers.Server)
test_create_server_from_volume()
@ -217,7 +217,7 @@ class ServersTest(utils.FixturedTestCase):
nics=self._get_server_create_default_nics()
)
self.assert_request_id(s, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/os-volumes_boot')
self.assert_called('POST', '/servers')
self.assertIsInstance(s, servers.Server)
def test_create_server_boot_with_nics_ipv6(self):
@ -1384,7 +1384,7 @@ class ServersV232Test(ServersV226Test):
key_name="fakekey",
block_device_mapping_v2=bdm)
self.assert_request_id(s, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/os-volumes_boot')
self.assert_called('POST', '/servers')
def test_create_server_boot_from_volume_tagged_bdm_v2_pre232(self):
self.cs.api_version = api_versions.APIVersion("2.31")

View File

@ -304,7 +304,7 @@ class ShellTest(utils.TestCase):
'boot --flavor 1 --block-device-mapping vda=blah:::0 some-server'
)
self.assert_called_anytime(
'POST', '/os-volumes_boot',
'POST', '/servers',
{'server': {
'flavorRef': '1',
'name': 'some-server',
@ -328,7 +328,7 @@ class ShellTest(utils.TestCase):
'type=disk,shutdown=preserve some-server' % FAKE_UUID_1
)
self.assert_called_anytime(
'POST', '/os-volumes_boot',
'POST', '/servers',
{'server': {
'flavorRef': '1',
'name': 'some-server',
@ -371,7 +371,7 @@ class ShellTest(utils.TestCase):
'type=disk,shutdown=preserve some-server' % FAKE_UUID_1
)
self.assert_called_anytime(
'POST', '/os-volumes_boot',
'POST', '/servers',
{'server': {
'flavorRef': '1',
'name': 'some-server',
@ -407,7 +407,7 @@ class ShellTest(utils.TestCase):
'type=disk,shutdown=preserve some-server' % FAKE_UUID_1
)
self.assert_called_anytime(
'POST', '/os-volumes_boot',
'POST', '/servers',
{'server': {
'flavorRef': '1',
'name': 'some-server',
@ -451,7 +451,7 @@ class ShellTest(utils.TestCase):
api_version='2.32'
)
self.assert_called_anytime(
'POST', '/os-volumes_boot',
'POST', '/servers',
{'server': {
'flavorRef': '1',
'name': 'some-server',
@ -488,7 +488,7 @@ class ShellTest(utils.TestCase):
'type=disk,shutdown=preserve some-server'
)
self.assert_called_anytime(
'POST', '/os-volumes_boot',
'POST', '/servers',
{'server': {
'flavorRef': '1',
'name': 'some-server',
@ -515,7 +515,7 @@ class ShellTest(utils.TestCase):
cmd = 'boot --flavor 1 --boot-volume fake-id some-server'
self.run_command(cmd)
self.assert_called_anytime(
'POST', '/os-volumes_boot',
'POST', '/servers',
{'server': {
'flavorRef': '1',
'name': 'some-server',
@ -537,7 +537,7 @@ class ShellTest(utils.TestCase):
cmd = 'boot --flavor 1 --snapshot fake-id some-server'
self.run_command(cmd)
self.assert_called_anytime(
'POST', '/os-volumes_boot',
'POST', '/servers',
{'server': {
'flavorRef': '1',
'name': 'some-server',
@ -558,7 +558,7 @@ class ShellTest(utils.TestCase):
self.run_command('boot --flavor 1 --swap 1 some-server')
self.assert_called_anytime(
'POST', '/os-volumes_boot',
'POST', '/servers',
{'server': {
'flavorRef': '1',
'name': 'some-server',
@ -582,7 +582,7 @@ class ShellTest(utils.TestCase):
'boot --flavor 1 --ephemeral size=1,format=ext4 some-server'
)
self.assert_called_anytime(
'POST', '/os-volumes_boot',
'POST', '/servers',
{'server': {
'flavorRef': '1',
'name': 'some-server',

View File

@ -655,7 +655,7 @@ class SecurityGroup(base.Resource):
class ServerManager(base.BootingManagerWithFind):
resource_class = Server
def _boot(self, resource_url, response_key, name, image, flavor,
def _boot(self, response_key, name, image, flavor,
meta=None, files=None, userdata=None,
reservation_id=False, return_raw=False, min_count=None,
max_count=None, security_groups=None, key_name=None,
@ -799,7 +799,7 @@ class ServerManager(base.BootingManagerWithFind):
if tags:
body['server']['tags'] = tags
return self._create(resource_url, body, response_key,
return self._create('/servers', body, response_key,
return_raw=return_raw, **kwargs)
def get(self, server):
@ -1391,19 +1391,15 @@ class ServerManager(base.BootingManagerWithFind):
access_ip_v4=access_ip_v4, access_ip_v6=access_ip_v6, **kwargs)
if block_device_mapping:
resource_url = "/os-volumes_boot"
boot_kwargs['block_device_mapping'] = block_device_mapping
elif block_device_mapping_v2:
resource_url = "/os-volumes_boot"
boot_kwargs['block_device_mapping_v2'] = block_device_mapping_v2
else:
resource_url = "/servers"
if nics:
boot_kwargs['nics'] = nics
response_key = "server" if not reservation_id else "reservation_id"
return self._boot(resource_url, response_key, *boot_args,
**boot_kwargs)
return self._boot(response_key, *boot_args, **boot_kwargs)
@api_versions.wraps("2.0", "2.18")
def update(self, server, name=None):