Datera: resize volume if cloned image is larger
Extend volume if during create_cloned_volume() the new volume is larger than the volume it was cloned from. Extended test case to cover the change. Closes-Bug: #1554755 Change-Id: I981faf38021225459806ce313aec29d8cc2833c8 Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
parent
092618aab8
commit
66c6844932
@ -118,6 +118,17 @@ class DateraVolumeTestCase(test.TestCase):
|
||||
self.assertIsNone(self.driver.create_cloned_volume(self.volume,
|
||||
source_volume))
|
||||
|
||||
@mock.patch.object(datera.DateraDriver, 'extend_volume')
|
||||
def test_create_cloned_volume_success_larger(self, mock_extend):
|
||||
cloned_volume = _stub_volume(
|
||||
id='7f91abfa-7964-41ed-88fc-207c3a290b4f',
|
||||
display_name='foo',
|
||||
size=2
|
||||
)
|
||||
self.driver.create_cloned_volume(cloned_volume, self.volume)
|
||||
mock_extend.assert_called_once_with(cloned_volume,
|
||||
cloned_volume['size'])
|
||||
|
||||
def test_create_cloned_volume_fails(self):
|
||||
self.mock_api.side_effect = exception.DateraAPIException
|
||||
source_volume = _stub_volume(
|
||||
|
@ -239,6 +239,9 @@ class DateraDriver(san.SanISCSIDriver):
|
||||
}
|
||||
self._issue_api_request('app_instances', 'post', body=data)
|
||||
|
||||
if volume['size'] > src_vref['size']:
|
||||
self.extend_volume(volume, volume['size'])
|
||||
|
||||
def delete_volume(self, volume):
|
||||
self.detach_volume(None, volume)
|
||||
app_inst = volume['id']
|
||||
|
Loading…
Reference in New Issue
Block a user