Merge "Fix get_driver_options"
This commit is contained in:
commit
9f7ef27b2a
59
cinder/tests/unit/test_interface.py
Normal file
59
cinder/tests/unit/test_interface.py
Normal file
@ -0,0 +1,59 @@
|
||||
# Copyright (c) 2019, Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
|
||||
from cinder.interface import util
|
||||
from cinder import test
|
||||
|
||||
|
||||
class GetDriversTestCase(test.TestCase):
|
||||
def test_get_volume_drivers(self):
|
||||
# Just ensure that it doesn't raise an exception
|
||||
drivers = util.get_volume_drivers()
|
||||
self.assertNotEqual(0, len(drivers))
|
||||
for driver in drivers:
|
||||
self.assertIsInstance(driver, util.DriverInfo)
|
||||
|
||||
@mock.patch('cinder.volume.drivers.lvm.LVMVolumeDriver.get_driver_options')
|
||||
def test_get_volume_drivers_fail(self, driver_opt):
|
||||
driver_opt.side_effect = ValueError
|
||||
self.assertRaises(ValueError, util.get_volume_drivers)
|
||||
|
||||
def test_get_backup_drivers(self):
|
||||
# Just ensure that it doesn't raise an exception
|
||||
drivers = util.get_backup_drivers()
|
||||
self.assertNotEqual(0, len(drivers))
|
||||
for driver in drivers:
|
||||
self.assertIsInstance(driver, util.DriverInfo)
|
||||
|
||||
@mock.patch('cinder.backup.drivers.ceph.CephBackupDriver.'
|
||||
'get_driver_options')
|
||||
def test_get_backup_drivers_fail(self, driver_opt):
|
||||
driver_opt.side_effect = ValueError
|
||||
self.assertRaises(ValueError, util.get_backup_drivers)
|
||||
|
||||
def test_get_fczm_drivers(self):
|
||||
# Just ensure that it doesn't raise an exception
|
||||
drivers = util.get_fczm_drivers()
|
||||
self.assertNotEqual(0, len(drivers))
|
||||
for driver in drivers:
|
||||
self.assertIsInstance(driver, util.DriverInfo)
|
||||
|
||||
@mock.patch('cinder.zonemanager.drivers.cisco.cisco_fc_zone_driver.'
|
||||
'CiscoFCZoneDriver.get_driver_options')
|
||||
def test_get_fczm_drivers_fail(self, driver_opt):
|
||||
driver_opt.side_effect = ValueError
|
||||
self.assertRaises(ValueError, util.get_fczm_drivers)
|
@ -562,6 +562,7 @@ class BaseVD(object):
|
||||
def check_for_setup_error(self):
|
||||
return
|
||||
|
||||
@staticmethod
|
||||
def get_driver_options():
|
||||
"""Return the oslo_config options specific to the driver."""
|
||||
return volume_opts
|
||||
|
@ -39,6 +39,11 @@ class InfortrendCLIFCDriver(driver.FibreChannelDriver):
|
||||
'FC', configuration=self.configuration)
|
||||
self.VERSION = self.common.VERSION
|
||||
|
||||
@staticmethod
|
||||
def get_driver_options():
|
||||
"""Return the oslo_config options specific to the driver."""
|
||||
return common_cli.infortrend_opts
|
||||
|
||||
def do_setup(self, context):
|
||||
"""Any initialization the volume driver does while starting.
|
||||
|
||||
|
@ -38,6 +38,11 @@ class InfortrendCLIISCSIDriver(driver.ISCSIDriver):
|
||||
'iSCSI', configuration=self.configuration)
|
||||
self.VERSION = self.common.VERSION
|
||||
|
||||
@staticmethod
|
||||
def get_driver_options():
|
||||
"""Return the oslo_config options specific to the driver."""
|
||||
return common_cli.infortrend_opts
|
||||
|
||||
def do_setup(self, context):
|
||||
"""Any initialization the volume driver does while starting.
|
||||
|
||||
|
@ -182,6 +182,11 @@ class MacroSANBaseDriver(driver.VolumeDriver):
|
||||
|
||||
self.initialize_iscsi_info()
|
||||
|
||||
@staticmethod
|
||||
def get_driver_options():
|
||||
"""Return the oslo_config options specific to the driver."""
|
||||
return config.macrosan_opts
|
||||
|
||||
@property
|
||||
def _self_node_wwns(self):
|
||||
return []
|
||||
|
@ -35,6 +35,23 @@ There are some basic attributes that all drivers classes should have:
|
||||
|
||||
The tooling system will also use the name and docstring of the driver class.
|
||||
|
||||
Configuration options
|
||||
---------------------
|
||||
|
||||
Each driver requires different configuration options set in the cinder.conf
|
||||
file to operate, and due to the complexities of the Object Oriented programming
|
||||
mechanisms (inheritance, composition, overwriting, etc.) once your driver
|
||||
defines its parameters in the code Cinder has no automated way of telling which
|
||||
configuration options are relevant to your driver.
|
||||
|
||||
In order to assist operators and installation tools we recommend reporting the
|
||||
relevant options:
|
||||
|
||||
* For operators: In the documentation under
|
||||
``doc/source/configuration/block-storage``.
|
||||
* For operators and installers: Through the ``get_driver_options`` static
|
||||
method returning that returns a list of all the Oslo Config parameters.
|
||||
|
||||
Minimum Features
|
||||
----------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user