From 94432dd1b673198fb637f42861650af97f67da83 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Wed, 3 Apr 2019 10:16:28 +0200 Subject: [PATCH] Add Tobiko credentials to devstack plugin This patch adds new settings to Tobiko's Devstack plugin to configure credentials used in Tobiko. Change-Id: I4b7e6cbea437b5a4c4b7789ea7f5c04a948c7fdf --- devstack/plugin.sh | 35 ++++++++++++++++++++++++++--------- devstack/settings | 7 +++++++ zuul.d/tobiko-devstack.yaml | 3 +++ 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index dea9f25b1..b35298e30 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -18,15 +18,7 @@ function configure_tobiko { fi # See ``lib/keystone`` where these users and tenants are set up - echo_summary "Write Keystone service options to ${TOBIKO_CONF}" - iniset "${tobiko_conf}" keystone auth_url "$(get_keystone_auth_url)" - iniset "${tobiko_conf}" keystone username "${ADMIN_USERNAME:-admin}" - iniset "${tobiko_conf}" keystone password "${ADMIN_PASSWORD:-secret}" - iniset "${tobiko_conf}" keystone project_name "${ADMIN_TENANT_NAME:-admin}" - iniset "${tobiko_conf}" keystone user_domain_name \ - "${ADMIN_DOMAIN_NAME:-Default}" - iniset "${tobiko_conf}" keystone project_domain_name \ - "${ADMIN_DOMAIN_NAME:-Default}" + configure_keystone_credentials echo_summary "Write compute service options to ${TOBIKO_CONF}" iniset "${tobiko_conf}" nova image "$(get_image)" @@ -58,6 +50,31 @@ function get_image { } +function configure_keystone_credentials { + echo_summary "Write Keystone service options to ${TOBIKO_CONF}" + iniset "${tobiko_conf}" keystone auth_url "$(get_keystone_auth_url)" + + TOBIKO_PROJECT_ID=$(get_or_create_project \ + "${TOBIKO_KEYSTONE_PROJECT_NAME}" "${TOBIKO_KEYSTONE_PROJECT_DOMAIN_NAME}") + + TOBIKO_USER_ID=$(get_or_create_user ${TOBIKO_KEYSTONE_USERNAME} \ + "${TOBIKO_KEYSTONE_PASSWORD}" "${TOBIKO_KEYSTONE_USER_DOMAIN_NAME}") + + get_or_add_user_project_role "${TOBIKO_KEYSTONE_USER_ROLE}" \ + "${TOBIKO_USER_ID}" "${TOBIKO_PROJECT_ID}" + + get_or_add_user_domain_role "${TOBIKO_KEYSTONE_USER_ROLE}" \ + "${TOBIKO_USER_ID}" "${TOBIKO_KEYSTONE_USER_DOMAIN_NAME}" + + iniset "${tobiko_conf}" keystone username "${TOBIKO_KEYSTONE_USERNAME}" + iniset "${tobiko_conf}" keystone password "${TOBIKO_KEYSTONE_PASSWORD}" + iniset "${tobiko_conf}" keystone project_name "${TOBIKO_KEYSTONE_PROJECT_NAME}" + iniset "${tobiko_conf}" keystone user_domain_name \ + "${TOBIKO_KEYSTONE_USER_DOMAIN_NAME}" + iniset "${tobiko_conf}" keystone project_domain_name \ + "${TOBIKO_KEYSTONE_PROJECT_DOMAIN_NAME}" +} + function get_flavor { local name=${DEFAULT_INSTANCE_TYPE:-} if [ "${name}" != "" ]; then diff --git a/devstack/settings b/devstack/settings index 0d1bad854..591207505 100644 --- a/devstack/settings +++ b/devstack/settings @@ -3,3 +3,10 @@ GITDIR["tobiko"]=$DEST/tobiko GITBRANCH["tobiko"]=master TOBIKO_CONF=/etc/tobiko/tobiko.conf + +TOBIKO_KEYSTONE_USER_ROLE=${TOBIKO_KEYSTONE_USER_ROLE:-Member} +TOBIKO_KEYSTONE_USERNAME=${TOBIKO_KEYSTONE_USERNAME:-admin} +TOBIKO_KEYSTONE_PASSWORD=${TOBIKO_KEYSTONE_PASSWORD:-secret} +TOBIKO_KEYSTONE_PROJECT_NAME=${TOBIKO_KEYSTONE_PROJECT_NAME:-admin} +TOBIKO_KEYSTONE_USER_DOMAIN_NAME=${TOBIKO_KEYSTONE_USER_DOMAIN_NAME:-Default} +TOBIKO_KEYSTONE_PROJECT_DOMAIN_NAME=${TOBIKO_KEYSTONE_PROJECT_DOMAIN_NAME:-Default} diff --git a/zuul.d/tobiko-devstack.yaml b/zuul.d/tobiko-devstack.yaml index 4af118e0c..b2bbd3a28 100644 --- a/zuul.d/tobiko-devstack.yaml +++ b/zuul.d/tobiko-devstack.yaml @@ -20,6 +20,9 @@ USE_PYTHON3: true NETWORK_API_EXTENSIONS: address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-domain-ports,dns-integration,dvr,empty-string-filtering,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,filter-validation,fip-port-details,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-bw-minimum-ingress,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-mac-address-regenerate,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-segment,standard-attr-timestamp,standard-attr-tag,subnet_allocation,trunk,trunk-details,uplink-status-propagation MULTI_HOST: 1 + TOBIKO_KEYSTONE_USERNAME: tobiko + TOBIKO_KEYSTONE_PASSWORD: secret_tobiko + TOBIKO_KEYSTONE_PROJECT_NAME: tobiko devstack_plugins: heat: https://git.openstack.org/openstack/heat.git neutron: https://git.openstack.org/openstack/neutron.git