Allow specification of endpoint_type to clients

We currently do not allow operators to specify which endpoint type
needs to be used to reach nova and neutron via their clients. This
adds a new option that defaults to publicURL (as it is today) but
allows operators to specify internalURL or adminURL if they need.

Change-Id: I9432b4df8a5b4fc9f0cc06e6ffb662df634ec4f8
Closes-bug: #1572693
This commit is contained in:
Adam Gandelman 2016-04-20 11:50:23 -07:00
parent cea4c6713a
commit b305beacd4
4 changed files with 5 additions and 1 deletions

View File

@ -28,5 +28,6 @@ api_opts = [
cfg.StrOpt('auth_region'),
cfg.IntOpt('max_retries', default=3),
cfg.IntOpt('retry_delay', default=1),
cfg.StrOpt('endpoint_type', default='publicURL'),
]
CONF.register_opts(api_opts)

View File

@ -791,6 +791,7 @@ class Neutron(object):
ks_session = keystone.KeystoneSession()
self.api_client = AstaraExtClientWrapper(
session=ks_session.session,
endpoint_type=cfg.CONF.endpoint_type,
)
self.l3_rpc_client = L3PluginApi(PLUGIN_ROUTER_RPC_TOPIC,
cfg.CONF.host)

View File

@ -249,7 +249,8 @@ class Nova(object):
self.client = client.Client(
version='2',
session=ks_session.session,
region_name=conf.auth_region)
region_name=conf.auth_region,
endpoint_type=conf.endpoint_type)
try:
self.instance_provider = get_instance_provider(

View File

@ -84,6 +84,7 @@ class FakeConf:
router_image_uuid = 'astara-image'
router_instance_flavor = 1
instance_provider = 'foo'
endpoint_type = 'publicURL'
EXPECTED_USERDATA = """