PowerFlex driver - fix the display of the incorrect volume
size on volume or snapshot creation. Now the user can see the size that would initially set by him when user creates volume via powerflex driver. This is happening because the powerflex storage creates volumes with a size multiple of 8, but the cinder doesn't expect the powerflex driver to return a rounded size. As a result, the user will see not the size that he set initially when creating the volume, but in the storage will be volume with the size of multiple 8. At the end of the create volume process, if the volume size is not equal to the original size, then extend volume and PowerFlex driver will not return size multiply of 8. Closes-Bug: #1968164 Change-Id: Ib0334d2e1be80d1a20c26b4435076187b0e43d40
This commit is contained in:
parent
9a8f867321
commit
b1b09d4085
|
@ -82,10 +82,27 @@ class TestCreateVolume(powerflex.TestPowerFlexDriver):
|
|||
"""Valid create volume parameters"""
|
||||
self.driver.create_volume(self.volume)
|
||||
|
||||
def test_create_volume_non_8_gran_with_off_round_parameter(self):
|
||||
self.driver.configuration.powerflex_round_volume_capacity = False
|
||||
self.volume.size = 14
|
||||
self.assertRaises(exception.VolumeBackendAPIException,
|
||||
self.driver.create_volume, self.volume)
|
||||
|
||||
def test_create_volume_non_8_gran(self):
|
||||
self.driver.configuration.powerflex_round_volume_capacity = True
|
||||
self.volume.size = 14
|
||||
model_update = self.driver.create_volume(self.volume)
|
||||
self.assertEqual(16, model_update['size'])
|
||||
self.assertEqual(self.volume.size, 14)
|
||||
self.assertFalse(model_update.get('size', False))
|
||||
|
||||
def test_create_volume_rest_client(self):
|
||||
self.driver.configuration.powerflex_round_volume_capacity = True
|
||||
self.driver.primary_client.create_volume = mock.Mock()
|
||||
self.volume.size = 12
|
||||
self.driver.create_volume(self.volume)
|
||||
self.driver.primary_client.create_volume.assert_called_with(
|
||||
self.PROT_DOMAIN_NAME, self.STORAGE_POOL_NAME, self.volume.id,
|
||||
self.volume.size, 'ThinProvisioned', 'None')
|
||||
|
||||
def test_create_volume_badstatus_response(self):
|
||||
self.set_https_response_mode(self.RESPONSE_MODE.BadStatus)
|
||||
|
|
|
@ -628,18 +628,15 @@ class PowerFlexDriver(driver.VolumeDriver):
|
|||
volume.size,
|
||||
provisioning,
|
||||
compression)
|
||||
real_size = int(flex_utils.round_to_num_gran(volume.size))
|
||||
model_updates = {
|
||||
"provider_id": provider_id,
|
||||
"size": real_size,
|
||||
"replication_status": fields.ReplicationStatus.DISABLED,
|
||||
}
|
||||
LOG.info("Successfully created volume %(vol_id)s. "
|
||||
"Volume size: %(size)s. PowerFlex volume name: %(vol_name)s, "
|
||||
"PowerFlex volume name: %(vol_name)s, "
|
||||
"id: %(provider_id)s.",
|
||||
{
|
||||
"vol_id": volume.id,
|
||||
"size": real_size,
|
||||
"vol_name": flex_utils.id_to_base64(volume.id),
|
||||
"provider_id": provider_id,
|
||||
})
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
PowerFlex driver `Bug #1968164 <https://bugs.launchpad.net/cinder/+bug/1968164>`_:
|
||||
Fixed the display of the incorrect volume size on volume or snapshot creation.
|
||||
PowerFlex storage requires volumes sizes to be a multiple of 8 GiB. This size
|
||||
was being reported to the end user, potentially causing confusion by being
|
||||
different than what they requested.
|
Loading…
Reference in New Issue