Merge "Add test case: clone volume with bad size"

This commit is contained in:
Zuul 2019-01-11 12:21:14 +00:00 committed by Gerrit Code Review
commit 5b37d2aa33

View File

@ -2601,6 +2601,21 @@ class VolumeTestCase(base.BaseVolumeTestCase):
self.volume.delete_volume(self.context, volume_dst)
self.volume.delete_volume(self.context, volume_src)
def test_create_volume_from_sourcevol_fail_bad_size(self):
"""Test cannot clone volume with bad volume size."""
volume_src = tests_utils.create_volume(self.context,
size=3,
status='available',
host=CONF.host)
self.assertRaises(exception.InvalidInput,
self.volume_api.create,
self.context,
size=1,
name='fake_name',
description='fake_desc',
source_volume=volume_src)
@mock.patch('cinder.volume.api.API.list_availability_zones',
return_value=({'name': 'nova', 'available': True},
{'name': 'az2', 'available': True}))