Change nova_proxy_admin_tenant_name to id

The task manager can be configured with periodic events
that check for the existence of running nova instances.
The events run via a separate admin connection to nova.

Taskmanager.Manager populates the admin client context
with the tenant name provided by nova_proxy_admin_tenant_name
parameter instead of the uuid, which results in an invalid
management url that is composed of the two parameters:
<nova_compute_url>/<nova_proxy_admin_tenant_name>.

Changing tenant_name to tenant_id results in a valid endpoint.

DocImpact
deprecating option 'nova_proxy_admin_tenant_name'
to 'nova_proxy_admin_tenant_id'

Change-Id: Ia1315e41288ab1b24ac402bad15176cb1ae0e5cd
Co-Authored-By: Li Ma <skywalker.nick@gmail.com>
Closes-Bug: #1289101
This commit is contained in:
Alex Tomic 2015-03-13 15:55:35 +01:00
parent e0144328a6
commit 75088205f1
5 changed files with 15 additions and 13 deletions

View File

@ -112,7 +112,7 @@ use_nova_server_config_drive = False
# basically acting like the client via that proxy token.
nova_proxy_admin_user = admin
nova_proxy_admin_pass = 3de4922d8b6ac5a1aad9
nova_proxy_admin_tenant_name = admin
nova_proxy_admin_tenant_id =
# Manager impl for the taskmanager
taskmanager_manager=trove.taskmanager.manager.Manager

View File

@ -69,7 +69,7 @@ db_api_implementation = trove.db.sqlalchemy.api
# basically acting like the client via that proxy token.
nova_proxy_admin_user = admin
nova_proxy_admin_pass = 3de4922d8b6ac5a1aad9
nova_proxy_admin_tenant_name = admin
nova_proxy_admin_tenant_id =
trove_auth_url = http://0.0.0.0:5000/v2.0
nova_region_name = RegionOne

View File

@ -331,8 +331,9 @@ common_opts = [
help="Admin username used to connect to Nova.", secret=True),
cfg.StrOpt('nova_proxy_admin_pass', default='',
help="Admin password used to connect to Nova.", secret=True),
cfg.StrOpt('nova_proxy_admin_tenant_name', default='',
help="Admin tenant used to connect to Nova.", secret=True),
cfg.StrOpt('nova_proxy_admin_tenant_id', default='',
deprecated_name='nova_proxy_admin_tenant_name',
help="Admin tenant ID used to connect to Nova.", secret=True),
cfg.StrOpt('network_label_regex', default='^private$',
help='Regular expression to match Trove network labels.'),
cfg.StrOpt('ip_regex', default=None,

View File

@ -41,7 +41,7 @@ class Manager(periodic_task.PeriodicTasks):
self.admin_context = TroveContext(
user=CONF.nova_proxy_admin_user,
auth_token=CONF.nova_proxy_admin_pass,
tenant=CONF.nova_proxy_admin_tenant_name)
tenant=CONF.nova_proxy_admin_tenant_id)
if CONF.exists_notification_transformer:
self.exists_transformer = importutils.import_object(
CONF.exists_notification_transformer,

View File

@ -21,6 +21,7 @@ import testtools
from testtools import matchers
import swiftclient.client
import uuid
from trove.tests.fakes.swift import SwiftClientStub
from trove.common.context import TroveContext
@ -49,7 +50,7 @@ class TestRemote(testtools.TestCase):
'publicURL': 'example.com'}],
'type': 'object-store'}]
client = remote.create_swift_client(TroveContext(
tenant='123',
tenant=uuid.uuid4().hex,
service_catalog=service_catalog))
headers, container = client.get_container('bob')
self.assertIs(headers, "text")
@ -287,7 +288,7 @@ class TestCreateCinderClient(testtools.TestCase):
def test_create_with_conf_override(self):
cinder_url_from_conf = 'http://example.com'
tenant_from_ctx = 'abc'
tenant_from_ctx = uuid.uuid4().hex
cfg.CONF.set_override('cinder_url', cinder_url_from_conf)
client = remote.create_cinder_client(
@ -297,7 +298,7 @@ class TestCreateCinderClient(testtools.TestCase):
def test_create_with_conf_override_trailing_slash(self):
cinder_url_from_conf = 'http://example.com/'
tenant_from_ctx = 'abc'
tenant_from_ctx = uuid.uuid4().hex
cfg.CONF.set_override('cinder_url', cinder_url_from_conf)
client = remote.create_cinder_client(
TroveContext(tenant=tenant_from_ctx))
@ -362,7 +363,7 @@ class TestCreateNovaClient(testtools.TestCase):
def test_create_with_conf_override(self):
nova_url_from_conf = 'http://example.com'
tenant_from_ctx = 'abc'
tenant_from_ctx = uuid.uuid4().hex
cfg.CONF.set_override('nova_compute_url', nova_url_from_conf)
client = remote.create_nova_client(
@ -372,7 +373,7 @@ class TestCreateNovaClient(testtools.TestCase):
def test_create_with_conf_override_trailing_slash(self):
nova_url_from_conf = 'http://example.com/'
tenant_from_ctx = 'abc'
tenant_from_ctx = uuid.uuid4().hex
cfg.CONF.set_override('nova_compute_url', nova_url_from_conf)
client = remote.create_nova_client(
TroveContext(tenant=tenant_from_ctx))
@ -437,7 +438,7 @@ class TestCreateHeatClient(testtools.TestCase):
def test_create_with_conf_override(self):
heat_url_from_conf = 'http://example.com'
tenant_from_ctx = 'abc'
tenant_from_ctx = uuid.uuid4().hex
cfg.CONF.set_override('heat_url', heat_url_from_conf)
client = remote.create_heat_client(
@ -447,7 +448,7 @@ class TestCreateHeatClient(testtools.TestCase):
def test_create_with_conf_override_trailing_slash(self):
heat_url_from_conf = 'http://example.com/'
tenant_from_ctx = 'abc'
tenant_from_ctx = uuid.uuid4().hex
cfg.CONF.set_override('heat_url', heat_url_from_conf)
client = remote.create_heat_client(
TroveContext(tenant=tenant_from_ctx))
@ -512,7 +513,7 @@ class TestCreateSwiftClient(testtools.TestCase):
def test_create_with_conf_override(self):
swift_url_from_conf = 'http://example.com/AUTH_'
tenant_from_ctx = 'abc'
tenant_from_ctx = uuid.uuid4().hex
cfg.CONF.set_override('swift_url', swift_url_from_conf)
client = remote.create_swift_client(