From f95cb40ee3a39872e71adaeeda1643f8b46694dc Mon Sep 17 00:00:00 2001 From: Maurice Escher Date: Thu, 5 May 2022 16:01:59 +0200 Subject: [PATCH] [NetApp] check snapshot presence after creation Introduce some extra safety by an additional guard. Losing a snapshot is never an option, this justifies an additional api call to the NetApp storage back end. Change-Id: Ibc21b6c72d76a3a804f67e66e7604b3d0be4373f Related-Bug: #1971710 --- .../drivers/netapp/dataontap/cluster_mode/lib_base.py | 4 ++++ ...p-check-snapshot-after-creation-1b59038a3a117c65.yaml | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 releasenotes/notes/netapp-check-snapshot-after-creation-1b59038a3a117c65.yaml diff --git a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py index 543aaba65c..0a35191c57 100644 --- a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py +++ b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py @@ -1750,6 +1750,10 @@ class NetAppCmodeFileStorageLibrary(object): snapshot_name = self._get_backend_snapshot_name(snapshot['id']) LOG.debug('Creating snapshot %s', snapshot_name) vserver_client.create_snapshot(share_name, snapshot_name) + if not vserver_client.snapshot_exists(snapshot_name, share_name): + raise exception.SnapshotResourceNotFound( + name=snapshot_name) + return {'provider_location': snapshot_name} def revert_to_snapshot(self, context, snapshot, share_server=None): diff --git a/releasenotes/notes/netapp-check-snapshot-after-creation-1b59038a3a117c65.yaml b/releasenotes/notes/netapp-check-snapshot-after-creation-1b59038a3a117c65.yaml new file mode 100644 index 0000000000..6fe112632e --- /dev/null +++ b/releasenotes/notes/netapp-check-snapshot-after-creation-1b59038a3a117c65.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + NetApp driver now checks after sending snapshot-create request that the + snapshot has been properly created. If snapshot is not checked, manila + assumes that working snapshot is available. But when user tries to access + the snapshot, request could fail. + `Launchpad bug 1971710 `_ + for more details.