Merge "Check NetApp SnapRestore license for pools"
This commit is contained in:
commit
5cadc54e6a
manila
share/drivers/netapp/dataontap/cluster_mode
tests/share/drivers/netapp/dataontap/cluster_mode
releasenotes/notes
@ -252,6 +252,14 @@ class NetAppCmodeFileStorageLibrary(object):
|
||||
else:
|
||||
return self._client.get_vserver_aggregate_capacities(aggregates)
|
||||
|
||||
@na_utils.trace
|
||||
def _check_snaprestore_license(self):
|
||||
"""Check if snaprestore license is enabled."""
|
||||
if not self._licenses:
|
||||
self._licenses = self._client.get_licenses()
|
||||
|
||||
return 'snaprestore' in self._licenses
|
||||
|
||||
@na_utils.trace
|
||||
def _get_aggregate_node(self, aggregate_name):
|
||||
"""Get home node for the specified aggregate, or None."""
|
||||
@ -323,6 +331,8 @@ class NetAppCmodeFileStorageLibrary(object):
|
||||
netapp_flexvol_encryption = self._cluster_info.get(
|
||||
'nve_support', False)
|
||||
|
||||
revert_to_snapshot_support = self._check_snaprestore_license()
|
||||
|
||||
for aggr_name in sorted(aggregates):
|
||||
|
||||
reserved_percentage = self.configuration.reserved_share_percentage
|
||||
@ -352,7 +362,7 @@ class NetAppCmodeFileStorageLibrary(object):
|
||||
'thin_provisioning': [True, False],
|
||||
'snapshot_support': True,
|
||||
'create_share_from_snapshot_support': True,
|
||||
'revert_to_snapshot_support': True,
|
||||
'revert_to_snapshot_support': revert_to_snapshot_support,
|
||||
}
|
||||
|
||||
# Add storage service catalog data.
|
||||
|
@ -329,6 +329,22 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
|
||||
assert_called_once_with(fake.AGGREGATES))
|
||||
self.assertDictEqual(fake.AGGREGATE_CAPACITIES, result)
|
||||
|
||||
def test_check_snaprestore_license_notfound(self):
|
||||
licenses = list(fake.LICENSES)
|
||||
licenses.remove('snaprestore')
|
||||
self.mock_object(self.client,
|
||||
'get_licenses',
|
||||
mock.Mock(return_value=licenses))
|
||||
result = self.library._check_snaprestore_license()
|
||||
self.assertIs(False, result)
|
||||
|
||||
def test_check_snaprestore_license_found(self):
|
||||
self.mock_object(self.client,
|
||||
'get_licenses',
|
||||
mock.Mock(return_value=fake.LICENSES))
|
||||
result = self.library._check_snaprestore_license()
|
||||
self.assertIs(True, result)
|
||||
|
||||
def test_get_aggregate_node_cluster_creds(self):
|
||||
|
||||
self.library._have_cluster_creds = True
|
||||
@ -433,6 +449,9 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
|
||||
self.library._ssc_stats = fake.SSC_INFO
|
||||
self.library._perf_library.get_node_utilization_for_pool = (
|
||||
mock.Mock(side_effect=[30.0, 42.0]))
|
||||
self.mock_object(self.library,
|
||||
'_check_snaprestore_license',
|
||||
mock.Mock(return_value=True))
|
||||
|
||||
result = self.library._get_pools(filter_function='filter',
|
||||
goodness_function='goodness')
|
||||
@ -449,6 +468,9 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
|
||||
self.library._ssc_stats = fake.SSC_INFO_VSERVER_CREDS
|
||||
self.library._perf_library.get_node_utilization_for_pool = (
|
||||
mock.Mock(side_effect=[50.0, 50.0]))
|
||||
self.mock_object(self.library,
|
||||
'_check_snaprestore_license',
|
||||
mock.Mock(return_value=True))
|
||||
|
||||
result = self.library._get_pools()
|
||||
|
||||
|
5
releasenotes/notes/bug-1678524-check-snaprestore-license-for-snapshot-revert-6d32afdc5d0b2b51.yaml
Normal file
5
releasenotes/notes/bug-1678524-check-snaprestore-license-for-snapshot-revert-6d32afdc5d0b2b51.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- The NetApp ONTAP driver is now fixed to set
|
||||
revert_to_snapshot_support to True or False
|
||||
depending upon SnapRestore License.
|
Loading…
x
Reference in New Issue
Block a user