SAN: Add missing driver options

Drivers can now report the configuration options that are relevant for
them with the `get_driver_options` method, but most of them are just
reporting their unique options and not the ones they share with other
drivers (ie: `san_ip`, `san_login`, `san_password`).

This patch adds additional options to SanDriver drivers so they return a
more meaningful list of options.

To help with this it adds a helper method called `_get_oslo_driver_opts`
which can return a list of oslo options from names.

This includes very common options such as `max_over_subscription_ratio`,
`reserved_percentage`, and `replication_device`, but doesn't include the
`volume_backend_name` configuration option, since that's common to ALL
Cinder drivers.

Change-Id: I0ba2bbf1b707f93081cad8fabcc8dafb7b7d67d2
This commit is contained in:
Gorka Eguileor 2020-03-18 16:33:19 +01:00
parent 3f3b7189db
commit 0f7f413c6b
12 changed files with 100 additions and 33 deletions

View File

@ -1929,6 +1929,12 @@ class BaseVD(object):
raise NotImplementedError()
@staticmethod
def _get_oslo_driver_opts(*cfg_names):
"""Return an oslo driver options list from argument string (names)."""
return [CONF.backend_defaults._group._opts[cfg_name]['opt']
for cfg_name in cfg_names]
@six.add_metaclass(abc.ABCMeta)
class CloneableImageVD(object):

View File

@ -137,9 +137,13 @@ class PowerMaxFCDriver(san.SanDriver, driver.FibreChannelDriver):
active_backend_id=self.active_backend_id)
self.zonemanager_lookup_service = fczm_utils.create_lookup_service()
@staticmethod
def get_driver_options():
return common.powermax_opts
@classmethod
def get_driver_options(cls):
additional_opts = cls._get_oslo_driver_opts(
'san_ip', 'san_login', 'san_password', 'driver_ssl_cert_verify',
'max_over_subscription_ratio', 'reserved_percentage',
'replication_device')
return common.powermax_opts + additional_opts
def check_for_setup_error(self):
pass

View File

@ -142,9 +142,14 @@ class PowerMaxISCSIDriver(san.SanISCSIDriver):
configuration=self.configuration,
active_backend_id=self.active_backend_id))
@staticmethod
def get_driver_options():
return common.powermax_opts
@classmethod
def get_driver_options(cls):
additional_opts = cls._get_oslo_driver_opts(
'san_ip', 'san_login', 'san_password', 'driver_ssl_cert_verify',
'max_over_subscription_ratio', 'reserved_percentage',
'replication_device', 'use_chap_auth', 'chap_username',
'chap_password')
return common.powermax_opts + additional_opts
def check_for_setup_error(self):
pass

View File

@ -446,9 +446,13 @@ class XtremIOVolumeDriver(san.SanDriver):
self._stats = {}
self.client = XtremIOClient3(self.configuration, self.cluster_id)
@staticmethod
def get_driver_options():
return XTREMIO_OPTS
@classmethod
def get_driver_options(cls):
additional_opts = cls._get_oslo_driver_opts(
'san_ip', 'san_login', 'san_password', 'driver_ssl_cert_verify',
'driver_ssl_cert_path', 'max_over_subscription_ratio',
'reserved_percentage')
return XTREMIO_OPTS + additional_opts
def _obj_from_result(self, res):
typ, idx = res['links'][0]['href'].split('/')[-2:]

View File

@ -58,6 +58,7 @@ from cinder.i18n import _
from cinder.objects import fields
from cinder import utils
from cinder.volume import configuration
from cinder.volume import driver
from cinder.volume import qos_specs
from cinder.volume import volume_types
from cinder.volume import volume_utils
@ -367,9 +368,14 @@ class HPE3PARCommon(object):
def get_version(self):
return self.VERSION
@staticmethod
def get_driver_options():
return hpe3par_opts
@classmethod
def get_driver_options(cls):
additional_opts = driver.BaseVD._get_oslo_driver_opts(
'san_ip', 'san_login', 'san_password', 'reserved_percentage',
'max_over_subscription_ratio', 'replication_device', 'target_port',
'san_ssh_port', 'ssh_conn_timeout', 'san_private_key',
'target_ip_address')
return hpe3par_opts + additional_opts
def check_flags(self, options, required_flags):
for flag in required_flags:

View File

@ -130,9 +130,15 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
self.configuration.append_config_values(infinidat_opts)
self._lookup_service = fczm_utils.create_lookup_service()
@staticmethod
def get_driver_options():
return infinidat_opts
@classmethod
def get_driver_options(cls):
additional_opts = cls._get_oslo_driver_opts(
'san_ip', 'san_login', 'san_password', 'use_chap_auth',
'chap_username', 'chap_password', 'san_thin_provision',
'use_multipath_for_image_xfer', 'enforce_multipath_for_image_xfer',
'num_volume_device_scan_tries', 'volume_dd_blocksize',
'max_over_subscription_ratio')
return infinidat_opts + additional_opts
def _setup_and_get_system_object(self, management_address, auth):
system = infinisdk.InfiniBox(management_address, auth=auth)

