diff --git a/cinder/tests/unit/volume/drivers/test_remotefs.py b/cinder/tests/unit/volume/drivers/test_remotefs.py index 372a0e3b160..39e51ae58a3 100644 --- a/cinder/tests/unit/volume/drivers/test_remotefs.py +++ b/cinder/tests/unit/volume/drivers/test_remotefs.py @@ -280,7 +280,9 @@ class RemoteFsSnapDriverTestCase(test.TestCase): exp_acceptable_states = ['available', 'in-use', 'backing-up'] if tmp_snap: exp_acceptable_states.append('downloading') - self._fake_snapshot.id = 'tmp-snap-%s' % self._fake_snapshot.id + self._fake_snapshot.volume.status = 'downloading' + display_name = 'tmp-snap-%s' % self._fake_snapshot.id + self._fake_snapshot.display_name = display_name if volume_in_use: self._fake_snapshot.volume.status = 'backing-up' @@ -315,6 +317,9 @@ class RemoteFsSnapDriverTestCase(test.TestCase): self._driver._create_snapshot, self._fake_snapshot) + def test_create_snapshot_w_image_caching(self): + self._test_create_snapshot(tmp_snap=True) + @mock.patch('cinder.db.snapshot_get') @mock.patch('time.sleep') def test_create_snapshot_online_with_concurrent_delete( diff --git a/cinder/volume/drivers/remotefs.py b/cinder/volume/drivers/remotefs.py index 0d4971cd19a..83b67cba6ef 100644 --- a/cinder/volume/drivers/remotefs.py +++ b/cinder/volume/drivers/remotefs.py @@ -1440,7 +1440,7 @@ class RemoteFSSnapDriverBase(RemoteFSDriver): status = snapshot.volume.status acceptable_states = ['available', 'in-use', 'backing-up'] - if snapshot.id.startswith('tmp-snap-'): + if snapshot.display_name.startswith('tmp-snap-'): # This is an internal volume snapshot. In order to support # image caching, we'll allow creating/deleting such snapshots # while having volumes in 'downloading' state. diff --git a/releasenotes/notes/bug-1875570-nfs-image-volume-cache-c45e840a6ec2a702.yaml b/releasenotes/notes/bug-1875570-nfs-image-volume-cache-c45e840a6ec2a702.yaml new file mode 100644 index 00000000000..041be005011 --- /dev/null +++ b/releasenotes/notes/bug-1875570-nfs-image-volume-cache-c45e840a6ec2a702.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + `Bug #1875570 `: + Fixed issue with NFS backend where the image-volume cache was + never used to create a volume, even when the cache was enabled.