Adding support for Keystone V3

Tempest client will now check which Keystone version is specified in
the conf and make the appropriate call to either v2 or v3. Rally
tests using v3. Adding a new extras.d file so devstack will set
up the Rally config to point to Keystone v3 without altering the
actual devstack config. Adding documentation for Keystone v3 specific
args.

Change-Id: Iae8ffb412c00b7ca0e02ff0e6f4374eaae64005d
This commit is contained in:
Daniel Allegood 2015-08-10 17:39:32 -07:00
parent 2874192814
commit 4bc0e45249
8 changed files with 84 additions and 24 deletions

View File

@ -0,0 +1,31 @@
if [[ "$1" == "stack" && "$2" == "post-config" ]]; then
if [[ ! -z $RALLY_AUTH_URL ]]; then
# rally deployment create
tmpfile=$(mktemp)
_create_deployment_config $tmpfile
iniset $RALLY_CONF_DIR/$RALLY_CONF_FILE database connection `database_connection_url rally`
recreate_database rally utf8
# Recreate rally database
$RALLY_BIN_DIR/rally-manage --config-file $RALLY_CONF_DIR/$RALLY_CONF_FILE db recreate
rally --config-file /etc/rally/rally.conf deployment create --name cue-devstack2 --file $tmpfile
fi
fi
# _create_deployment_config filename
function _create_deployment_config() {
cat >$1 <<EOF
{
"type": "ExistingCloud",
"auth_url": "$KEYSTONE_AUTH_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/$RALLY_AUTH_VERSION",
"admin": {
"username": "admin",
"password": "$ADMIN_PASSWORD",
"project_name": "admin"
}
}
EOF
}

View File

@ -65,3 +65,7 @@ enable_service cue
enable_service cue-api
enable_service cue-worker
CUE_MANAGEMENT_KEY=cue-mgmt-key
# Rally auth version
RALLY_AUTH_VERSION=v3

View File

@ -85,11 +85,13 @@ cluster_node_check_max_count 30 Number of t
Parameter Default Note
=========================== ==================================== ==============================================================
os_region_name None Region name
os_tenant_id None Openstack Tenant ID
os_tenant_name None Openstack Tenant Name
os_username None Openstack Username
os_password None Openstack Password
os_auth_url None Openstack Authentication (Identity) URL
os_auth_version None Openstack Authentication (Identity) Version
os_project_name None Openstack Project Name
os_project_domain_name None Openstack Project Domain Name
os_user_domain_name None Openstack User Domain Name
os_key_name None SSH key to be provisioned to cue VMs
os_availability_zone None Default availability zone to provision cue VMs
=========================== ==================================== ==============================================================
@ -105,4 +107,4 @@ auth_plugin None Name of the p
project_name None Project name accessing Keystone (usually 'service')
username None Username for accessing Keystone
password None password for accessing keystone
=========================== ==================================== ==============================================================
=========================== ==================================== ==============================================================

View File

@ -27,8 +27,11 @@ zk_hosts=<zookeeper-ip-address>
# Credentials used by Cue to access OpenStack services
os_password = <password>
os_username = <username>
os_tenant_name = <tenant-name>
os_auth_url = http://192.168.131.199:35357/v2.0
os_auth_url = http://192.168.131.199:35357/v3
os_auth_version = 3
os_project_name = <project-name>
os_project_domain_name = <project-domain-name>
os_user_domain_name = <user-domain-name>
[keystone_authtoken]
# Credentials used by Cue for KeyStone authentication

View File

@ -17,7 +17,7 @@ import exceptions
import time
from cueclient.v1 import client
from keystoneclient.auth.identity import v2 as ks_v2
from keystoneclient.auth.identity import v3 as ks_v3
import keystoneclient.openstack.common.apiclient.exceptions as ks_exceptions
from keystoneclient import session as ks_session
from rally.common import log as logging
@ -86,12 +86,14 @@ class CueScenario(scenario.OpenStackScenario):
:return: cue client
"""
keystone_client = self.clients("keystone")
auth = ks_v2.Token(
keystone_client.auth_url,
keystone_client.auth_token,
tenant_id=keystone_client.tenant_id,
tenant_name=keystone_client.tenant_name,
trust_id=keystone_client.trust_id
auth = ks_v3.Password(
auth_url=keystone_client.auth_url,
username=keystone_client.username,
password=keystone_client.password,
project_name=keystone_client.project_name,
project_domain_name=keystone_client.project_domain_name,
user_domain_name=keystone_client.user_domain_name
)
session = ks_session.Session(auth=auth)
cue_client = client.Client(session=session)

View File

@ -99,12 +99,25 @@ class ServerClient(rest_client.RestClient):
def _get_keystone_auth_provider():
creds = auth.KeystoneV2Credentials(
username='admin',
password=CONF.identity.password,
tenant_name='admin',
)
auth_provider = auth.KeystoneV2AuthProvider(creds,
CONF.identity.uri)
keystone_v3 = CONF.identity.auth_version is '3'
if keystone_v3:
creds = auth.KeystoneV3Credentials(
username=CONF.identity.username,
password=CONF.identity.password,
project_name=CONF.identity.project_name,
user_domain_name=CONF.identity.user_domain_name,
project_domain_name=CONF.identity.project_domain_name
)
auth_provider = auth.KeystoneV3AuthProvider(creds,
CONF.identity.uri)
else:
creds = auth.KeystoneV2Credentials(
username=CONF.identity.username,
password=CONF.identity.password,
tenant_name=CONF.identity.project_name
)
auth_provider = auth.KeystoneV2AuthProvider(creds,
CONF.identity.uri)
auth_provider.fill_credentials()
return auth_provider

View File

@ -26,10 +26,13 @@ def setup_config(config_file=''):
identity_group = cfg.OptGroup(name='identity')
identity_options = [
cfg.StrOpt('uri', default='http://localhost:5000/v2.0'),
cfg.StrOpt('auth_version', default='3'),
cfg.StrOpt('uri', default='http://localhost:5000/v3'),
cfg.StrOpt('username', default='demo'),
cfg.StrOpt('password', default='secretadmin'),
cfg.StrOpt('tenant_name', default='demo'),
cfg.StrOpt('password', default='password'),
cfg.StrOpt('project_name', default='demo'),
cfg.StrOpt('user_domain_name', default='default'),
cfg.StrOpt('project_domain_name', default='default')
]
TEST_CONF.register_group(identity_group)
TEST_CONF.register_opts(identity_options, group=identity_group)

View File

@ -2,10 +2,12 @@
[identity]
# Replace these with values that represent your identity configuration
uri=http://localhost:5000/v2.0
uri=http://localhost:5000/v3
username=demo
tenant_name=demo
password=secretadmin
project_name=demo
user_domain_name=default
project_domain_name=default
[message_broker]
flavor=8795