View File

@ -135,9 +135,12 @@ class KaminarioCinderDriver(cinder.volume.driver.ISCSIDriver):
k2_lock_sfx = self.configuration.safe_get('san_ip')
self.k2_lock_name = "%s-%s" % (K2_LOCK_PREFIX, k2_lock_sfx)
@staticmethod
def get_driver_options():
return kaminario_opts
@classmethod
def get_driver_options(cls):
additional_opts = cls._get_oslo_driver_opts(
'san_ip', 'san_login', 'san_password', 'replication_device',
'volume_dd_blocksize')
return kaminario_opts + additional_opts
@utils.trace
def check_for_setup_error(self):

View File

@ -112,9 +112,25 @@ class LVMVolumeDriver(driver.VolumeDriver):
self.protocol = self.target_driver.protocol
self._sparse_copy_volume = False
@staticmethod
def get_driver_options():
return volume_opts
@classmethod
def get_driver_options(cls):
# Imports required to have config options
from cinder.volume.targets import spdknvmf # noqa
additional_opts = cls._get_oslo_driver_opts(
'target_ip_address', 'target_helper', 'target_protocol',
'volume_clear', 'volume_clear_size', 'reserved_percentage',
'max_over_subscription_ratio', 'volume_dd_blocksize',
'target_prefix', 'volumes_dir', 'iscsi_secondary_ip_addresses',
'target_port',
'iscsi_write_cache', 'iscsi_target_flags', # TGT
'iet_conf', 'iscsi_iotype', # IET
'nvmet_port_id', # NVMET
'scst_target_iqn_name', 'scst_target_driver', # SCST
'spdk_rpc_ip', 'spdk_rpc_port', 'spdk_rpc_username', # SPDKNVMF
'spdk_rpc_password', 'spdk_max_queue_depth', # SPDKNVMF
)
return volume_opts + additional_opts
def _sizestr(self, size_in_g):
return '%sg' % size_in_g

View File

@ -219,9 +219,13 @@ class PureBaseVolumeDriver(san.SanDriver):
'platform': platform.platform()
}
@staticmethod
def get_driver_options():
return PURE_OPTS
@classmethod
def get_driver_options(cls):
additional_opts = cls._get_oslo_driver_opts(
'san_ip', 'driver_ssl_cert_verify', 'driver_ssl_cert_path',
'use_chap_auth', 'replication_device', 'reserved_percentage',
'max_over_subscription_ratio')
return PURE_OPTS + additional_opts
def parse_replication_configs(self):
self._replication_pg_name = (

View File

@ -106,9 +106,13 @@ class QnapISCSIDriver(san.SanISCSIDriver):
self.target_iqns = []
self.nasInfoCache = {}
@staticmethod
def get_driver_options():
return qnap_opts
@classmethod
def get_driver_options(cls):
additional_opts = cls._get_oslo_driver_opts(
'target_ip_address', 'san_login', 'san_password', 'use_chap_auth',
'chap_username', 'chap_password', 'driver_ssl_cert_verify',
'reserved_percentage')
return qnap_opts + additional_opts
def _check_config(self):
"""Ensure that the flags we care about are set."""

View File

@ -321,9 +321,13 @@ class SolidFireDriver(san.SanISCSIDriver):
except SolidFireAPIException:
pass
@staticmethod
def get_driver_options():
return sf_opts
@classmethod
def get_driver_options(cls):
additional_opts = cls._get_oslo_driver_opts(
'san_ip', 'san_login', 'san_password', 'driver_ssl_cert_verify',
'replication_device', 'reserved_percentage',
'max_over_subscription_ratio')
return sf_opts + additional_opts
def _init_vendor_properties(self):
properties = {}

View File

@ -44,9 +44,14 @@ class SynoISCSIDriver(driver.ISCSIDriver):
self.configuration.append_config_values(common.cinder_opts)
self.stats = {}
@staticmethod
def get_driver_options():
return common.cinder_opts
@classmethod
def get_driver_options(cls):
additional_opts = cls._get_oslo_driver_opts(
'target_ip_address', 'target_protocol', 'target_port',
'driver_use_ssl', 'use_chap_auth', 'chap_username',
'chap_password', 'iscsi_secondary_ip_addresses', 'target_prefix',
'reserved_percentage', 'max_over_subscription_ratio')
return common.cinder_opts + additional_opts
def do_setup(self, context):
self.common = common.SynoCommon(self.configuration, 'iscsi')