Merge "EMC ScaleIO - fix bug in extend volume"

This commit is contained in:
Jenkins 2016-02-26 19:45:52 +00:00 committed by Gerrit Code Review
commit 0f5e61bf6e
2 changed files with 10 additions and 5 deletions

View File

@ -29,7 +29,7 @@ class TestExtendVolume(scaleio.TestScaleIODriver):
The 7 size should be either rounded up to 8 or raise an exception
based on the round_volume_capacity config setting.
"""
NEW_SIZE = 8
NEW_SIZE = 16
BAD_SIZE = 7
def setUp(self):

View File

@ -557,10 +557,10 @@ class ScaleIODriver(driver.VolumeDriver):
# Round up the volume size so that it is a granularity of 8 GBs
# because ScaleIO only supports volumes with a granularity of 8 GBs.
if new_size % 8 == 0:
volume_new_size = new_size
else:
volume_new_size = new_size + 8 - (new_size % 8)
volume_new_size = self._round_to_8_gran(new_size)
volume_real_old_size = self._round_to_8_gran(volume.size)
if volume_real_old_size == volume_new_size:
return
round_volume_capacity = self.configuration.sio_round_volume_capacity
if (not round_volume_capacity and not new_size % 8 == 0):
@ -586,6 +586,11 @@ class ScaleIODriver(driver.VolumeDriver):
LOG.error(msg)
raise exception.VolumeBackendAPIException(data=msg)
def _round_to_8_gran(self, size):
if size % 8 == 0:
return size
return size + 8 - (size % 8)
def create_cloned_volume(self, volume, src_vref):
"""Creates a cloned volume."""
volume_id = src_vref['provider_id']