tests: Add test for multiple blocks devices

The 'server create' command should support multiple '--block-device'
parameters. Prove it.

Change-Id: I1bd83287efdbbe11774053b694bae99b6a4ebdf5
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2022-10-20 15:49:43 +01:00
parent 6cd72f6182
commit e7bc68735f

View File

@ -1445,6 +1445,7 @@ class TestServerCreate(TestServer):
self.flavors_mock.get.return_value = self.flavor
self.volume = volume_fakes.create_one_volume()
self.volume_alt = volume_fakes.create_one_volume()
self.volumes_mock.get.return_value = self.volume
self.snapshot = volume_fakes.create_one_snapshot()
@ -2563,11 +2564,13 @@ class TestServerCreate(TestServer):
'key_name': None,
'availability_zone': None,
'admin_pass': None,
'block_device_mapping_v2': [{
'uuid': self.volume.id,
'source_type': 'volume',
'destination_type': 'volume',
}],
'block_device_mapping_v2': [
{
'uuid': self.volume.id,
'source_type': 'volume',
'destination_type': 'volume',
},
],
'nics': [],
'scheduler_hints': {},
'config_drive': None,
@ -2594,11 +2597,13 @@ class TestServerCreate(TestServer):
f'volume_type=foo,boot_index=1,delete_on_termination=true,'
f'tag=foo'
)
block_device_alt = f'uuid={self.volume_alt.id},source_type=volume'
arglist = [
'--image', 'image1',
'--flavor', self.flavor.id,
'--block-device', block_device,
'--block-device', block_device_alt,
self.new_server.name,
]
verifylist = [
@ -2619,6 +2624,10 @@ class TestServerCreate(TestServer):
'delete_on_termination': 'true',
'tag': 'foo',
},
{
'uuid': self.volume_alt.id,
'source_type': 'volume',
},
]),
('server_name', self.new_server.name),
]
@ -2639,20 +2648,27 @@ class TestServerCreate(TestServer):
'key_name': None,
'availability_zone': None,
'admin_pass': None,
'block_device_mapping_v2': [{
'uuid': self.volume.id,
'source_type': 'volume',
'destination_type': 'volume',
'disk_bus': 'ide',
'device_name': 'sdb',
'volume_size': '64',
'guest_format': 'ext4',
'boot_index': 1,
'device_type': 'disk',
'delete_on_termination': True,
'tag': 'foo',
'volume_type': 'foo',
}],
'block_device_mapping_v2': [
{
'uuid': self.volume.id,
'source_type': 'volume',
'destination_type': 'volume',
'disk_bus': 'ide',
'device_name': 'sdb',
'volume_size': '64',
'guest_format': 'ext4',
'boot_index': 1,
'device_type': 'disk',
'delete_on_termination': True,
'tag': 'foo',
'volume_type': 'foo',
},
{
'uuid': self.volume_alt.id,
'source_type': 'volume',
'destination_type': 'volume',
},
],
'nics': 'auto',
'scheduler_hints': {},
'config_drive': None,