Allow host config to be overriden in backend
This allows you to specify host=XXX in your backend configuration to override the host value that is specified in the DEFAULT section, allowing for some backends to share a hostname while others can have unique names. Change-Id: Ie8894a7cebf350dc2d50567058a765482b9d97d7 Closes-bug: #1322366
This commit is contained in:
parent
d7d2599de9
commit
c0630419f4
@ -50,6 +50,8 @@ from cinder import utils
|
||||
from cinder import version
|
||||
|
||||
|
||||
host_opt = cfg.StrOpt('host',
|
||||
help='Backend override of host value.')
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
@ -61,7 +63,9 @@ if __name__ == '__main__':
|
||||
launcher = service.get_launcher()
|
||||
if CONF.enabled_backends:
|
||||
for backend in CONF.enabled_backends:
|
||||
host = "%s@%s" % (CONF.host, backend)
|
||||
CONF.register_opts([host_opt], group=backend)
|
||||
backend_host = getattr(CONF, backend).host
|
||||
host = "%s@%s" % (backend_host or CONF.host, backend)
|
||||
server = service.Service.create(host=host,
|
||||
service_name=backend)
|
||||
launcher.launch_service(server)
|
||||
|
Loading…
x
Reference in New Issue
Block a user