Merge "Add get_driver_options method"

This commit is contained in:
Zuul 2019-03-07 22:41:39 +00:00 committed by Gerrit Code Review
commit 9660f7010e
74 changed files with 425 additions and 25 deletions

View File

@ -194,6 +194,10 @@ class CephBackupDriver(driver.BackupDriver):
self._ceph_backup_pool = utils.convert_str(CONF.backup_ceph_pool)
self._ceph_backup_conf = utils.convert_str(CONF.backup_ceph_conf)
@staticmethod
def get_driver_options():
return service_opts
def _validate_string_args(self, *args):
"""Ensure all args are non-None and non-empty."""
return all(args)

View File

@ -181,6 +181,10 @@ class GoogleBackupDriver(chunkeddriver.ChunkedBackupDriver):
credentials=creds)
self.resumable = self.writer_chunk_size != -1
@staticmethod
def get_driver_options():
return gcsbackup_service_opts
def check_for_setup_error(self):
required_options = ('backup_gcs_bucket', 'backup_gcs_credential_file',
'backup_gcs_project_id')

View File

@ -55,6 +55,10 @@ class GlusterfsBackupDriver(posix.PosixBackupDriver):
super(GlusterfsBackupDriver, self).__init__(context,
backup_path=backup_path)
@staticmethod
def get_driver_options():
return glusterfsbackup_service_opts
def check_for_setup_error(self):
"""Raises error if any required configuration flag is missing."""
required_flags = ['glusterfs_backup_share']

View File

@ -87,6 +87,10 @@ class PosixBackupDriver(chunkeddriver.ChunkedBackupDriver):
raise exception.ConfigNotFound(path='backup_path')
LOG.debug("Using backup repository: %s", self.backup_path)
@staticmethod
def get_driver_options():
return posixbackup_service_opts
def update_container_name(self, backup, container):
if container is not None:
return container

View File

@ -158,6 +158,10 @@ class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver):
if context:
self.initialize()
@staticmethod
def get_driver_options():
return swiftbackup_service_opts
def initialize(self):
self.swift_attempts = CONF.backup_swift_retry_attempts
self.swift_backoff = CONF.backup_swift_retry_backoff

View File

@ -270,6 +270,10 @@ class TSMBackupDriver(driver.BackupDriver):
self.tsm_password = CONF.backup_tsm_password
self.volume_prefix = CONF.backup_tsm_volume_prefix
@staticmethod
def get_driver_options():
return tsm_opts
def check_for_setup_error(self):
required_flags = ['backup_share']
for flag in required_flags:

View File

@ -69,6 +69,7 @@ class DriverInfo(object):
self.version = getattr(cls, 'VERSION', None)
self.ci_wiki_name = getattr(cls, 'CI_WIKI_NAME', None)
self.supported = getattr(cls, 'SUPPORTED', True)
self.driver_options = cls.get_driver_options()
def __str__(self):
return self.class_name

View File

@ -562,6 +562,10 @@ class BaseVD(object):
def check_for_setup_error(self):
return
def get_driver_options():
"""Return the oslo_config options specific to the driver."""
return volume_opts
@abc.abstractmethod
def create_volume(self, volume):
"""Creates a volume.

View File

@ -94,6 +94,10 @@ class DataCoreVolumeDriver(driver.BaseVD):
self._api = None
self._default_volume_options = None
@staticmethod
def get_driver_options():
return datacore_opts
def do_setup(self, context):
"""Perform validations and establish connection to server.

View File

@ -126,6 +126,10 @@ 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
def check_for_setup_error(self):
pass

View File

@ -131,6 +131,10 @@ class PowerMaxISCSIDriver(san.SanISCSIDriver):
configuration=self.configuration,
active_backend_id=self.active_backend_id))
@staticmethod
def get_driver_options():
return common.powermax_opts
def check_for_setup_error(self):
pass

View File

@ -155,6 +155,10 @@ class PSSeriesISCSIDriver(san.SanISCSIDriver):
self._group_ip = None
self.sshpool = None
@staticmethod
def get_driver_options():
return eqlx_opts
def _get_output(self, chan):
out = ''
ending = '%s> ' % self.configuration.eqlx_group_name

View File

