Merge "Make VolumeAttachmentsSampleV249 test other methods"
This commit is contained in:
commit
880327cc31
@ -1,8 +1,8 @@
|
||||
{
|
||||
"volumeAttachment": {
|
||||
"device": "/dev/sdb",
|
||||
"device": "/dev/vdd",
|
||||
"id": "a26887c6-c47b-4654-abb5-dfadf7d3f803",
|
||||
"serverId": "84ffbfa0-daf4-4e23-bf4b-dc532c459d4e",
|
||||
"serverId": "189dc814-35bc-428b-bba4-8d5ac0d1e087",
|
||||
"volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"volumeAttachments": [
|
||||
{
|
||||
"device": "/dev/sdd",
|
||||
"id": "a26887c6-c47b-4654-abb5-dfadf7d3f803",
|
||||
"serverId": "4bcb3ae6-68aa-4e89-aac3-97b3dac2f714",
|
||||
"volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803"
|
||||
},
|
||||
{
|
||||
"device": "/dev/sdc",
|
||||
"id": "a26887c6-c47b-4654-abb5-dfadf7d3f804",
|
||||
"serverId": "4bcb3ae6-68aa-4e89-aac3-97b3dac2f714",
|
||||
"volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f804"
|
||||
}
|
||||
]
|
||||
}
|
5
doc/api_samples/os-volumes/v2.49/update-volume-req.json
Normal file
5
doc/api_samples/os-volumes/v2.49/update-volume-req.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"volumeAttachment": {
|
||||
"volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f805"
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"volumeAttachment": {
|
||||
"device": "/dev/sdd",
|
||||
"id": "a26887c6-c47b-4654-abb5-dfadf7d3f803",
|
||||
"serverId": "3dc0a2a6-e1bb-4643-8b6f-c146684d676d",
|
||||
"volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803"
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"volumeAttachments": [
|
||||
{
|
||||
"device": "/dev/sdd",
|
||||
"id": "a26887c6-c47b-4654-abb5-dfadf7d3f803",
|
||||
"serverId": "%(uuid)s",
|
||||
"volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803"
|
||||
},
|
||||
{
|
||||
"device": "/dev/sdc",
|
||||
"id": "a26887c6-c47b-4654-abb5-dfadf7d3f804",
|
||||
"serverId": "%(uuid)s",
|
||||
"volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f804"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"volumeAttachment": {
|
||||
"volumeId": "%(volume_id)s"
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"volumeAttachment": {
|
||||
"device": "/dev/sdd",
|
||||
"id": "a26887c6-c47b-4654-abb5-dfadf7d3f803",
|
||||
"serverId": "%(uuid)s",
|
||||
"volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803"
|
||||
}
|
||||
}
|
@ -245,6 +245,10 @@ class VolumeAttachmentsSample(test_servers.ServersSampleBase):
|
||||
|
||||
self.stub_out('nova.compute.api.API.get', fake_compute_api_get)
|
||||
|
||||
def _get_vol_attachment_subs(self, subs):
|
||||
"""Allows subclasses to override/supplement request/response subs"""
|
||||
return subs
|
||||
|
||||
def test_attach_volume_to_server(self):
|
||||
self.stub_out('nova.objects.Service.get_minimum_version',
|
||||
lambda *a, **k: COMPUTE_VERSION_OLD_ATTACH_FLOW)
|
||||
@ -268,6 +272,7 @@ class VolumeAttachmentsSample(test_servers.ServersSampleBase):
|
||||
'device': device_name
|
||||
}
|
||||
server_id = self._post_server()
|
||||
subs = self._get_vol_attachment_subs(subs)
|
||||
response = self._do_post('servers/%s/os-volume_attachments'
|
||||
% server_id,
|
||||
'attach-volume-to-server-req', subs)
|
||||
@ -300,6 +305,7 @@ class VolumeAttachmentsSample(test_servers.ServersSampleBase):
|
||||
'device': device_name
|
||||
}
|
||||
server_id = self._post_server()
|
||||
subs = self._get_vol_attachment_subs(subs)
|
||||
response = self._do_post('servers/%s/os-volume_attachments'
|
||||
% server_id,
|
||||
'attach-volume-to-server-req', subs)
|
||||
@ -362,7 +368,7 @@ class VolumeAttachmentsSample(test_servers.ServersSampleBase):
|
||||
self.assertEqual('', response.text)
|
||||
|
||||
|
||||
class VolumeAttachmentsSampleV249(test_servers.ServersSampleBase):
|
||||
class VolumeAttachmentsSampleV249(VolumeAttachmentsSample):
|
||||
sample_dir = "os-volumes"
|
||||
microversion = '2.49'
|
||||
scenarios = [('v2_49', {'api_major_version': 'v2.1'})]
|
||||
@ -371,53 +377,5 @@ class VolumeAttachmentsSampleV249(test_servers.ServersSampleBase):
|
||||
super(VolumeAttachmentsSampleV249, self).setUp()
|
||||
self.useFixture(fixtures.CinderFixtureNewAttachFlow(self))
|
||||
|
||||
def test_attach_volume_to_server(self):
|
||||
device_name = '/dev/sdb'
|
||||
bdm = objects.BlockDeviceMapping()
|
||||
bdm['device_name'] = device_name
|
||||
volume = fakes.stub_volume_get(None, context.get_admin_context(),
|
||||
'a26887c6-c47b-4654-abb5-dfadf7d3f803')
|
||||
subs = {
|
||||
'volume_id': volume['id'],
|
||||
'device': device_name,
|
||||
'tag': 'foo',
|
||||
}
|
||||
server_id = self._post_server()
|
||||
response = self._do_post('servers/%s/os-volume_attachments'
|
||||
% server_id,
|
||||
'attach-volume-to-server-req', subs)
|
||||
|
||||
self._verify_response('attach-volume-to-server-resp', subs,
|
||||
response, 200)
|
||||
|
||||
|
||||
class VolumeAttachmentsSampleV249OldCinderFlow(test_servers.ServersSampleBase):
|
||||
|
||||
sample_dir = "os-volumes"
|
||||
microversion = '2.49'
|
||||
scenarios = [('v2_49', {'api_major_version': 'v2.1'})]
|
||||
|
||||
def setUp(self):
|
||||
super(VolumeAttachmentsSampleV249OldCinderFlow, self).setUp()
|
||||
self.useFixture(fixtures.CinderFixture(self))
|
||||
|
||||
def test_attach_volume_to_server(self):
|
||||
device_name = '/dev/sdb'
|
||||
bdm = objects.BlockDeviceMapping()
|
||||
bdm['device_name'] = device_name
|
||||
volume = fakes.stub_volume_get(None, context.get_admin_context(),
|
||||
'a26887c6-c47b-4654-abb5-dfadf7d3f803')
|
||||
self.stub_out('nova.objects.Service.get_minimum_version',
|
||||
lambda *a, **k: COMPUTE_VERSION_OLD_ATTACH_FLOW)
|
||||
subs = {
|
||||
'volume_id': volume['id'],
|
||||
'device': device_name,
|
||||
'tag': 'foo',
|
||||
}
|
||||
server_id = self._post_server()
|
||||
response = self._do_post('servers/%s/os-volume_attachments'
|
||||
% server_id,
|
||||
'attach-volume-to-server-req', subs)
|
||||
|
||||
self._verify_response('attach-volume-to-server-resp', subs,
|
||||
response, 200)
|
||||
def _get_vol_attachment_subs(self, subs):
|
||||
return dict(subs, tag='foo')
|
||||
|
Loading…
Reference in New Issue
Block a user