Fix config registration in cinder volume drivers.
The config documentation relies on options being registered on a modules import. Our need to move the drivers to using self.configuration for multi-backend support means that options wouldn't be loaded until object initialization which breaks documentation. This patch puts a dummy CONF init/load back in the drivers. While putting this change together I came across a number of drivers still using FLAGS, and even worse a number of drivers using a mixture of FLAGS and CONF and self.configuraiton. So most of those are cleaned up here as well. Note there are two drivers that were not updated at all here: 1. windows.py 2. zadara.py The zadara folks have indicated that they're in the process of updating and releasing a new version of their driver so I left that as is. The windows driver needs a bit of work to switch over. Fixes bug: 1179159 Change-Id: I90165299bf080da17741d027e36e361540da0ff8
This commit is contained in:
@@ -77,9 +77,9 @@ class ScalityDriverTestCase(test.TestCase):
|
||||
raise e
|
||||
|
||||
def _configure_driver(self):
|
||||
scality.FLAGS.scality_sofs_config = self.TEST_CONFIG
|
||||
scality.FLAGS.scality_sofs_mount_point = self.TEST_MOUNT
|
||||
scality.FLAGS.scality_sofs_volume_dir = self.TEST_VOLDIR
|
||||
scality.CONF.scality_sofs_config = self.TEST_CONFIG
|
||||
scality.CONF.scality_sofs_mount_point = self.TEST_MOUNT
|
||||
scality.CONF.scality_sofs_volume_dir = self.TEST_VOLDIR
|
||||
|
||||
def _execute_wrapper(self, cmd, *args, **kwargs):
|
||||
try:
|
||||
@@ -116,13 +116,13 @@ class ScalityDriverTestCase(test.TestCase):
|
||||
|
||||
def test_setup_no_config(self):
|
||||
"""Missing SOFS configuration shall raise an error."""
|
||||
scality.FLAGS.scality_sofs_config = None
|
||||
scality.CONF.scality_sofs_config = None
|
||||
self.assertRaises(exception.VolumeBackendAPIException,
|
||||
self._driver.do_setup, None)
|
||||
|
||||
def test_setup_missing_config(self):
|
||||
"""Non-existent SOFS configuration file shall raise an error."""
|
||||
scality.FLAGS.scality_sofs_config = 'nonexistent.conf'
|
||||
scality.CONF.scality_sofs_config = 'nonexistent.conf'
|
||||
self.assertRaises(exception.VolumeBackendAPIException,
|
||||
self._driver.do_setup, None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user