From 164010ab0cdcd6b3a9f280793a460a7f1fd9f4aa Mon Sep 17 00:00:00 2001 From: Matan Sabag Date: Sat, 30 Jan 2016 14:09:27 -0800 Subject: [PATCH] EMC ScaleIO - fix bug in extend volume Our storage system works in 8GB granularity. If User extends volume from X to Y while X==Y(mod 8) it is redundant and fails the REST call. DocImpact Closes-Bug: #1539099 Change-Id: I75bc5bbffa506c4cb29d9741f8f54874290c0101 --- .../drivers/emc/scaleio/test_extend_volume.py | 2 +- cinder/volume/drivers/emc/scaleio.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cinder/tests/unit/volume/drivers/emc/scaleio/test_extend_volume.py b/cinder/tests/unit/volume/drivers/emc/scaleio/test_extend_volume.py index 730401fc1..2b1ab30d3 100644 --- a/cinder/tests/unit/volume/drivers/emc/scaleio/test_extend_volume.py +++ b/cinder/tests/unit/volume/drivers/emc/scaleio/test_extend_volume.py @@ -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): diff --git a/cinder/volume/drivers/emc/scaleio.py b/cinder/volume/drivers/emc/scaleio.py index 1772ab614..fbdb83505 100644 --- a/cinder/volume/drivers/emc/scaleio.py +++ b/cinder/volume/drivers/emc/scaleio.py @@ -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'] -- 2.45.2