Skip to content

Commit

Permalink
Allow cinder catalog match values to be configured
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vishvananda committed Sep 6, 2012
1 parent 20ae7ee commit 25b0b58
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion nova/volume/cinder.py
Expand Up @@ -27,9 +27,19 @@
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: '
'<service_type>:<service_name>:<endpoint_type>'),
]

FLAGS = flags.FLAGS
FLAGS.register_opts(cinder_opts)

LOG = logging.getLogger(__name__)

Expand All @@ -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)

Expand Down

0 comments on commit 25b0b58

Please sign in to comment.