EMC ScaleIO driver does not honor create from snapshot volume size

create_volume_from_snapshot can specify a volume size
larger than the orginal snapshot.
Current code does not appear to handle this size difference.
This patch addresses the issue.

Change-Id: Ifa247ef0eec00c23afe6f875107a06f756bc180e
Closes-Bug: #1560649
This commit is contained in:
whoami-rajat 2018-09-04 21:07:39 +05:30
parent 1579981969
commit e0b7c11535
3 changed files with 21 additions and 1 deletions

View File

@ -98,3 +98,8 @@ class TestCreateVolumeFromSnapShot(scaleio.TestScaleIODriver):
def test_create_volume_from_snapshot(self):
self.set_https_response_mode(self.RESPONSE_MODE.Valid)
self.driver.create_volume_from_snapshot(self.volume, self.snapshot)
def test_create_volume_from_snapshot_larger(self):
self.set_https_response_mode(self.RESPONSE_MODE.Valid)
self.volume.size = 2
self.driver.create_volume_from_snapshot(self.volume, self.snapshot)

View File

@ -788,7 +788,15 @@ class ScaleIODriver(driver.VolumeDriver):
{'volname': volume_id,
'snapname': snapname})
return self._snapshot_volume(volume_id, snapname)
ret = self._snapshot_volume(volume_id, snapname)
if volume.size > snapshot.volume_size:
LOG.info("Extending volume %(vol)s to size %(size)s",
{'vol': ret['provider_id'],
'size': volume.size})
self._extend_volume(ret['provider_id'],
snapshot.volume_size, volume.size)
return ret
@staticmethod
def _get_headers():

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Dell EMC Scale IO Driver: Fixes `bug 1560649
<https://bugs.launchpad.net/cinder/+bug/1560649>`
for creating volumes with sizes greater than that of the
original snapshot.