Modify the tests to run on any image size

The current virtio scsi tests were only created
for using the images that can boot up using 1 gb
volume size and thus it creates the problem for
the images that needs the boot volume disk more
than 1 GB.

Modified the boot volume size to be set by the
user as per the flavor_volume size conf. paramter
for the virtio scsi disk tests.

There were couple tests that needs modification:

test_boot_with_multiple disks needs the boot volume
size to be according to the CONF.whitebox.flavor_volume_size
param set by the user according to the image used for
booting the instance.

Other one is test_attach_multiple_disk which currently
used the volume size according to the flavor used in
whitebox test so to avoid unnecessary using high disk
flavor volume size for attaching the multiple disk, this
patch will explicitly mention the create volume size for
attaching volume to be 1 GB.

Change-Id: Id57fdcb7b6188cbda01da135f39b54c17f7a4cf8
This commit is contained in:
Paras Babbar 2020-09-21 09:04:36 -04:00
parent bfde546191
commit 1dd0c63df6

View File

@ -103,8 +103,11 @@ class VirtioSCSIDisk(base.BaseWhiteboxComputeTest):
None]
return serial_ids
@testtools.skipUnless(CONF.whitebox.available_cinder_storage > 8,
'Need at least 8GB of storage to execute')
@testtools.skipUnless(CONF.whitebox.available_cinder_storage >
(CONF.whitebox.flavor_volume_size + disks_to_create),
'Need more than %sGB of storage to execute'
% (CONF.whitebox.flavor_volume_size + disks_to_create
))
def test_boot_with_multiple_disks(self):
"""Using block device mapping, boot an instance with more than six
volumes. Total volume count is determined by class variable
@ -117,10 +120,11 @@ class VirtioSCSIDisk(base.BaseWhiteboxComputeTest):
if i == 0:
boot_dict['uuid'] = self.img_id
boot_dict['source_type'] = 'image'
boot_dict['volume_size'] = CONF.whitebox.flavor_volume_size
else:
boot_dict['source_type'] = 'blank'
boot_dict['volume_size'] = 1
boot_dict.update({'destination_type': 'volume',
'volume_size': 1,
'boot_index': i,
'disk_bus': 'scsi',
'delete_on_termination': True})
@ -155,8 +159,11 @@ class VirtioSCSIDisk(base.BaseWhiteboxComputeTest):
"Created vol ids do not align with serial ids "
"found on the domain")
@testtools.skipUnless(CONF.whitebox.available_cinder_storage > 8,
'Need at least 9GB of storage to execute')
@testtools.skipUnless(CONF.whitebox.available_cinder_storage >
(CONF.whitebox.flavor_volume_size + disks_to_create),
'Need more than %sGB of storage to execute'
% (CONF.whitebox.flavor_volume_size + disks_to_create
))
def test_attach_multiple_scsi_disks(self):
"""After booting an instance from an image with virtio-scsi properties
attach multiple additional virtio-scsi disks to the point that the
@ -170,7 +177,7 @@ class VirtioSCSIDisk(base.BaseWhiteboxComputeTest):
# controller since hw_scsi_model of the image was already set to
# 'virtio-scsi' in self.setUp(). Decrementing disks_to_create by 1.
for _ in range(self.disks_to_create - 1):
volume = self.create_volume()
volume = self.create_volume(size=1)
vol_ids.append(volume['id'])
self.addCleanup(self.delete_volume, volume['id'])
self.attach_volume(server, volume)