@ -110,6 +110,10 @@ class SCCommonDriver(driver.ManageableVD,
self.storage_protocol = 'iSCSI'
self.failback_timeout = 60
@staticmethod
def get_driver_options():
return common_opts
def _bytes_to_gb(self, spacestring):
"""Space is returned in a string like ...

View File

@ -145,7 +145,9 @@ SIO_MAX_OVERSUBSCRIPTION_RATIO = 10.0
class ScaleIODriver(driver.VolumeDriver):
"""Cinder ScaleIO Driver
ScaleIO Driver version history:
.. code-block:: none
ScaleIO Driver version history:
2.0.1: Added support for SIO 1.3x in addition to 2.0.x
2.0.2: Added consistency group support to generic volume groups
2.0.3: Added cache for storage pool and protection domains info
@ -232,6 +234,10 @@ class ScaleIODriver(driver.VolumeDriver):
'bandwidthLimit': None,
}
@staticmethod
def get_driver_options():
return scaleio_opts
def check_for_setup_error(self):
# make sure both domain name and id are not specified
if (self.configuration.sio_protection_domain_name

View File

@ -52,7 +52,9 @@ class UnityDriver(driver.ManageableVD,
driver.BaseVD):
"""Unity Driver.
Version history:
.. code-block:: none
Version history:
1.0.0 - Initial version
2.0.0 - Add thin clone support
3.0.0 - Add IPv6 support
@ -79,6 +81,10 @@ class UnityDriver(driver.ManageableVD,
self.protocol = adapter.PROTOCOL_ISCSI
self.adapter = adapter.ISCSIAdapter(self.VERSION)
@staticmethod
def get_driver_options():
return UNITY_OPTS
def do_setup(self, context):
self.adapter.do_setup(self, self.configuration)

View File

@ -99,6 +99,10 @@ class VNXDriver(driver.ManageableVD,
self.adapter = None
self._stats = {}
@staticmethod
def get_driver_options():
return common.VNX_OPTS
def do_setup(self, context):
if self.protocol == common.PROTOCOL_FC:
self.adapter = adapter.FCAdapter(self.configuration,

View File

@ -434,6 +434,10 @@ class XtremIOVolumeDriver(san.SanDriver):
self._stats = {}
self.client = XtremIOClient3(self.configuration, self.cluster_id)
@staticmethod
def get_driver_options():
return XTREMIO_OPTS
def _obj_from_result(self, res):
typ, idx = res['links'][0]['href'].split('/')[-2:]
return self.client.req(typ, idx=int(idx))['content']

View File

@ -185,6 +185,10 @@ class DrbdManageBaseDriver(driver.VolumeDriver):
CS_DISKLESS = dm_const.CSTATE_PREFIX + dm_const.FLAG_DISKLESS
CS_UPD_CON = dm_const.CSTATE_PREFIX + dm_const.FLAG_UPD_CON
@staticmethod
def get_driver_options():
return drbd_opts
def dbus_connect(self):
self.odm = dbus.SystemBus().get_object(self.drbdmanage_dbus_name,
self.drbdmanage_dbus_interface)

View File

@ -170,6 +170,10 @@ class FJDXCommon(object):
self.configuration.iscsi_ip_address = (
self._get_drvcfg('EternusISCSIIP'))
@staticmethod
def get_driver_options():
return FJ_ETERNUS_DX_OPT_opts
def create_volume(self, volume):
"""Create volume on ETERNUS."""
LOG.debug('create_volume, '

View File

@ -46,6 +46,10 @@ class FJDXFCDriver(driver.FibreChannelDriver):
configuration=self.configuration)
self.VERSION = self.common.VERSION
@staticmethod
def get_driver_options():
return eternus_dx_common.FJDXCommon.get_driver_options()
def check_for_setup_error(self):
if not self.common.pywbemAvailable:
LOG.error('pywbem could not be imported! '

View File

@ -45,6 +45,10 @@ class FJDXISCSIDriver(driver.ISCSIDriver):
configuration=self.configuration)
self.VERSION = self.common.VERSION
@staticmethod
def get_driver_options():
return eternus_dx_common.FJDXCommon.get_driver_options()
def check_for_setup_error(self):
if not self.common.pywbemAvailable:
LOG.error('pywbem could not be imported! '

View File

@ -119,6 +119,10 @@ class DSWAREDriver(driver.VolumeDriver):
self.conf = fs_conf.FusionStorageConf(self.configuration, self.host)
self.client = None
@staticmethod
def get_driver_options():
return volume_opts
def do_setup(self, context):
self.conf.update_config_value()
url_str = self.configuration.san_address

View File

@ -40,7 +40,10 @@ LOG = logging.getLogger(__name__)
class HedvigISCSIDriver(driver.ISCSIDriver, san.SanDriver):
"""OpenStack Cinder driver to enable Hedvig storage.
Version history:
.. code-block:: none
Version history:
1.0 - Initial driver
"""
@ -58,6 +61,10 @@ class HedvigISCSIDriver(driver.ISCSIDriver, san.SanDriver):
self.group_stats = {}
self.hrs = None
@staticmethod
def get_driver_options():
return []
def check_for_setup_error(self):
self.hrs.connect()
LOG.info("Initialization complete")

View File

@ -71,6 +71,10 @@ class HPE3PARDriverBase(driver.ManageableVD,
self.configuration.append_config_values(san.san_opts)
self.protocol = None
@staticmethod
def get_driver_options():
return hpecommon.HPE3PARCommon.get_driver_options()
def _init_common(self):
return hpecommon.HPE3PARCommon(self.configuration,
self._active_backend_id)

View File

@ -345,6 +345,10 @@ class HPE3PARCommon(object):
def get_version(self):
return self.VERSION
@staticmethod
def get_driver_options():
return hpe3par_opts
def check_flags(self, options, required_flags):
for flag in required_flags:
if not getattr(options, flag, None):

View File

@ -207,6 +207,10 @@ class HPELeftHandISCSIDriver(driver.ISCSIDriver):
self._replication_enabled = False
self._active_backend_id = kwargs.get('active_backend_id', None)
@staticmethod
def get_driver_options():
return hpelefthand_opts
def _login(self, timeout=None):
conf = self._get_lefthand_config()
if conf:

View File

@ -97,6 +97,10 @@ class HuaweiBaseDriver(driver.VolumeDriver):
self.metro_flag = False
self.replica = None
@staticmethod
def get_driver_options():
return huawei_opts
def check_func_support(self, obj_name):
try:
self.client._get_object_count(obj_name)

View File

@ -111,6 +111,10 @@ class FlashSystemDriver(san.SanDriver,
self._vdisk_copy_in_progress = set()
self._vdisk_copy_lock = None
@staticmethod
def get_driver_options():
return flashsystem_opts
def _ssh(self, ssh_cmd, check_exit_code=True):
try:
return self._run_ssh(ssh_cmd, check_exit_code)

View File

@ -146,12 +146,15 @@ class GPFSDriver(driver.CloneableImageVD,
driver.BaseVD):
"""Implements volume functions using GPFS primitives.
Version history:
1.0.0 - Initial driver
1.1.0 - Add volume retype, refactor volume migration
1.2.0 - Add consistency group support
1.3.0 - Add NFS based GPFS storage backend support
1.3.1 - Add GPFS native encryption (encryption of data at rest) support
.. code-block:: none
Version history:
1.0.0 - Initial driver
1.1.0 - Add volume retype, refactor volume migration
1.2.0 - Add consistency group support
1.3.0 - Add NFS based GPFS storage backend support
1.3.1 - Add GPFS native encryption (encryption of data at rest) support
"""
VERSION = "1.3.1"
@ -166,6 +169,10 @@ class GPFSDriver(driver.CloneableImageVD,
self._execute = utils.execute
self.GPFS_PATH = ''
@staticmethod
def get_driver_options():
return gpfs_opts
def _gpfs_local_execute(self, *cmd, **kwargs):
if 'run_as_root' not in kwargs:
kwargs.update({'run_as_root': True})
@ -1408,6 +1415,10 @@ class GPFSRemoteDriver(GPFSDriver, san.SanDriver):
self.gpfs_execute = self._gpfs_remote_execute
self.GPFS_PATH = '/usr/lpp/mmfs/bin/'
@staticmethod
def get_driver_options():
return gpfs_opts + gpfs_remote_ssh_opts
def _gpfs_remote_execute(self, *cmd, **kwargs):
check_exit_code = kwargs.pop('check_exit_code', None)
return self._run_ssh(cmd, check_exit_code)

View File

@ -115,6 +115,10 @@ class IBMStorageDriver(san.SanDriver,
active_backend_id=active_backend_id,
host=self.host)
@staticmethod
def get_driver_options():
return driver_opts
def do_setup(self, context):
"""Setup and verify connection to IBM Storage."""

View File

@ -109,6 +109,10 @@ class StorwizeSVCFCDriver(storwize_common.StorwizeSVCCommonDriver):
self.configuration.append_config_values(
storwize_svc_fc_opts)
@staticmethod
def get_driver_options():
return storwize_common.storwize_svc_opts + storwize_svc_fc_opts
def validate_connector(self, connector):
"""Check connector for at least one enabled FC protocol."""
if 'wwpns' not in connector:

View File

@ -109,6 +109,10 @@ class StorwizeSVCISCSIDriver(storwize_common.StorwizeSVCCommonDriver):
self.configuration.append_config_values(
storwize_svc_iscsi_opts)
@staticmethod
def get_driver_options():
return storwize_common.storwize_svc_opts + storwize_svc_iscsi_opts
def validate_connector(self, connector):
"""Check connector for at least one enabled iSCSI protocol."""
if 'initiator' not in connector:

View File

@ -132,6 +132,10 @@ 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
def _setup_and_get_system_object(self, management_address, auth):
system = infinisdk.InfiniBox(management_address, auth=auth)
system.api.add_auto_retry(

View File

@ -201,6 +201,10 @@ class AS13000Driver(san.SanISCSIDriver):
self.username,
self.password)
@staticmethod
def get_driver_options():
return inspur_as13000_opts
@utils.trace
def do_setup(self, context):
# get tokens for the driver

View File

@ -166,6 +166,10 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver):
# This is used to save the available pools in failed-over status
self._secondary_pools = None
@staticmethod
def get_driver_options():
return instorage_mcs_opts
@cinder_utils.trace
def do_setup(self, ctxt):
"""Check that we have all configuration details from the storage."""

View File

@ -126,6 +126,10 @@ 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
@utils.trace
def check_for_setup_error(self):
if krest is None:

View File

@ -33,7 +33,10 @@ utils.trace = common.utils.trace
class KaminarioISCSIDriver(common.KaminarioCinderDriver):
"""Kaminario K2 iSCSI Volume Driver.
Version history:
.. code-block:: none
Version history:
1.0 - Initial driver
1.1 - Added manage/unmanage and extra-specs support for nodedup
1.2 - Added replication support

View File

@ -44,5 +44,9 @@ class LenovoFCDriver(dothill_fc.DotHillFCDriver):
super(LenovoFCDriver, self).__init__(*args, **kwargs)
self.configuration.append_config_values(lenovo_common.common_opts)
@staticmethod
def get_driver_options():
return lenovo_common.common_opts
def _init_common(self):
return lenovo_common.LenovoCommon(self.configuration)

View File

@ -45,5 +45,9 @@ class LenovoISCSIDriver(dothill_iscsi.DotHillISCSIDriver):
self.configuration.append_config_values(lenovo_common.iscsi_opts)
self.iscsi_ips = self.configuration.lenovo_iscsi_ips
@staticmethod
def get_driver_options():
return lenovo_common.common_opts + lenovo_common.iscsi_opts
def _init_common(self):
return lenovo_common.LenovoCommon(self.configuration)

View File

@ -117,6 +117,10 @@ class LinstorBaseDriver(driver.VolumeDriver):
'volume_backend_name')
self.host_name = socket.gethostname()
@staticmethod
def get_driver_options():
return linstor_opts
def _ping(self):
with lin_drv(self.default_uri) as lin:
return lin.ping()

