Merge pull request #6 from rodrigogansobarbieri/netapp_config_fix

Remove cluster config option and comments, fix pep8 issues
This commit is contained in:
Luciano Lo Giudice 2021-10-01 15:42:12 -03:00 committed by GitHub
commit 214654971e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 26 deletions

View File

@ -3,11 +3,6 @@
"type": "string"
"default": "cinder_netapp"
"description": "Service name to present to Cinder"
"cluster-cinder-volume":
"type": "boolean"
"default": !!bool "false"
"description": |
Whether to handle all cinder-volume services as a cluster.
"netapp-storage-family":
"type": "string"
"default": "ontap_cluster"

View File

@ -26,9 +26,7 @@ class CinderNetAppCharm(
release = 'ocata'
packages = []
release_pkg = 'cinder-common'
# iscsi is stateful, fibre channel can be either stateful or stateless,
# nfs is stateless. Regardless, the driver may not cope well with
# cinder-volume service clustering, so let's allow it to be configurable
# The cinder-netapp driver currently does not support ACTIVE-ACTIVE
stateless = False
# Specify any config that the user *must* set.
mandatory_config = [
@ -39,12 +37,6 @@ class CinderNetAppCharm(
cget = self.config.get
service = cget('volume-backend-name')
# Regardless of stateless or stateful what we really want is whether
# to configure cinder volume services as a cluster. This can be done
# in different ways and for different reasons, ideally this
# variable passed through relation should be renamed.
self.stateless = cget('cluster-cinder-volume')
volumedriver = 'cinder.volume.drivers.netapp.common.NetAppDriver'
driver_options_extension = []
driver_transport = []
@ -76,9 +68,11 @@ class CinderNetAppCharm(
('nfs_shares_config', cget('netapp-nfs-shares-config'))]
if cget('netapp-storage-protocol') in ("iscsi", "fc"):
lun_space_reservation = cget(
'netapp-lun-space-reservation')
lun_space_reservation = 'enabled' if lun_space_reservation is True else 'disabled'
lun_space_reservation = cget('netapp-lun-space-reservation')
if lun_space_reservation is True:
lun_space_reservation = 'enabled'
else:
lun_space_reservation = 'disabled'
driver_options_extension += [
('netapp_pool_name_search_pattern', cget(
'netapp-pool-name-search-pattern')),

View File

@ -49,11 +49,6 @@ class TestCinderNetAppCharm(test_utils.PatchHelper):
self.assertEqual(config.get('volume_driver'),
'cinder.volume.drivers.netapp.common.NetAppDriver')
def test_cinder_cluster_config(self):
charm = self._patch_config_and_charm({'cluster-cinder-volume': True})
charm.cinder_configuration()
self.assertTrue(charm.stateless)
def test_cinder_https(self):
charm = self._patch_config_and_charm({'netapp-server-port': 443})
config = charm.cinder_configuration()
@ -91,9 +86,9 @@ class TestCinderNetAppCharm(test_utils.PatchHelper):
charm = self._patch_config_and_charm(econfig)
config = charm.cinder_configuration()
self.assertIn(('netapp_pool_name_search_pattern',
econfig['netapp-pool-name-search-pattern']), config)
econfig['netapp-pool-name-search-pattern']), config)
self.assertIn(('netapp_lun_space_reservation',
'enabled'), config)
'enabled'), config)
def test_cinder_fc_options(self):
econfig = {'netapp-pool-name-search-pattern': 'foo.*bar',
@ -102,9 +97,9 @@ class TestCinderNetAppCharm(test_utils.PatchHelper):
charm = self._patch_config_and_charm(econfig)
config = charm.cinder_configuration()
self.assertIn(('netapp_pool_name_search_pattern',
econfig['netapp-pool-name-search-pattern']), config)
econfig['netapp-pool-name-search-pattern']), config)
self.assertIn(('netapp_lun_space_reservation',
'enabled'), config)
'enabled'), config)
def test_cinder_iscsi_fc_options_not_included(self):
econfig = {'netapp-pool-name-search-pattern': 'foo.*bar',