Improve snapshot handling in K2
In creating snapshot, we use "Best Effort" retention policy. In this policy snapshot may be deleted in case capacity is running out, causing an inconsistency between K2 state and cinder DB. In order to avoid this inconsistency, add "is_auto_deleteable=False" to the snapshot properties, in order to avoid auto deleting the snapshot. Closes-Bug: #1608488 Change-Id: I70f770ce42ff56314b893a48ff7ed1a46a4ae55f
This commit is contained in:
parent
ed39bfec99
commit
7e10619e6a
@ -157,8 +157,16 @@ class TestKaminarioISCSI(test.TestCase):
|
||||
|
||||
def test_create_snapshot(self):
|
||||
"""Test create_snapshot."""
|
||||
self.snap.id = "253b2878-ec60-4793-ad19-e65496ec7aab"
|
||||
self.driver.client.new = mock.Mock()
|
||||
result = self.driver.create_snapshot(self.snap)
|
||||
self.assertIsNone(result)
|
||||
fake_object = self.driver.client.search().hits[0]
|
||||
self.driver.client.new.assert_called_once_with(
|
||||
"snapshots",
|
||||
short_name='cs-253b2878-ec60-4793-ad19-e65496ec7aab',
|
||||
source=fake_object, retention_policy=fake_object,
|
||||
is_auto_deleteable=False)
|
||||
|
||||
def test_create_snapshot_with_exception(self):
|
||||
"""Test create_snapshot_with_exception."""
|
||||
|
@ -495,7 +495,8 @@ class KaminarioCinderDriver(cinder.volume.driver.ISCSIDriver):
|
||||
LOG.debug("Creating a snapshot: %(snap)s from vg: %(vg)s",
|
||||
{'snap': snap_name, 'vg': vg_name})
|
||||
self.client.new("snapshots", short_name=snap_name,
|
||||
source=vg, retention_policy=rpolicy).save()
|
||||
source=vg, retention_policy=rpolicy,
|
||||
is_auto_deleteable=False).save()
|
||||
except Exception as ex:
|
||||
LOG.exception(_LE("Creation of snapshot: %s failed."), snap_name)
|
||||
raise exception.KaminarioCinderDriverException(
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- Add "is_auto_deleteable=False" to the snapshot properties
|
||||
in Kaminario K2 iSCSI and FC Cinder drivers, in order to
|
||||
avoid auto deleting the snapshot.
|
||||
|
Loading…
Reference in New Issue
Block a user