View File

@ -112,6 +112,10 @@ class LVMVolumeDriver(driver.VolumeDriver):
self.protocol = self.target_driver.protocol
self._sparse_copy_volume = False
@staticmethod
def get_driver_options():
return volume_opts
def _sizestr(self, size_in_g):
return '%sg' % size_in_g

View File

@ -18,6 +18,7 @@
from cinder import interface
from cinder.volume import driver
from cinder.volume.drivers.nec import volume_common
from cinder.volume.drivers.nec import volume_helper
from cinder.zonemanager import utils as fczm_utils
@ -35,6 +36,10 @@ class MStorageISCSIDriver(volume_helper.MStorageDSVDriver,
self._set_config(self.configuration, self.host,
self.__class__.__name__)
@staticmethod
def get_driver_options():
return volume_common.mstorage_opts
def create_export(self, context, volume, connector):
return self.iscsi_do_export(context, volume, connector)
@ -77,6 +82,10 @@ class MStorageFCDriver(volume_helper.MStorageDSVDriver,
self._set_config(self.configuration, self.host,
self.__class__.__name__)
@staticmethod
def get_driver_options():
return volume_common.mstorage_opts
def create_export(self, context, volume, connector):
return self.fc_do_export(context, volume, connector)

View File

@ -19,6 +19,7 @@ Volume driver for NetApp Data ONTAP FibreChannel storage systems.
from cinder import interface
from cinder.volume import driver
from cinder.volume.drivers.netapp.dataontap import block_cmode
from cinder.volume.drivers.netapp import options as na_opts
from cinder.zonemanager import utils as fczm_utils
@ -38,6 +39,10 @@ class NetAppCmodeFibreChannelDriver(driver.BaseVD,
self.library = block_cmode.NetAppBlockStorageCmodeLibrary(
self.DRIVER_NAME, 'FC', **kwargs)
@staticmethod
def get_driver_options():
return na_opts.netapp_cluster_opts
def do_setup(self, context):
self.library.do_setup(context)

View File

@ -19,6 +19,7 @@ Volume driver for NetApp Data ONTAP (C-mode) iSCSI storage systems.
from cinder import interface
from cinder.volume import driver
from cinder.volume.drivers.netapp.dataontap import block_cmode
from cinder.volume.drivers.netapp import options as na_opts
@interface.volumedriver
@ -37,6 +38,10 @@ class NetAppCmodeISCSIDriver(driver.BaseVD,
self.library = block_cmode.NetAppBlockStorageCmodeLibrary(
self.DRIVER_NAME, 'iSCSI', **kwargs)
@staticmethod
def get_driver_options():
return na_opts.netapp_cluster_opts
def do_setup(self, context):
self.library.do_setup(context)

View File

@ -91,6 +91,11 @@ class NexentaISCSIDriver(driver.ISCSIDriver):
self._needless_objects = set()
@staticmethod
def get_driver_options():
return (options.NEXENTA_CONNECTION_OPTS + options.NEXENTA_ISCSI_OPTS +
options.NEXENTA_DATASET_OPTS + options.NEXENTA_RRMGR_OPTS)
@property
def backend_name(self):
backend_name = None

View File

@ -33,7 +33,10 @@ LOG = logging.getLogger(__name__)
class NexentaEdgeISCSIDriver(driver.ISCSIDriver):
"""Executes volume driver commands on NexentaEdge cluster.
Version history:
.. code-block:: none
Version history:
1.0.0 - Initial driver version.
1.0.1 - Moved opts to options.py.
1.0.2 - Added HA support.
@ -98,6 +101,15 @@ class NexentaEdgeISCSIDriver(driver.ISCSIDriver):
nexenta_iscsi_target_portal_port)
self.ha_vip = None
@staticmethod
def get_driver_options():
return (
options.NEXENTA_CONNECTION_OPTS +
options.NEXENTA_ISCSI_OPTS +
options.NEXENTA_DATASET_OPTS +
options.NEXENTA_EDGE_OPTS
)
@property
def backend_name(self):
backend_name = None

View File

@ -94,6 +94,15 @@ class NexentaNfsDriver(nfs.NfsDriver): # pylint: disable=R0921
self.nfs_versions = {}
self.shares_with_capacities = {}
@staticmethod
def get_driver_options():
return (
options.NEXENTA_CONNECTION_OPTS +
options.NEXENTA_NFS_OPTS +
options.NEXENTA_DATASET_OPTS +
options.NEXENTA_RRMGR_OPTS
)
@property
def backend_name(self):
backend_name = None

View File

@ -82,6 +82,15 @@ class NexentaISCSIDriver(driver.ISCSIDriver):
self.iscsi_target_portal_port = (
self.configuration.nexenta_iscsi_target_portal_port)
@staticmethod
def get_driver_options():
return (
options.NEXENTA_CONNECTION_OPTS +
options.NEXENTA_ISCSI_OPTS +
options.NEXENTA_DATASET_OPTS +
options.NEXENTA_RRMGR_OPTS
)
@property
def backend_name(self):
backend_name = None

View File

@ -82,6 +82,14 @@ class NexentaNfsDriver(nfs.NfsDriver):
self.nef_user = self.configuration.nexenta_user
self.nef_password = self.configuration.nexenta_password
@staticmethod
def get_driver_options():
return (
options.NEXENTA_CONNECTION_OPTS +
options.NEXENTA_NFS_OPTS +
options.NEXENTA_DATASET_OPTS
)
@property
def backend_name(self):
backend_name = None

View File

@ -122,6 +122,10 @@ class NfsDriver(remotefs.RemoteFSSnapDriverDistributed):
self.configuration.max_over_subscription_ratio,
supports_auto=supports_auto_mosr))
@staticmethod
def get_driver_options():
return nfs_opts + remotefs.nas_opts
def initialize_connection(self, volume, connector):
LOG.debug('Initializing connection to volume %(vol)s. '

View File

@ -149,6 +149,10 @@ class NimbleBaseVolumeDriver(san.SanDriver):
if self.configuration.nimble_verify_certificate is True:
self.verify = self.configuration.nimble_verify_cert_path or True
@staticmethod
def get_driver_options():
return nimble_opts
def _check_config(self):
"""Ensure that the flags we care about are set."""
required_config = ['san_ip', 'san_login', 'san_password']

View File

@ -695,6 +695,10 @@ class DPLCOMMONDriver(driver.CloneableImageVD,
cert_path=cert_path)
self._stats = {}
@staticmethod
def get_driver_options():
return options.DPL_OPTS
def _convert_size_GB(self, size):
s = round(float(size) / units.Gi, 2)
if s > 0:

View File

@ -203,6 +203,10 @@ class PureBaseVolumeDriver(san.SanDriver):
'platform': platform.platform()
}
@staticmethod
def get_driver_options():
return PURE_OPTS
def parse_replication_configs(self):
self._replication_pg_name = (
self.configuration.pure_replication_pg_name)

View File

@ -63,7 +63,8 @@ CONF.register_opts(qnap_opts, group=configuration.SHARED_CONF_GROUP)
class QnapISCSIDriver(san.SanISCSIDriver):
"""QNAP iSCSI based cinder driver
.. code-block:: default
.. code-block:: none
Version History:
1.0.0:
@ -105,6 +106,10 @@ class QnapISCSIDriver(san.SanISCSIDriver):
self.target_iqns = []
self.nasInfoCache = {}
@staticmethod
def get_driver_options():
return qnap_opts
def _check_config(self):
"""Ensure that the flags we care about are set."""
LOG.debug('in _check_config')

View File

@ -96,7 +96,11 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed):
Note: To be compliant with the inherited RemoteFSSnapDriver, Quobyte
volumes are also referred to as shares.
Version history:
.. code-block:: none
Version history:
1.0 - Initial driver.
1.1 - Adds optional insecure NAS settings
1.1.1 - Removes getfattr calls from driver
@ -130,6 +134,10 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed):
# Used to manage snapshots which are currently attached to a VM.
self._nova = None
@staticmethod
def get_driver_options():
return volume_opts
def _create_regular_file(self, path, size):
"""Creates a regular file of given size in GiB using fallocate."""
self._fallocate_file(path, size)

View File

@ -243,6 +243,10 @@ class RBDDriver(driver.CloneableImageVD, driver.MigrateVD,
self._replication_targets = []
self._target_names = []
@staticmethod
def get_driver_options():
return RBD_OPTS
def _get_target_config(self, target_id):
"""Get a replication target from known replication targets."""
for target in self._replication_targets:

View File

@ -43,5 +43,9 @@ class HPMSAFCDriver(dothill_fc.DotHillFCDriver):
super(HPMSAFCDriver, self).__init__(*args, **kwargs)
self.configuration.append_config_values(hpmsa_common.common_opts)
@staticmethod
def get_driver_options():
return hpmsa_common.common_opts
def _init_common(self):
return hpmsa_common.HPMSACommon(self.configuration)

View File

@ -45,5 +45,9 @@ class HPMSAISCSIDriver(dothill_iscsi.DotHillISCSIDriver):
self.configuration.append_config_values(hpmsa_common.iscsi_opts)
self.iscsi_ips = self.configuration.hpmsa_iscsi_ips
@staticmethod
def get_driver_options():
return hpmsa_common.common_opts + hpmsa_common.iscsi_opts
def _init_common(self):
return hpmsa_common.HPMSACommon(self.configuration)

View File

@ -452,6 +452,10 @@ class SheepdogDriver(driver.VolumeDriver):
self.node_list = [addr]
self.client = SheepdogClient(self.node_list, self.port)
@staticmethod
def get_driver_options():
return sheepdog_opts
def check_for_setup_error(self):
"""Check cluster status and update node list."""
self.client.check_cluster_status()

View File

@ -292,6 +292,10 @@ class SolidFireDriver(san.SanISCSIDriver):
self._set_cluster_pairs()
@staticmethod
def get_driver_options():
return sf_opts
def __getattr__(self, attr):
if hasattr(self.target_driver, attr):
return getattr(self.target_driver, attr)

View File

@ -59,6 +59,10 @@ class SPDKDriver(driver.VolumeDriver):
db=self.db,
executor=self._execute)
@staticmethod
def get_driver_options():
return []
def _rpc_call(self, method, params=None):
payload = {}
payload['jsonrpc'] = '2.0'

View File

@ -99,6 +99,10 @@ class StorPoolDriver(driver.VolumeDriver):
self._ourIdInt = None
self._attach = None
@staticmethod
def get_driver_options():
return storpool_opts
def _backendException(self, e):
return exception.VolumeBackendAPIException(data=six.text_type(e))

View File

@ -27,7 +27,9 @@ LOG = logging.getLogger(__name__)
class SynoISCSIDriver(driver.ISCSIDriver):
"""OpenStack Cinder drivers for Synology storage.
Version history:
.. code-block:: none
Version history:
1.0.0 - Initial driver. Provide Cinder minimum features
"""
# ThirdPartySystems wiki page
@ -41,6 +43,10 @@ class SynoISCSIDriver(driver.ISCSIDriver):
self.configuration.append_config_values(common.cinder_opts)
self.stats = {}
@staticmethod
def get_driver_options():
return common.cinder_opts
def do_setup(self, context):
self.common = common.SynoCommon(self.configuration, 'iscsi')

View File

@ -69,6 +69,10 @@ class HyperScaleDriver(driver.VolumeDriver):
self.old_free = 0
self.my_dnid = None
@staticmethod
def get_driver_options():
return []
@staticmethod
def _fetch_config_for_controller():
return HyperScaleDriver._fetch_config_information(

View File

@ -74,7 +74,9 @@ class ACCESSIscsiDriver(driver.ISCSIDriver):
Executes commands relating to ACCESS ISCSI.
Supports creation of volumes on ACCESS.
API version history:
.. code-block:: none
API version history:
1.0 - Initial version.
"""
@ -124,6 +126,10 @@ class ACCESSIscsiDriver(driver.ISCSIDriver):
if verify_path:
self.verify = verify_path
@staticmethod
def get_driver_options():
return VA_VOL_OPTS
def do_setup(self, context):
"""Any initialization the volume driver does while starting."""
super(ACCESSIscsiDriver, self).do_setup(context)

View File

@ -293,6 +293,10 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
self._dc_cache = {}
self._ds_regex = None
@staticmethod
def get_driver_options():
return vmdk_opts
@property
def volumeops(self):
return self._volumeops

View File

@ -126,7 +126,9 @@ class VZStorageDriver(remotefs_drv.RemoteFSSnapDriver):
Creates volumes as files on the mounted vzstorage cluster.
Version history:
.. code-block:: none
Version history:
1.0 - Initial driver.
1.1 - Supports vz:volume_format in vendor properties.
"""
@ -153,6 +155,10 @@ class VZStorageDriver(remotefs_drv.RemoteFSSnapDriver):
vzstorage_mount_point_base=self.base,
vzstorage_mount_options=opts)
@staticmethod
def get_driver_options():
return vzstorage_opts
def _update_volume_stats(self):
super(VZStorageDriver, self)._update_volume_stats()
self._stats['vendor_name'] = 'Virtuozzo'

View File

@ -67,6 +67,10 @@ class WindowsISCSIDriver(driver.ISCSIDriver):
self._tgt_utils = utilsfactory.get_iscsi_target_utils()
self._hostutils = utilsfactory.get_hostutils()
@staticmethod
def get_driver_options():
return windows_opts
def do_setup(self, context):
"""Setup the Windows Volume driver.

View File

@ -124,6 +124,10 @@ class WindowsSmbfsDriver(remotefs_drv.RevertToSnapshotMixin,
self._thin_provisioning_support = thin_enabled
self._thick_provisioning_support = not thin_enabled
@staticmethod
def get_driver_options():
return volume_opts
def do_setup(self, context):
self._check_os_platform()

View File

@ -285,7 +285,9 @@ class ZadaraVPSAConnection(object):
class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
"""Zadara VPSA iSCSI/iSER volume driver.
Version history:
.. code-block:: none
Version history:
15.07 - Initial driver
16.05 - Move from httplib to requests
"""
@ -299,6 +301,10 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
super(ZadaraVPSAISCSIDriver, self).__init__(*args, **kwargs)
self.configuration.append_config_values(zadara_opts)
@staticmethod
def get_driver_options():
return zadara_opts
def do_setup(self, context):
"""Any initialization the volume driver does while starting.

View File

@ -140,6 +140,10 @@ class ZFSSAISCSIDriver(driver.ISCSIDriver):
self._stats = None
self.tgtiqn = None
@staticmethod
def get_driver_options():
return ZFSSA_OPTS
def _get_target_alias(self):
"""return target alias."""
return self.configuration.zfssa_target_group

View File

@ -65,7 +65,9 @@ class BrcdFCZoneDriver(fc_zone_driver.FCZoneDriver):
OpenStack Fibre Channel zone driver to manage FC zoning in
Brocade SAN fabrics.
Version history:
.. code-block:: none
Version history:
1.0 - Initial Brocade FC zone driver
1.1 - Implements performance enhancements
1.2 - Added support for friendly zone name
@ -111,6 +113,10 @@ class BrcdFCZoneDriver(fc_zone_driver.FCZoneDriver):
self.fabric_configs = fabric_opts.load_fabric_configurations(
fabric_names)
@staticmethod
def get_driver_options():
return brcd_opts
@lockutils.synchronized('brcd', 'fcfabric-', True)
def add_connection(self, fabric, initiator_target_map, host_name=None,
storage_system=None):

View File

@ -65,7 +65,9 @@ class CiscoFCZoneDriver(fc_zone_driver.FCZoneDriver):
OpenStack Fibre Channel zone driver to manage FC zoning in
Cisco SAN fabrics.
Version history:
.. code-block:: none
Version history:
1.0 - Initial Cisco FC zone driver
1.1 - Added friendly zone name support
"""
@ -118,6 +120,10 @@ class CiscoFCZoneDriver(fc_zone_driver.FCZoneDriver):
self.fabric_configs = fabric_opts.load_fabric_configurations(
fabric_names)
@staticmethod
def get_driver_options():
return cisco_opts
@lockutils.synchronized('cisco', 'fcfabric-', True)
def add_connection(self, fabric, initiator_target_map, host_name=None,
storage_system=None):

View File

@ -15,6 +15,7 @@
"""Generate list of Cinder drivers"""
import argparse
import operator
import os
import json
import textwrap
@ -73,19 +74,56 @@ def format_description(desc, output):
output.write('')
output.write(textwrap.dedent('\n'.join(lines[1:])))
def print_drivers(drivers, config_name, output):
for driver in sorted(drivers, key=lambda x: x.class_fqn):
driver_name = driver.class_name
def format_options(driver_options, output):
if driver_options and len(driver_options) > 0:
output.write('* Driver Configuration Options:')
output.write('')
output.write('.. list-table:: **Driver configuration options**')
output.write(' :header-rows: 1')
output.write(' :widths: 14 30')
output.write('')
output.write(' * - Name = Default Value')
output.write(' - (Type) Description')
sorted_options = sorted(driver_options,
key=operator.attrgetter('name'))
for opt in sorted_options:
output.write(' * - %s = %s' %
(opt.name, opt.default))
output.write(' - (%s) %s' % (opt.type, opt.help))
output.write('')
def filter_drivers(drivers):
'''This filters all of the drivers into separate lists.'''
supported_drivers = []
unsupported_drivers = []
for driver in drivers:
if not driver.supported:
unsupported_drivers.append(driver)
else:
supported_drivers.append(driver)
return supported_drivers, unsupported_drivers
def print_drivers(drivers, config_name, output, section_char='-',
display_unsupported=True):
for driver in sorted(drivers, key=lambda x: x.class_name):
driver_name = driver.class_name
if not driver.supported and display_unsupported:
driver_name += " (unsupported)"
output.write(driver_name)
output.write('-' * len(driver_name))
output.write(section_char * len(driver_name))
if driver.version:
output.write('* Version: %s' % driver.version)
output.write('* %s=%s' % (config_name, driver.class_fqn))
if driver.ci_wiki_name and 'Cinder_Jenkins' not in driver.ci_wiki_name:
output.write('* CI info: %s%s' % (CI_WIKI_ROOT,
driver.ci_wiki_name))
format_options(driver.driver_options, output)
format_description(driver.desc, output)
output.write('')
output.write('')
@ -95,7 +133,18 @@ def output_str(cinder_root, args):
with Output(cinder_root, args.output_list) as output:
output.write('Volume Drivers')
output.write('==============')
print_drivers(util.get_volume_drivers(), 'volume_driver', output)
supported_drivers, unsupported_drivers = filter_drivers(
util.get_volume_drivers())
output.write('Supported Drivers')
output.write('-----------------')
output.write('')
print_drivers(supported_drivers, 'volume_driver', output, '~')
output.write('Unsupported Drivers')
output.write('-------------------')
output.write('')
print_drivers(unsupported_drivers, 'volume_driver', output, '~')
output.write('Backup Drivers')
output.write('==============')
@ -114,7 +163,9 @@ def collect_driver_info(driver):
'fqn': driver.class_fqn,
'description': driver.desc,
'ci_wiki_name': driver.ci_wiki_name,
'supported': driver.supported}
'supported': driver.supported,
'options': driver.driver_options,
}
return info