self.driver.configuration.set_override('sio_round_volume_capacity',
override=False)
self.set_https_response_mode(self.RESPONSE_MODE.Valid)
- self.assertRaises(exception.VolumeBackendAPIException,
- self.driver.extend_volume,
- self.volume,
- self.BAD_SIZE)
+ self.driver.extend_volume(self.volume, self.BAD_SIZE)
def test_extend_volume_bad_size_round(self):
self.driver.configuration.set_override('sio_round_volume_capacity',
return verify_cert
def extend_volume(self, volume, new_size):
- """Extends the size of an existing available ScaleIO volume."""
-
- self._check_volume_size(new_size)
+ """Extends the size of an existing available ScaleIO volume.
+ This action will round up the volume to the nearest size that is
+ a granularity of 8 GBs.
+ """
vol_id = volume['provider_id']
LOG.info(_LI(
"ScaleIO extend volume: volume %(volname)s to size %(new_size)s."),
"/api/instances/Volume::%(vol_id)s"
"/action/setVolumeSize") % req_vars
LOG.info(_LI("Change volume capacity request: %s."), request)
- volume_new_size = new_size
+
+ # 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)
+
+ round_volume_capacity = self.configuration.sio_round_volume_capacity
+ if (not round_volume_capacity and not new_size % 8 == 0):
+ LOG.warning(_LW("ScaleIO only supports volumes with a granularity "
+ "of 8 GBs. The new volume size is: %d."),
+ volume_new_size)
+
params = {'sizeInGB': six.text_type(volume_new_size)}
r = requests.post(
request,