From c0630419f45f0b34bae5702ccecedf0b398f91b0 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 22 May 2014 14:49:20 -0700 Subject: [PATCH] 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 --- bin/cinder-volume | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- 2.45.2