RBD: add support for revert-to-snapshot
We note here that although this operation is implemented in the Ceph backend, the Ceph docs indicate that it is inefficient and the preferred method of returning to a known previous state is to clone from a snapshot. However, this is properly a backend operation, and it does not make sense to try to do it better in the driver than it can be done on the backend. Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com> Implements: bp rbd-revert-to-snapshot Change-Id: If8a5eb3a03e18f9043ff29f7648234c9b46376a0
This commit is contained in:
parent
c2291bead4
commit
1a9518119c
@ -132,6 +132,11 @@
|
||||
vars:
|
||||
zuul_additional_subunit_dirs:
|
||||
- "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/cinderlib'].src_dir }}"
|
||||
devstack_local_conf:
|
||||
test-config:
|
||||
$TEMPEST_CONFIG:
|
||||
volume-feature-enabled:
|
||||
volume_revert: True
|
||||
|
||||
- job:
|
||||
name: cinder-grenade-dsvm-mn-sub-bak
|
||||
|
@ -960,6 +960,17 @@ class RBDTestCase(test.TestCase):
|
||||
self.assertTrue(proxy.unprotect_snap.called)
|
||||
self.assertFalse(proxy.remove_snap.called)
|
||||
|
||||
@common_mocks
|
||||
def test_snapshot_revert_use_temp_snapshot(self):
|
||||
self.assertFalse(self.driver.snapshot_revert_use_temp_snapshot())
|
||||
|
||||
@common_mocks
|
||||
def test_revert_to_snapshot(self):
|
||||
image = self.mock_proxy.return_value.__enter__.return_value
|
||||
self.driver.revert_to_snapshot(self.context, self.volume_a,
|
||||
self.snapshot)
|
||||
image.rollback_to_snap.assert_called_once_with(self.snapshot.name)
|
||||
|
||||
@common_mocks
|
||||
def test_get_children_info(self):
|
||||
volume = self.mock_proxy
|
||||
|
@ -1232,6 +1232,32 @@ class RBDDriver(driver.CloneableImageVD, driver.MigrateVD,
|
||||
LOG.info("Snapshot %s does not exist in backend.",
|
||||
snap_name)
|
||||
|
||||
def snapshot_revert_use_temp_snapshot(self):
|
||||
"""Disable the use of a temporary snapshot on revert."""
|
||||
return False
|
||||
|
||||
def revert_to_snapshot(self, context, volume, snapshot):
|
||||
"""Revert a volume to a given snapshot."""
|
||||
# NOTE(rosmaita): The Ceph documentation notes that this operation is
|
||||
# inefficient on the backend for large volumes, and that the preferred
|
||||
# method of returning to a pre-existing state in Ceph is to clone from
|
||||
# a snapshot.
|
||||
# So why don't we do something like that here?
|
||||
# (a) an end user can do the more efficient operation on their own if
|
||||
# they value speed over the convenience of reverting their existing
|
||||
# volume
|
||||
# (b) revert-to-snapshot is properly a backend operation, and should
|
||||
# be handled by the backend -- trying to "fake it" in this driver
|
||||
# is both dishonest and likely to cause subtle bugs
|
||||
# (c) the Ceph project undergoes continual improvement. It may be
|
||||
# the case that there are things an operator can do on the Ceph
|
||||
# side (for example, use BlueStore for the Ceph backend storage)
|
||||
# to improve the efficiency of this operation.
|
||||
# Thus, a motivated operator reading this is encouraged to consult
|
||||
# the Ceph documentation.
|
||||
with RBDVolumeProxy(self, volume.name) as image:
|
||||
image.rollback_to_snap(snapshot.name)
|
||||
|
||||
def _disable_replication(self, volume):
|
||||
"""Disable replication on the given volume."""
|
||||
vol_name = utils.convert_str(volume.name)
|
||||
|
@ -775,7 +775,7 @@ driver.nimble=missing
|
||||
driver.pure=missing
|
||||
driver.qnap=missing
|
||||
driver.quobyte=missing
|
||||
driver.rbd=missing
|
||||
driver.rbd=complete
|
||||
driver.seagate=missing
|
||||
driver.storpool=missing
|
||||
driver.synology=missing
|
||||
|
@ -0,0 +1,36 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
RBD driver: support added for reverting a volume to the most recent
|
||||
snapshot taken.
|
||||
|
||||
Please be aware of the following known issues with this operation
|
||||
and the Ceph storage backend:
|
||||
|
||||
* Rolling back a volume to a snapshot overwrites the current volume
|
||||
with the data from the snapshot, and the time it takes to complete
|
||||
this operation increases with the size of the volume.
|
||||
|
||||
It is faster to create a new volume from a snapshot. You may
|
||||
wish to recommend this option to your users whose use cases do not
|
||||
strictly require revert-to-snapshot.
|
||||
|
||||
* The efficiency of revert-to-snapshot is also dependent upon the
|
||||
Ceph storage backend in use, namely, whether or not BlueStore is
|
||||
being used in your Ceph installation.
|
||||
|
||||
Please consult the Ceph documentation for details.
|
||||
issues:
|
||||
- |
|
||||
RBD driver: There are some known issues concerning the revert-to-snapshot
|
||||
support added in this release.
|
||||
|
||||
* The time it takes to complete the revert-to-snapshot operation increases
|
||||
with the size of the volume. It is faster to create a new volume from
|
||||
a snapshot.
|
||||
|
||||
* The efficiency of revert-to-snapshot depends upon the Ceph storage
|
||||
backend in use, particularly whether or not BlueStore is being used
|
||||
in your Ceph installation.
|
||||
|
||||
Please consult the Ceph documentation for details.
|
Loading…
Reference in New Issue
Block a user