Merge "Fix invalid services caused by enabled_backends"
This commit is contained in:
commit
8753a3401b
@ -151,7 +151,7 @@ class BackupManager(manager.SchedulerDependentManager):
|
||||
|
||||
def _setup_volume_drivers(self):
|
||||
if CONF.enabled_backends:
|
||||
for backend in CONF.enabled_backends:
|
||||
for backend in filter(None, CONF.enabled_backends):
|
||||
host = "%s@%s" % (CONF.host, backend)
|
||||
mgr = importutils.import_object(CONF.volume_manager,
|
||||
host=host,
|
||||
|
@ -89,7 +89,7 @@ def main():
|
||||
# cinder-volume
|
||||
try:
|
||||
if CONF.enabled_backends:
|
||||
for backend in CONF.enabled_backends:
|
||||
for backend in filter(None, CONF.enabled_backends):
|
||||
CONF.register_opt(volume_cmd.host_opt, group=backend)
|
||||
backend_host = getattr(CONF, backend).backend_host
|
||||
host = "%s@%s" % (backend_host or CONF.host, backend)
|
||||
|
@ -84,7 +84,7 @@ def main():
|
||||
service_started = False
|
||||
|
||||
if CONF.enabled_backends:
|
||||
for backend in CONF.enabled_backends:
|
||||
for backend in filter(None, CONF.enabled_backends):
|
||||
CONF.register_opt(host_opt, group=backend)
|
||||
backend_host = getattr(CONF, backend).backend_host
|
||||
host = "%s@%s" % (backend_host or CONF.host, backend)
|
||||
|
@ -171,7 +171,7 @@ class TestCinderAllCmd(test.TestCase):
|
||||
def test_main_with_backend(self, log_setup, get_logger, monkey_patch,
|
||||
process_launcher, wsgi_service, service_create,
|
||||
rpc_init):
|
||||
CONF.set_override('enabled_backends', ['backend1'])
|
||||
CONF.set_override('enabled_backends', ['', 'backend1', ''])
|
||||
CONF.set_override('host', 'host')
|
||||
launcher = process_launcher.return_value
|
||||
server = wsgi_service.return_value
|
||||
@ -356,7 +356,7 @@ class TestCinderVolumeCmd(test.TestCase):
|
||||
@mock.patch('oslo_log.log.setup')
|
||||
def test_main_with_backends(self, log_setup, monkey_patch, service_create,
|
||||
get_launcher):
|
||||
backends = ['backend1', 'backend2']
|
||||
backends = ['', 'backend1', 'backend2', '']
|
||||
CONF.set_override('enabled_backends', backends)
|
||||
CONF.set_override('host', 'host')
|
||||
launcher = get_launcher.return_value
|
||||
@ -375,7 +375,7 @@ class TestCinderVolumeCmd(test.TestCase):
|
||||
service_name='backend2', coordination=True,
|
||||
cluster=None)
|
||||
service_create.assert_has_calls([c1, c2])
|
||||
self.assertEqual(len(backends), launcher.launch_service.call_count)
|
||||
self.assertEqual(2, launcher.launch_service.call_count)
|
||||
launcher.wait.assert_called_once_with()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user