summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhoami-rajat <rajatdhasmana@gmail.com>2021-10-05 01:43:18 -0400
committerLuigi Toscano <ltoscano@redhat.com>2022-09-29 14:23:04 +0200
commitebc27d371450dccbba49443ab9094484a4f9905c (patch)
tree39590edf4240657e62af2cf90c599125706541c3
parent70164132dcc590c944fee36c58e93056a3447142 (diff)
downloadcinder-ebc27d371450dccbba49443ab9094484a4f9905c.tar.gz
NFS: Fix generic revert to snapshot flowwallaby-em18.2.1
While reverting to a snapshot with generic flow, we create a temporary volume from snapshot and copy data from temporary to the original volume. While creating this temporary volume, the snapshot is in 'restoring' state whereas the remotefs driver only accepts 'available' and 'backing-up' states for this operation. This patch adds the 'restoring' state to the list of acceptable states. Closes-Bug: 1946059 Change-Id: Id1e40fd42b88c63dbbba2aaae77c40660ddac4c7 (cherry picked from commit 862edca0deb366ea980485359216fea020a03c9e) (cherry picked from commit 1dc950b826acdab740cbcfbe119c0c31a9833a07) (cherry picked from commit d941ad28f5834bdb3c1413ca03046ac7bcf2c5fd)
-rw-r--r--cinder/tests/unit/volume/drivers/test_nfs.py6
-rw-r--r--cinder/volume/drivers/remotefs.py2
-rw-r--r--releasenotes/notes/fix-nfs-revert-to-snap-adc04204b3661d66.yaml6
3 files changed, 11 insertions, 3 deletions
diff --git a/cinder/tests/unit/volume/drivers/test_nfs.py b/cinder/tests/unit/volume/drivers/test_nfs.py
index fb3481f43..ad80fc11c 100644
--- a/cinder/tests/unit/volume/drivers/test_nfs.py
+++ b/cinder/tests/unit/volume/drivers/test_nfs.py
@@ -1367,8 +1367,10 @@ class NfsDriverTestCase(test.TestCase):
@ddt.data([NFS_CONFIG1, QEMU_IMG_INFO_OUT3, 'available'],
[NFS_CONFIG2, QEMU_IMG_INFO_OUT4, 'backing-up'],
+ [NFS_CONFIG2, QEMU_IMG_INFO_OUT4, 'restoring'],
[NFS_CONFIG3, QEMU_IMG_INFO_OUT3, 'available'],
- [NFS_CONFIG4, QEMU_IMG_INFO_OUT4, 'backing-up'])
+ [NFS_CONFIG4, QEMU_IMG_INFO_OUT4, 'backing-up'],
+ [NFS_CONFIG4, QEMU_IMG_INFO_OUT4, 'restoring'])
@ddt.unpack
@mock.patch('cinder.objects.volume.Volume.save')
def test_create_volume_from_snapshot(self, nfs_conf, qemu_img_info,
@@ -1433,7 +1435,7 @@ class NfsDriverTestCase(test.TestCase):
mock_find_share.assert_called_once_with(new_volume)
@ddt.data('error', 'creating', 'deleting', 'deleted', 'updating',
- 'error_deleting', 'unmanaging', 'restoring')
+ 'error_deleting', 'unmanaging')
def test_create_volume_from_snapshot_invalid_status(self, snap_status):
"""Expect an error when the snapshot's status is not 'available'."""
self._set_driver()
diff --git a/cinder/volume/drivers/remotefs.py b/cinder/volume/drivers/remotefs.py
index b5b2d49ca..2d662407e 100644
--- a/cinder/volume/drivers/remotefs.py
+++ b/cinder/volume/drivers/remotefs.py
@@ -1393,7 +1393,7 @@ class RemoteFSSnapDriverBase(RemoteFSDriver):
{'vol': volume.id, 'snap': snapshot.id})
status = snapshot.status
- acceptable_states = ['available', 'backing-up']
+ acceptable_states = ['available', 'backing-up', 'restoring']
self._validate_state(status, acceptable_states,
obj_description='snapshot',
invalid_exc=exception.InvalidSnapshot)
diff --git a/releasenotes/notes/fix-nfs-revert-to-snap-adc04204b3661d66.yaml b/releasenotes/notes/fix-nfs-revert-to-snap-adc04204b3661d66.yaml
new file mode 100644
index 000000000..dd9865f50
--- /dev/null
+++ b/releasenotes/notes/fix-nfs-revert-to-snap-adc04204b3661d66.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+ - |
+ NFS driver `bug #1946059
+ <https://bugs.launchpad.net/cinder/+bug/1946059>`_: Fixed
+ revert to snapshot operation.