add possibility of using public_urls for benchmarking
Add 'use_public_urls' option to the deployment config This option will be used later for switching access method to the cloud. Because in some use-cases cloud may be accessible only by public endpoints. Add 'admin_port' option to the deployment config This option defines administrative keystone port on the public network. Closes-Bug: #1306448 Change-Id: Ifb838c5fe9eab5e81353d697aa747bd8adf77572
This commit is contained in:
@@ -152,7 +152,7 @@ class DeploymentCommands(object):
|
||||
:param deploy_id: a UUID of the deployment
|
||||
"""
|
||||
headers = ['auth_url', 'username', 'password', 'tenant_name',
|
||||
'region_name']
|
||||
'region_name', 'use_public_urls', 'admin_port']
|
||||
table = prettytable.PrettyTable(headers)
|
||||
endpoints = db.deployment_get(deploy_id)['endpoints']
|
||||
for ep in endpoints:
|
||||
|
@@ -30,7 +30,9 @@ class ExistingCloud(engine.EngineFactory):
|
||||
"username": "admin",
|
||||
"password": "password",
|
||||
"tenant_name": "demo",
|
||||
"region_name": "RegionOne"
|
||||
"region_name": "RegionOne",
|
||||
"use_public_urls": False,
|
||||
"keystone_admin_port": 35357
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +50,12 @@ class ExistingCloud(engine.EngineFactory):
|
||||
'password': {'type': 'string'},
|
||||
'tenant_name': {'type': 'string'},
|
||||
'region_name': {'type': 'string'},
|
||||
'use_public_urls': {'type': 'boolean'},
|
||||
'admin_port': {
|
||||
'type': 'integer',
|
||||
'minimum': 2,
|
||||
'maximum': 65535
|
||||
}
|
||||
},
|
||||
'required': ['auth_url', 'username', 'password',
|
||||
'tenant_name'],
|
||||
@@ -63,7 +71,11 @@ class ExistingCloud(engine.EngineFactory):
|
||||
endpoint_dict['password'],
|
||||
endpoint_dict['tenant_name'],
|
||||
consts.EndpointPermission.ADMIN,
|
||||
endpoint_dict.get('region_name'))
|
||||
endpoint_dict.get('region_name'),
|
||||
endpoint_dict.get('use_public_urls',
|
||||
False),
|
||||
endpoint_dict.get('admin_port',
|
||||
35357))
|
||||
return [admin_endpoint]
|
||||
|
||||
def cleanup(self):
|
||||
|
@@ -20,18 +20,22 @@ class Endpoint(object):
|
||||
|
||||
def __init__(self, auth_url, username, password, tenant_name,
|
||||
permission=consts.EndpointPermission.USER,
|
||||
region_name=None):
|
||||
region_name=None, use_public_urls=False, admin_port=35357):
|
||||
self.auth_url = auth_url
|
||||
self.username = username
|
||||
self.password = password
|
||||
self.tenant_name = tenant_name
|
||||
self.permission = permission
|
||||
self.region_name = region_name
|
||||
self.use_public_urls = use_public_urls
|
||||
self.admin_port = admin_port
|
||||
|
||||
def to_dict(self, include_permission=False):
|
||||
dct = {"auth_url": self.auth_url, "username": self.username,
|
||||
"password": self.password, "tenant_name": self.tenant_name,
|
||||
"region_name": self.region_name}
|
||||
"region_name": self.region_name,
|
||||
"use_public_urls": self.use_public_urls,
|
||||
"admin_port": self.admin_port}
|
||||
if include_permission:
|
||||
dct["permission"] = self.permission
|
||||
return dct
|
||||
|
@@ -22,6 +22,7 @@ from keystoneclient.v2_0 import client as keystone
|
||||
from neutronclient.neutron import client as neutron
|
||||
from novaclient import client as nova
|
||||
from oslo.config import cfg
|
||||
import urlparse
|
||||
|
||||
from rally import exceptions
|
||||
|
||||
@@ -74,6 +75,17 @@ class Clients(object):
|
||||
"insecure": CONF.https_insecure, "cacert": CONF.https_cacert
|
||||
}
|
||||
kw = dict(self.endpoint.to_dict().items() + new_kw.items())
|
||||
if kw["use_public_urls"]:
|
||||
mgmt_url = urlparse.urlparse(kw["auth_url"])
|
||||
if mgmt_url.port != kw["admin_port"]:
|
||||
kw["endpoint"] = "{0}://{1}:{2}{3}".format(
|
||||
mgmt_url.scheme,
|
||||
mgmt_url.hostname,
|
||||
kw["admin_port"],
|
||||
mgmt_url.path
|
||||
)
|
||||
else:
|
||||
kw["endpoint"] = kw["auth_url"]
|
||||
client = keystone.Client(**kw)
|
||||
client.authenticate()
|
||||
return client
|
||||
|
@@ -33,6 +33,8 @@ class TestExistingCloud(test.TestCase):
|
||||
'password': 'myadminpass',
|
||||
'tenant_name': 'demo',
|
||||
'region_name': 'RegionOne',
|
||||
'use_public_urls': False,
|
||||
'admin_port': 35357
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@@ -24,4 +24,5 @@ class EndpointTestCase(test.TestCase):
|
||||
self.assertEqual(endpoint.to_dict(include_permission=True),
|
||||
{"auth_url": "url", "username": "user",
|
||||
"password": "pwd", "tenant_name": "tenant",
|
||||
"region_name": None, "permission": "admin"})
|
||||
"region_name": None, "permission": "admin",
|
||||
"use_public_urls": False, 'admin_port': 35357})
|
||||
|
@@ -32,7 +32,9 @@ FAKE_DEPLOY_CONFIG = {
|
||||
'username': 'admin',
|
||||
'password': 'myadminpass',
|
||||
'tenant_name': 'demo',
|
||||
'region_name': 'RegionOne'
|
||||
'region_name': 'RegionOne',
|
||||
'use_public_urls': False,
|
||||
'admin_port': 35357,
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user