Check NetApp SnapRestore license for pools
Added check to validate SnapRestore license for NetApp ONTAP pools before setting revert_to_snapshot_support to true/false for the respective pool. This was always set to True before. Change-Id: I4750d28c8acfe6d68a91e129e767c6e8607e6a75 Closes-Bug: #1678524
This commit is contained in:
parent
1ac6370943
commit
f333b88e25
@ -252,6 +252,14 @@ class NetAppCmodeFileStorageLibrary(object):
|
|||||||
else:
|
else:
|
||||||
return self._client.get_vserver_aggregate_capacities(aggregates)
|
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
|
@na_utils.trace
|
||||||
def _get_aggregate_node(self, aggregate_name):
|
def _get_aggregate_node(self, aggregate_name):
|
||||||
"""Get home node for the specified aggregate, or None."""
|
"""Get home node for the specified aggregate, or None."""
|
||||||
@ -323,6 +331,8 @@ class NetAppCmodeFileStorageLibrary(object):
|
|||||||
netapp_flexvol_encryption = self._cluster_info.get(
|
netapp_flexvol_encryption = self._cluster_info.get(
|
||||||
'nve_support', False)
|
'nve_support', False)
|
||||||
|
|
||||||
|
revert_to_snapshot_support = self._check_snaprestore_license()
|
||||||
|
|
||||||
for aggr_name in sorted(aggregates):
|
for aggr_name in sorted(aggregates):
|
||||||
|
|
||||||
reserved_percentage = self.configuration.reserved_share_percentage
|
reserved_percentage = self.configuration.reserved_share_percentage
|
||||||
@ -352,7 +362,7 @@ class NetAppCmodeFileStorageLibrary(object):
|
|||||||
'thin_provisioning': [True, False],
|
'thin_provisioning': [True, False],
|
||||||
'snapshot_support': True,
|
'snapshot_support': True,
|
||||||
'create_share_from_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.
|
# Add storage service catalog data.
|
||||||
|
@ -329,6 +329,22 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
|
|||||||
assert_called_once_with(fake.AGGREGATES))
|
assert_called_once_with(fake.AGGREGATES))
|
||||||
self.assertDictEqual(fake.AGGREGATE_CAPACITIES, result)
|
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):
|
def test_get_aggregate_node_cluster_creds(self):
|
||||||
|
|
||||||
self.library._have_cluster_creds = True
|
self.library._have_cluster_creds = True
|
||||||
@ -433,6 +449,9 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
|
|||||||
self.library._ssc_stats = fake.SSC_INFO
|
self.library._ssc_stats = fake.SSC_INFO
|
||||||
self.library._perf_library.get_node_utilization_for_pool = (
|
self.library._perf_library.get_node_utilization_for_pool = (
|
||||||
mock.Mock(side_effect=[30.0, 42.0]))
|
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',
|
result = self.library._get_pools(filter_function='filter',
|
||||||
goodness_function='goodness')
|
goodness_function='goodness')
|
||||||
@ -449,6 +468,9 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
|
|||||||
self.library._ssc_stats = fake.SSC_INFO_VSERVER_CREDS
|
self.library._ssc_stats = fake.SSC_INFO_VSERVER_CREDS
|
||||||
self.library._perf_library.get_node_utilization_for_pool = (
|
self.library._perf_library.get_node_utilization_for_pool = (
|
||||||
mock.Mock(side_effect=[50.0, 50.0]))
|
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()
|
result = self.library._get_pools()
|
||||||
|
|
||||||
|
@ -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