Add volume_size_extend opt for volume tests
Volume tests had hardcoded value (1) in case they were creating a second volume with a different size than the first one (CONF.volume.volume_size). This is a problem for systems which have a chunk size other than 1. The patch is adding a new opt CONF.volume.volume_size_extend which allows customization of an extended volume size. Closes-Bug: 1917299 Change-Id: Ic8ae486224cd2a470f4f9bbad62d4d6715cc63ac
This commit is contained in:
parent
53c02181f8
commit
37c4bd3023
@ -0,0 +1,10 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Adding new config option for volume tests which allows to specify the size
|
||||
a volume will be extended by (if a test does extend a volume or needs
|
||||
a new bigger volume). The option is beneficial in case such tests are
|
||||
executed on systems where the chunk size (the minimum size a volume can be
|
||||
extended by) is other than 1 (originally hardcoded in the tests).:
|
||||
|
||||
CONF.volume.volume_size_extend
|
@ -49,13 +49,14 @@ class VolumesCloneTest(base.BaseVolumeTest):
|
||||
# Creates a volume from another volume passing a size different from
|
||||
# the source volume.
|
||||
src_size = CONF.volume.volume_size
|
||||
extend_size = CONF.volume.volume_size_extend
|
||||
|
||||
src_vol = self.create_volume(size=src_size)
|
||||
# Destination volume bigger than source
|
||||
dst_vol = self.create_volume(source_volid=src_vol['id'],
|
||||
size=src_size + 1)
|
||||
size=src_size + extend_size)
|
||||
|
||||
self._verify_volume_clone(src_vol, dst_vol, extra_size=1)
|
||||
self._verify_volume_clone(src_vol, dst_vol, extra_size=extend_size)
|
||||
|
||||
@decorators.idempotent_id('cbbcd7c6-5a6c-481a-97ac-ca55ab715d16')
|
||||
@utils.services('image')
|
||||
|
@ -36,11 +36,11 @@ class VolumesCloneNegativeTest(base.BaseVolumeTest):
|
||||
"""Test cloning a volume with decreasing size will fail"""
|
||||
# Creates a volume from another volume passing a size different from
|
||||
# the source volume.
|
||||
src_size = CONF.volume.volume_size + 1
|
||||
src_size = CONF.volume.volume_size + CONF.volume.volume_size_extend
|
||||
src_vol = self.create_volume(size=src_size)
|
||||
|
||||
# Destination volume smaller than source
|
||||
self.assertRaises(exceptions.BadRequest,
|
||||
self.volumes_client.create_volume,
|
||||
size=src_size - 1,
|
||||
size=src_size - CONF.volume.volume_size_extend,
|
||||
source_volid=src_vol['id'])
|
||||
|
@ -45,7 +45,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
|
||||
container_format=CONF.image.container_formats[0],
|
||||
disk_format=CONF.image.disk_formats[0],
|
||||
visibility='private',
|
||||
min_disk=CONF.volume.volume_size + 1)
|
||||
min_disk=CONF.volume.volume_size + CONF.volume.volume_size_extend)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.images_client.delete_image, image['id'])
|
||||
|
||||
@ -223,7 +223,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
|
||||
@decorators.idempotent_id('8f05a943-013c-4063-ac71-7baf561e82eb')
|
||||
def test_volume_extend_with_nonexistent_volume_id(self):
|
||||
"""Test extending non existent volume should fail"""
|
||||
extend_size = self.volume['size'] + 1
|
||||
extend_size = self.volume['size'] + CONF.volume.volume_size_extend
|
||||
self.assertRaises(lib_exc.NotFound, self.volumes_client.extend_volume,
|
||||
data_utils.rand_uuid(), new_size=extend_size)
|
||||
|
||||
@ -231,7 +231,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
|
||||
@decorators.idempotent_id('aff8ba64-6d6f-4f2e-bc33-41a08ee9f115')
|
||||
def test_volume_extend_without_passing_volume_id(self):
|
||||
"""Test extending volume without passing volume id should fail"""
|
||||
extend_size = self.volume['size'] + 1
|
||||
extend_size = self.volume['size'] + CONF.volume.volume_size_extend
|
||||
self.assertRaises(lib_exc.NotFound, self.volumes_client.extend_volume,
|
||||
None, new_size=extend_size)
|
||||
|
||||
|
@ -1000,6 +1000,11 @@ VolumeGroup = [
|
||||
cfg.IntOpt('volume_size',
|
||||
default=1,
|
||||
help='Default size in GB for volumes created by volumes tests'),
|
||||
cfg.IntOpt('volume_size_extend',
|
||||
default=1,
|
||||
help="Size in GB a volume is extended by - if a test "
|
||||
"extends a volume, the size of the new volume will be "
|
||||
"volume_size + volume_size_extend."),
|
||||
cfg.ListOpt('manage_volume_ref',
|
||||
default=['source-name', 'volume-%s'],
|
||||
help="A reference to existing volume for volume manage. "
|
||||
|
Loading…
Reference in New Issue
Block a user