diff --git a/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_cmode.py b/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_cmode.py index e5552d729de..e9c835ffcf0 100644 --- a/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_cmode.py +++ b/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_cmode.py @@ -1262,6 +1262,22 @@ class NetAppCmodeNfsDriverTestCase(test.TestCase): fake.VOLUME, fake.IMAGE_FILE_ID, cache_result[0]) self.driver._post_clone_image.assert_called_once_with(fake.VOLUME) + def test_copy_from_cache_workflow_remote_location_no_copyoffload(self): + cache_result = [('ip1:/openstack', fake.IMAGE_FILE_ID), + ('ip2:/openstack', fake.IMAGE_FILE_ID), + ('ip3:/openstack', fake.IMAGE_FILE_ID)] + self.driver._find_image_location = mock.Mock(return_value=[ + cache_result[0], False]) + self.driver._copy_from_remote_cache = mock.Mock() + self.driver._post_clone_image = mock.Mock() + self.driver.configuration.netapp_copyoffload_tool_path = None + + copied = self.driver._copy_from_cache( + fake.VOLUME, fake.IMAGE_FILE_ID, cache_result) + + self.assertFalse(copied) + self.driver._copy_from_remote_cache.assert_not_called() + def test_copy_from_cache_workflow_local_location(self): local_share = '/share' cache_result = [ diff --git a/cinder/volume/drivers/netapp/dataontap/nfs_cmode.py b/cinder/volume/drivers/netapp/dataontap/nfs_cmode.py index 32d07b8501b..7a43bbb4d71 100644 --- a/cinder/volume/drivers/netapp/dataontap/nfs_cmode.py +++ b/cinder/volume/drivers/netapp/dataontap/nfs_cmode.py @@ -522,7 +522,8 @@ class NetAppCmodeNfsDriver(nfs_base.NetAppNfsDriver, LOG.debug("Copied image from cache to volume %s using " "cloning.", volume['id']) copied = True - elif cache_copy: + elif (cache_copy and + self.configuration.netapp_copyoffload_tool_path): self._copy_from_remote_cache(volume, image_id, cache_copy) copied = True diff --git a/releasenotes/notes/bug-1660927-netapp-no-copyoffload-77fc3cf4f2cf2335.yaml b/releasenotes/notes/bug-1660927-netapp-no-copyoffload-77fc3cf4f2cf2335.yaml new file mode 100644 index 00000000000..f65379f0bee --- /dev/null +++ b/releasenotes/notes/bug-1660927-netapp-no-copyoffload-77fc3cf4f2cf2335.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixed misleading error message when NetApp copyoffload tool is not in place + during image cloning.