From 25b0b58c9595f8600664aa5c49504e44eed80859 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 6 Sep 2012 13:46:27 -0700 Subject: Allow cinder catalog match values to be configured Depending on how a deployments keystone catalog is set up, the default values passed in to the cinder client may be incorrect. This adds a configuration option to specify exactly where to look for the cinder endpoint in the service catalog. Fixes bug 1047033 Change-Id: I93324b6930f384306311b0bbac375a9224283fbc --- nova/volume/cinder.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/nova/volume/cinder.py b/nova/volume/cinder.py index 590b7d8a0..9d5222c03 100644 --- a/nova/volume/cinder.py +++ b/nova/volume/cinder.py @@ -27,9 +27,19 @@ from cinderclient.v1 import client as cinder_client from nova.db import base from nova import exception from nova import flags +from nova.openstack.common import cfg from nova.openstack.common import log as logging +cinder_opts = [ + cfg.StrOpt('cinder_catalog_info', + default='volume:cinder:publicURL', + help='Info to match when looking for cinder in the service ' + 'catalog. Format is : separated values of the form: ' + '::'), +] + FLAGS = flags.FLAGS +FLAGS.register_opts(cinder_opts) LOG = logging.getLogger(__name__) @@ -42,7 +52,11 @@ def cinderclient(context): 'access': {'serviceCatalog': context.service_catalog} } sc = service_catalog.ServiceCatalog(compat_catalog) - url = sc.url_for(service_type='volume', service_name='cinder') + info = FLAGS.cinder_catalog_info + service_type, service_name, endpoint_type = info.split(':') + url = sc.url_for(service_type=service_type, + service_name=service_name, + endpoint_type=endpoint_type) LOG.debug(_('Cinderclient connection created using URL: %s') % url) -- cgit