INFINIDAT: fixing extend mechanism
There was bug (Bug #1772421) that using extend didn't extend the volume and only added to its size. The fix was to calculate size delta inside extend_volume and pass the calculated delta to the API resize method. Change-Id: I73035be776a7291ca1578f21cab41c59abc0a534 Closes-Bug: #1772421
This commit is contained in:
parent
4b96310411
commit
c96f399710
@ -103,6 +103,7 @@ class InfiniboxDriverTestCaseBase(test.TestCase):
|
||||
def _infinibox_mock(self):
|
||||
result = mock.Mock()
|
||||
self._mock_volume = mock.Mock()
|
||||
self._mock_volume.get_size.return_value = 1 * units.Gi
|
||||
self._mock_volume.has_children.return_value = False
|
||||
self._mock_volume.get_logical_units.return_value = []
|
||||
self._mock_volume.create_child.return_value = self._mock_volume
|
||||
@ -299,6 +300,7 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase):
|
||||
|
||||
def test_extend_volume(self):
|
||||
self.driver.extend_volume(test_volume, 2)
|
||||
self._mock_volume.resize.assert_called_with(1 * units.Gi)
|
||||
|
||||
def test_extend_volume_api_fail(self):
|
||||
self._mock_volume.resize.side_effect = self._raise_infinisdk
|
||||
|
@ -536,8 +536,9 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
|
||||
@infinisdk_to_cinder_exceptions
|
||||
def extend_volume(self, volume, new_size):
|
||||
"""Extend the size of a volume."""
|
||||
volume = self._get_infinidat_volume(volume)
|
||||
volume.resize(new_size * capacity.GiB)
|
||||
infinidat_volume = self._get_infinidat_volume(volume)
|
||||
size_delta = new_size * capacity.GiB - infinidat_volume.get_size()
|
||||
infinidat_volume.resize(size_delta)
|
||||
|
||||
@infinisdk_to_cinder_exceptions
|
||||
def create_snapshot(self, snapshot):
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
[`bug 1772421 <https://bugs.launchpad.net/keystone/+bug/1772421>`_]
|
||||
INFINIDAT fixed a bug in volume extension feature where volumes
|
||||
were not extended to target size but added the given target size.
|
||||
|
Loading…
Reference in New Issue
Block a user