From: Vishvananda Ishaya Date: Thu, 22 May 2014 21:49:20 +0000 (-0700) Subject: Allow host config to be overriden in backend X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c0630419f45f0b34bae5702ccecedf0b398f91b0;p=openstack-build%2Fcinder-build.git 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 --- diff --git a/bin/cinder-volume b/bin/cinder-volume index c8c0c84fa..5b8b8a8d9 100755 --- a/bin/cinder-volume +++ b/bin/cinder-volume @@ -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)