Dell PowerStore: Volume caching exception support
Fixed volume caching in PowerStore driver. Volume caching stops working after 32nd volume created from the same image due to snapshot limit per volume in PowerStore. The driver needs to throw exception SnapshotLimitReached to invalidate cache and start over with new volume snapshots. Closes-Bug: #1962824 Change-Id: I8b46d443a75bf98260394552f77c6807e405dce7
This commit is contained in:
parent
24a7834088
commit
f47be72adc
@ -19,6 +19,7 @@ from cinder import exception
|
|||||||
from cinder.tests.unit import fake_snapshot
|
from cinder.tests.unit import fake_snapshot
|
||||||
from cinder.tests.unit import fake_volume
|
from cinder.tests.unit import fake_volume
|
||||||
from cinder.tests.unit.volume.drivers.dell_emc import powerstore
|
from cinder.tests.unit.volume.drivers.dell_emc import powerstore
|
||||||
|
from cinder.volume.drivers.dell_emc.powerstore import client
|
||||||
|
|
||||||
|
|
||||||
class TestVolumeCreateFromSource(powerstore.TestPowerStoreDriver):
|
class TestVolumeCreateFromSource(powerstore.TestPowerStoreDriver):
|
||||||
@ -114,3 +115,26 @@ class TestVolumeCreateFromSource(powerstore.TestPowerStoreDriver):
|
|||||||
self.source_volume
|
self.source_volume
|
||||||
)
|
)
|
||||||
self.assertIn("Failed to extend PowerStore volume", error.msg)
|
self.assertIn("Failed to extend PowerStore volume", error.msg)
|
||||||
|
|
||||||
|
@mock.patch("requests.request")
|
||||||
|
def test_create_snapshot_limit_reached(self, mock_create_snap_limit):
|
||||||
|
snapshot_limit_reached_response = {
|
||||||
|
'errorCode': 0,
|
||||||
|
'message': 'messages',
|
||||||
|
'messages': [
|
||||||
|
{
|
||||||
|
'code': client.TOO_MANY_SNAPS_ERROR,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
mock_create_snap_limit.return_value = powerstore.MockResponse(
|
||||||
|
snapshot_limit_reached_response, rc=400)
|
||||||
|
error = self.assertRaises(
|
||||||
|
exception.SnapshotLimitReached,
|
||||||
|
self.driver.adapter.create_volume_from_source,
|
||||||
|
self.volume,
|
||||||
|
self.source_volume
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
"Exceeded the configured limit of 32 snapshots per volume.",
|
||||||
|
error.msg)
|
||||||
|
@ -31,6 +31,8 @@ from cinder.volume.drivers.dell_emc.powerstore import utils
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
VOLUME_NOT_MAPPED_ERROR = "0xE0A08001000F"
|
VOLUME_NOT_MAPPED_ERROR = "0xE0A08001000F"
|
||||||
SESSION_ALREADY_FAILED_OVER_ERROR = "0xE0201005000C"
|
SESSION_ALREADY_FAILED_OVER_ERROR = "0xE0201005000C"
|
||||||
|
TOO_MANY_SNAPS_ERROR = "0xE0A040010003"
|
||||||
|
MAX_SNAPS_IN_VTREE = 32
|
||||||
|
|
||||||
|
|
||||||
class PowerStoreClient(object):
|
class PowerStoreClient(object):
|
||||||
@ -271,6 +273,10 @@ class PowerStoreClient(object):
|
|||||||
"entity": entity,
|
"entity": entity,
|
||||||
"entity_id": entity_id, })
|
"entity_id": entity_id, })
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
|
if ("messages" in response and
|
||||||
|
response["messages"][0]["code"] == TOO_MANY_SNAPS_ERROR):
|
||||||
|
raise exception.SnapshotLimitReached(
|
||||||
|
set_limit=MAX_SNAPS_IN_VTREE)
|
||||||
raise exception.VolumeBackendAPIException(data=msg)
|
raise exception.VolumeBackendAPIException(data=msg)
|
||||||
return response["id"]
|
return response["id"]
|
||||||
|
|
||||||
|
9
releasenotes/notes/bug-1962824-ff0cac0d35021f84.yaml
Normal file
9
releasenotes/notes/bug-1962824-ff0cac0d35021f84.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
PowerStore driver `bug #1962824
|
||||||
|
<https://bugs.launchpad.net/cinder/+bug/1962824>`_: Fixed Cinder
|
||||||
|
volume caching mechanism for the driver. Now the driver
|
||||||
|
correctly raises ``exception.SnapshotLimitReached`` when maximum
|
||||||
|
snapshots are created for a given volume and the volume cache is
|
||||||
|
invalidated to allow a new row of fast volume clones.
|
Loading…
Reference in New Issue
Block a user