[NetApp-ZAPI] Enabling snapshot creation for flexgroup pool

Currently, we don't have provision to create a snapshot for flexgroup pool
through ZAPI, with this change we will have the support for the same.
So after these changes, this is how it looks. For a FlexGroup pool, the
ZAPI operation uses the NFS generic driver. When it comes to REST, if the
ONTAP version is below 9.14, the operation depends on the NFS generic
driver. However, for ONTAP versions 9.14 and above, it relies on the ONTAP
file clone API.

Closes-Bug: #2119644

Change-Id: Iec73a2fd95716e30f18315759328423076d7c824
Signed-off-by: Saikumar Pulluri <saikumar1016@gmail.com>
(cherry picked from commit 2322ceb199)
This commit is contained in:
Saikumar Pulluri
2025-08-07 04:36:52 -04:00
parent 677cc07bb5
commit 8096fef821
4 changed files with 36 additions and 9 deletions

View File

@@ -367,12 +367,17 @@ class NetAppNfsDriverTestCase(test.TestCase):
fake.NFS_VOLUME,
fake.EXTRA_SPECS)
@ddt.data(True, False)
def test_create_snapshot(self, is_flexgroup):
@ddt.data((True, False),
(False, True),
(True, True),
(False, False))
@ddt.unpack
def test_create_snapshot(self, is_flexgroup,
is_flexgroup_clone_file_supported):
self.mock_object(self.driver, '_is_flexgroup',
return_value=is_flexgroup)
self.mock_object(self.driver, '_is_flexgroup_clone_file_supported',
return_value=not is_flexgroup)
return_value=is_flexgroup_clone_file_supported)
mock_clone_backing_file_for_volume = self.mock_object(
self.driver, '_clone_backing_file_for_volume')
mock_snap_flexgroup = self.mock_object(
@@ -380,7 +385,9 @@ class NetAppNfsDriverTestCase(test.TestCase):
self.driver.create_snapshot(fake.SNAPSHOT)
if is_flexgroup:
if (is_flexgroup and (self.driver.configuration.safe_get
('netapp_use_legacy_client') or
not is_flexgroup_clone_file_supported)):
mock_snap_flexgroup.assert_called_once_with(fake.SNAPSHOT)
mock_clone_backing_file_for_volume.assert_not_called()
else:

View File

@@ -140,7 +140,7 @@ class RestClient(object, metaclass=volume_utils.TraceWrapperMetaclass):
ontap_9_5 = ontap_version >= (9, 5)
ontap_9_6 = ontap_version >= (9, 6)
ontap_9_8 = ontap_version >= (9, 8)
ontap_9_9 = ontap_version >= (9, 9)
ontap_9_14 = ontap_version >= (9, 14)
nodes_info = self._get_cluster_nodes_info()
for node in nodes_info:
@@ -175,8 +175,10 @@ class RestClient(object, metaclass=volume_utils.TraceWrapperMetaclass):
self.features.add_feature('CLUSTER_PEER_POLICY', supported=ontap_9_0)
self.features.add_feature('FLEXVOL_ENCRYPTION', supported=ontap_9_0)
self.features.add_feature('FLEXGROUP', supported=ontap_9_8)
# Flex group file clone is supported for ONTAP 9.14 and above versions
# so updating this from 9.9 to 9.14.
self.features.add_feature('FLEXGROUP_CLONE_FILE',
supported=ontap_9_9)
supported=ontap_9_14)
self.features.add_feature('ADAPTIVE_QOS', supported=ontap_9_4)
self.features.add_feature('ADAPTIVE_QOS_BLOCK_SIZE',

View File

@@ -319,11 +319,15 @@ class NetAppNfsDriver(driver.ManageableVD,
def create_snapshot(self, snapshot):
"""Creates a snapshot.
For a FlexGroup pool, the operation relies on the NFS generic driver
because the ONTAP clone file is not supported by FlexGroup yet.
For a FlexGroup pool, the ZAPI operation uses the NFS generic
driver. When it comes to REST, if the ONTAP version is below
9.14, the operation depends on the NFS generic driver. However,
for ONTAP versions 9.14 and above, it relies on the ONTAP file
clone API.
"""
if (self._is_flexgroup(vol_id=snapshot['volume_id']) and
not self._is_flexgroup_clone_file_supported()):
(self.configuration.safe_get('netapp_use_legacy_client') or
not self._is_flexgroup_clone_file_supported())):
self._create_snapshot_for_flexgroup(snapshot)
else:
self._clone_backing_file_for_volume(snapshot['volume_name'],

View File

@@ -0,0 +1,14 @@
---
fixes:
- |
NetApp driver `bug #2119644
<https://bugs.launchpad.net/cinder/+bug/2119644>`_: Fixed
unable to create snapshots for Cinder volume that belongs
to FlexGroup pool.
features:
- |
The NetApp driver now supports creating snapshots for flexgroup pools
through ZAPI client and it utilizes the NFS generic driver. When it
comes to REST, if the ONTAP version is below 9.14, the operation
depends on the NFS generic driver. However, for ONTAP versions 9.14
and above, it relies on the ONTAP file clone API.