| ... | ... |
@@ -815,6 +815,8 @@ function get_or_create_service {
|
| 815 | 815 |
openstack service show $2 -f value -c id 2>/dev/null || |
| 816 | 816 |
# Creates new service if not exists |
| 817 | 817 |
openstack service create \ |
| 818 |
+ --os-url $KEYSTONE_SERVICE_URI_V3 \ |
|
| 819 |
+ --os-identity-api-version=3 \ |
|
| 818 | 820 |
$2 \ |
| 819 | 821 |
--name $1 \ |
| 820 | 822 |
--description="$3" \ |
| ... | ... |
@@ -823,29 +825,56 @@ function get_or_create_service {
|
| 823 | 823 |
echo $service_id |
| 824 | 824 |
} |
| 825 | 825 |
|
| 826 |
-# Gets or creates endpoint |
|
| 827 |
-# Usage: get_or_create_endpoint <service> <region> <publicurl> <adminurl> <internalurl> |
|
| 828 |
-function get_or_create_endpoint {
|
|
| 829 |
- # Gets endpoint id |
|
| 826 |
+# Create an endpoint with a specific interface |
|
| 827 |
+# Usage: _get_or_create_endpoint_with_interface <service> <interface> <url> <region> |
|
| 828 |
+function _get_or_create_endpoint_with_interface {
|
|
| 830 | 829 |
local endpoint_id=$(openstack endpoint list \ |
| 831 |
- --column "ID" \ |
|
| 832 |
- --column "Region" \ |
|
| 833 |
- --column "Service Name" \ |
|
| 834 |
- | grep " $2 " \ |
|
| 835 |
- | grep " $1 " | get_field 1) |
|
| 830 |
+ --os-url $KEYSTONE_SERVICE_URI_V3 \ |
|
| 831 |
+ --os-identity-api-version=3 \ |
|
| 832 |
+ --service $1 \ |
|
| 833 |
+ --interface $2 \ |
|
| 834 |
+ --region $4 \ |
|
| 835 |
+ -c ID -f value) |
|
| 836 | 836 |
if [[ -z "$endpoint_id" ]]; then |
| 837 | 837 |
# Creates new endpoint |
| 838 | 838 |
endpoint_id=$(openstack endpoint create \ |
| 839 |
- $1 \ |
|
| 840 |
- --region $2 \ |
|
| 841 |
- --publicurl $3 \ |
|
| 842 |
- --adminurl $4 \ |
|
| 843 |
- --internalurl $5 \ |
|
| 844 |
- | grep " id " | get_field 2) |
|
| 839 |
+ --os-url $KEYSTONE_SERVICE_URI_V3 \ |
|
| 840 |
+ --os-identity-api-version=3 \ |
|
| 841 |
+ $1 $2 $3 --region $4 -f value -c id) |
|
| 845 | 842 |
fi |
| 843 |
+ |
|
| 846 | 844 |
echo $endpoint_id |
| 847 | 845 |
} |
| 848 | 846 |
|
| 847 |
+# Gets or creates endpoint |
|
| 848 |
+# Usage: get_or_create_endpoint <service> <region> <publicurl> <adminurl> <internalurl> |
|
| 849 |
+function get_or_create_endpoint {
|
|
| 850 |
+ # NOTE(jamielennnox): when converting to v3 endpoint creation we go from |
|
| 851 |
+ # creating one endpoint with multiple urls to multiple endpoints each with |
|
| 852 |
+ # a different interface. To maintain the existing function interface we |
|
| 853 |
+ # create 3 endpoints and return the id of the public one. In reality |
|
| 854 |
+ # returning the public id will not make a lot of difference as there are no |
|
| 855 |
+ # scenarios currently that use the returned id. Ideally this behaviour |
|
| 856 |
+ # should be pushed out to the service setups and let them create the |
|
| 857 |
+ # endpoints they need. |
|
| 858 |
+ local public_id=$(_get_or_create_endpoint_with_interface $1 public $3 $2) |
|
| 859 |
+ _get_or_create_endpoint_with_interface $1 admin $4 $2 |
|
| 860 |
+ _get_or_create_endpoint_with_interface $1 internal $5 $2 |
|
| 861 |
+ |
|
| 862 |
+ # return the public id to indicate success, and this is the endpoint most likely wanted |
|
| 863 |
+ echo $public_id |
|
| 864 |
+} |
|
| 865 |
+ |
|
| 866 |
+# Get a URL from the identity service |
|
| 867 |
+# Usage: get_endpoint_url <service> <interface> |
|
| 868 |
+function get_endpoint_url {
|
|
| 869 |
+ echo $(openstack endpoint list \ |
|
| 870 |
+ --service $1 --interface $2 \ |
|
| 871 |
+ --os-url $KEYSTONE_SERVICE_URI_V3 \ |
|
| 872 |
+ --os-identity-api-version=3 \ |
|
| 873 |
+ -c URL -f value) |
|
| 874 |
+} |
|
| 875 |
+ |
|
| 849 | 876 |
|
| 850 | 877 |
# Package Functions |
| 851 | 878 |
# ================= |
| ... | ... |
@@ -130,9 +130,8 @@ function create_ceilometer_accounts {
|
| 130 | 130 |
create_service_user "ceilometer" "admin" |
| 131 | 131 |
|
| 132 | 132 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 133 |
- local ceilometer_service=$(get_or_create_service "ceilometer" \ |
|
| 134 |
- "metering" "OpenStack Telemetry Service") |
|
| 135 |
- get_or_create_endpoint $ceilometer_service \ |
|
| 133 |
+ get_or_create_service "ceilometer" "metering" "OpenStack Telemetry Service" |
|
| 134 |
+ get_or_create_endpoint "metering" \ |
|
| 136 | 135 |
"$REGION_NAME" \ |
| 137 | 136 |
"$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/" \ |
| 138 | 137 |
"$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/" \ |
| ... | ... |
@@ -329,16 +329,14 @@ function create_cinder_accounts {
|
| 329 | 329 |
|
| 330 | 330 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 331 | 331 |
|
| 332 |
- local cinder_service=$(get_or_create_service "cinder" \ |
|
| 333 |
- "volume" "Cinder Volume Service") |
|
| 334 |
- get_or_create_endpoint $cinder_service "$REGION_NAME" \ |
|
| 332 |
+ get_or_create_service "cinder" "volume" "Cinder Volume Service" |
|
| 333 |
+ get_or_create_endpoint "volume" "$REGION_NAME" \ |
|
| 335 | 334 |
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(tenant_id)s" \ |
| 336 | 335 |
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(tenant_id)s" \ |
| 337 | 336 |
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(tenant_id)s" |
| 338 | 337 |
|
| 339 |
- local cinder_v2_service=$(get_or_create_service "cinderv2" \ |
|
| 340 |
- "volumev2" "Cinder Volume Service V2") |
|
| 341 |
- get_or_create_endpoint $cinder_v2_service "$REGION_NAME" \ |
|
| 338 |
+ get_or_create_service "cinderv2" "volumev2" "Cinder Volume Service V2" |
|
| 339 |
+ get_or_create_endpoint "volumev2" "$REGION_NAME" \ |
|
| 342 | 340 |
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(tenant_id)s" \ |
| 343 | 341 |
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(tenant_id)s" \ |
| 344 | 342 |
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(tenant_id)s" |
| ... | ... |
@@ -272,9 +272,8 @@ function create_glance_accounts {
|
| 272 | 272 |
|
| 273 | 273 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 274 | 274 |
|
| 275 |
- local glance_service=$(get_or_create_service "glance" \ |
|
| 276 |
- "image" "Glance Image Service") |
|
| 277 |
- get_or_create_endpoint $glance_service \ |
|
| 275 |
+ get_or_create_service "glance" "image" "Glance Image Service" |
|
| 276 |
+ get_or_create_endpoint "image" \ |
|
| 278 | 277 |
"$REGION_NAME" \ |
| 279 | 278 |
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT" \ |
| 280 | 279 |
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT" \ |
| ... | ... |
@@ -285,10 +284,9 @@ function create_glance_accounts {
|
| 285 | 285 |
# Add glance-search service and endpoints |
| 286 | 286 |
if is_service_enabled g-search; then |
| 287 | 287 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 288 |
- local glance_search_service=$(get_or_create_service "glance-search" \ |
|
| 289 |
- "search" "EXPERIMENTAL - Glance Graffiti Search Service") |
|
| 288 |
+ get_or_create_service "glance-search" "search" "EXPERIMENTAL - Glance Graffiti Search Service" |
|
| 290 | 289 |
|
| 291 |
- get_or_create_endpoint $glance_search_service \ |
|
| 290 |
+ get_or_create_endpoint "search" \ |
|
| 292 | 291 |
"$REGION_NAME" \ |
| 293 | 292 |
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_SEARCH_HOSTPORT" \ |
| 294 | 293 |
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_SEARCH_HOSTPORT" \ |
| ... | ... |
@@ -250,17 +250,15 @@ function create_heat_accounts {
|
| 250 | 250 |
|
| 251 | 251 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 252 | 252 |
|
| 253 |
- local heat_service=$(get_or_create_service "heat" \ |
|
| 254 |
- "orchestration" "Heat Orchestration Service") |
|
| 255 |
- get_or_create_endpoint $heat_service \ |
|
| 253 |
+ get_or_create_service "heat" "orchestration" "Heat Orchestration Service" |
|
| 254 |
+ get_or_create_endpoint "orchestration" \ |
|
| 256 | 255 |
"$REGION_NAME" \ |
| 257 | 256 |
"$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s" \ |
| 258 | 257 |
"$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s" \ |
| 259 | 258 |
"$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(tenant_id)s" |
| 260 | 259 |
|
| 261 |
- local heat_cfn_service=$(get_or_create_service "heat-cfn" \ |
|
| 262 |
- "cloudformation" "Heat CloudFormation Service") |
|
| 263 |
- get_or_create_endpoint $heat_cfn_service \ |
|
| 260 |
+ get_or_create_service "heat-cfn" "cloudformation" "Heat CloudFormation Service" |
|
| 261 |
+ get_or_create_endpoint "cloudformation" \ |
|
| 264 | 262 |
"$REGION_NAME" \ |
| 265 | 263 |
"$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \ |
| 266 | 264 |
"$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \ |
| ... | ... |
@@ -411,9 +411,8 @@ function create_ironic_accounts {
|
| 411 | 411 |
|
| 412 | 412 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 413 | 413 |
|
| 414 |
- local ironic_service=$(get_or_create_service "ironic" \ |
|
| 415 |
- "baremetal" "Ironic baremetal provisioning service") |
|
| 416 |
- get_or_create_endpoint $ironic_service \ |
|
| 414 |
+ get_or_create_service "ironic" "baremetal" "Ironic baremetal provisioning service" |
|
| 415 |
+ get_or_create_endpoint "baremetal" \ |
|
| 417 | 416 |
"$REGION_NAME" \ |
| 418 | 417 |
"$IRONIC_SERVICE_PROTOCOL://$IRONIC_HOSTPORT" \ |
| 419 | 418 |
"$IRONIC_SERVICE_PROTOCOL://$IRONIC_HOSTPORT" \ |
| ... | ... |
@@ -406,9 +406,8 @@ function create_keystone_accounts {
|
| 406 | 406 |
# Keystone |
| 407 | 407 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 408 | 408 |
|
| 409 |
- KEYSTONE_SERVICE=$(get_or_create_service "keystone" \ |
|
| 410 |
- "identity" "Keystone Identity Service") |
|
| 411 |
- get_or_create_endpoint $KEYSTONE_SERVICE \ |
|
| 409 |
+ get_or_create_service "keystone" "identity" "Keystone Identity Service" |
|
| 410 |
+ get_or_create_endpoint "identity" \ |
|
| 412 | 411 |
"$REGION_NAME" \ |
| 413 | 412 |
"$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v$IDENTITY_API_VERSION" \ |
| 414 | 413 |
"$KEYSTONE_AUTH_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/v$IDENTITY_API_VERSION" \ |
| ... | ... |
@@ -519,9 +519,8 @@ function create_neutron_accounts {
|
| 519 | 519 |
|
| 520 | 520 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 521 | 521 |
|
| 522 |
- local neutron_service=$(get_or_create_service "neutron" \ |
|
| 523 |
- "network" "Neutron Service") |
|
| 524 |
- get_or_create_endpoint $neutron_service \ |
|
| 522 |
+ get_or_create_service "neutron" "network" "Neutron Service" |
|
| 523 |
+ get_or_create_endpoint "network" \ |
|
| 525 | 524 |
"$REGION_NAME" \ |
| 526 | 525 |
"$Q_PROTOCOL://$SERVICE_HOST:$Q_PORT/" \ |
| 527 | 526 |
"$Q_PROTOCOL://$SERVICE_HOST:$Q_PORT/" \ |
| ... | ... |
@@ -404,24 +404,22 @@ function create_nova_accounts {
|
| 404 | 404 |
create_service_user "nova" "admin" |
| 405 | 405 |
|
| 406 | 406 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 407 |
- |
|
| 408 |
- local nova_service=$(get_or_create_service "nova" \ |
|
| 409 |
- "compute" "Nova Compute Service") |
|
| 410 | 407 |
local nova_api_url |
| 411 | 408 |
if [[ "$NOVA_USE_MOD_WSGI" == "False" ]]; then |
| 412 | 409 |
nova_api_url="$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT" |
| 413 | 410 |
else |
| 414 | 411 |
nova_api_url="$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST/compute" |
| 415 | 412 |
fi |
| 416 |
- get_or_create_endpoint $nova_service \ |
|
| 413 |
+ |
|
| 414 |
+ get_or_create_service "nova" "compute" "Nova Compute Service" |
|
| 415 |
+ get_or_create_endpoint "compute" \ |
|
| 417 | 416 |
"$REGION_NAME" \ |
| 418 | 417 |
"$nova_api_url/v2/\$(tenant_id)s" \ |
| 419 | 418 |
"$nova_api_url/v2/\$(tenant_id)s" \ |
| 420 | 419 |
"$nova_api_url/v2/\$(tenant_id)s" |
| 421 | 420 |
|
| 422 |
- local nova_v21_service=$(get_or_create_service "novav21" \ |
|
| 423 |
- "computev21" "Nova Compute Service V2.1") |
|
| 424 |
- get_or_create_endpoint $nova_v21_service \ |
|
| 421 |
+ get_or_create_service "novav21" "computev21" "Nova Compute Service V2.1" |
|
| 422 |
+ get_or_create_endpoint "computev21" \ |
|
| 425 | 423 |
"$REGION_NAME" \ |
| 426 | 424 |
"$nova_api_url/v2.1/\$(tenant_id)s" \ |
| 427 | 425 |
"$nova_api_url/v2.1/\$(tenant_id)s" \ |
| ... | ... |
@@ -440,9 +438,8 @@ function create_nova_accounts {
|
| 440 | 440 |
# EC2 |
| 441 | 441 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = "sql" ]]; then |
| 442 | 442 |
|
| 443 |
- local ec2_service=$(get_or_create_service "ec2" \ |
|
| 444 |
- "ec2" "EC2 Compatibility Layer") |
|
| 445 |
- get_or_create_endpoint $ec2_service \ |
|
| 443 |
+ get_or_create_service "ec2" "ec2" "EC2 Compatibility Layer" |
|
| 444 |
+ get_or_create_endpoint "ec2" \ |
|
| 446 | 445 |
"$REGION_NAME" \ |
| 447 | 446 |
"$EC2_SERVICE_PROTOCOL://$SERVICE_HOST:8773/" \ |
| 448 | 447 |
"$EC2_SERVICE_PROTOCOL://$SERVICE_HOST:8773/" \ |
| ... | ... |
@@ -454,8 +451,8 @@ function create_nova_accounts {
|
| 454 | 454 |
if is_service_enabled n-obj swift3; then |
| 455 | 455 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 456 | 456 |
|
| 457 |
- local s3_service=$(get_or_create_service "s3" "s3" "S3") |
|
| 458 |
- get_or_create_endpoint $s3_service \ |
|
| 457 |
+ get_or_create_service "s3" "s3" "S3" |
|
| 458 |
+ get_or_create_endpoint "s3" \ |
|
| 459 | 459 |
"$REGION_NAME" \ |
| 460 | 460 |
"http://$SERVICE_HOST:$S3_SERVICE_PORT" \ |
| 461 | 461 |
"http://$SERVICE_HOST:$S3_SERVICE_PORT" \ |
| ... | ... |
@@ -608,9 +608,8 @@ function create_swift_accounts {
|
| 608 | 608 |
|
| 609 | 609 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 610 | 610 |
|
| 611 |
- local swift_service=$(get_or_create_service "swift" \ |
|
| 612 |
- "object-store" "Swift Service") |
|
| 613 |
- get_or_create_endpoint $swift_service \ |
|
| 611 |
+ get_or_create_service "swift" "object-store" "Swift Service" |
|
| 612 |
+ get_or_create_endpoint "object-store" \ |
|
| 614 | 613 |
"$REGION_NAME" \ |
| 615 | 614 |
"$SWIFT_SERVICE_PROTOCOL://$SERVICE_HOST:8080/v1/AUTH_\$(tenant_id)s" \ |
| 616 | 615 |
"$SWIFT_SERVICE_PROTOCOL://$SERVICE_HOST:8080" \ |
| ... | ... |
@@ -270,11 +270,11 @@ function configure_tempest {
|
| 270 | 270 |
fi |
| 271 | 271 |
fi |
| 272 | 272 |
|
| 273 |
- EC2_URL=$(openstack endpoint show -f value -c publicurl ec2 || true) |
|
| 273 |
+ EC2_URL=$(get_endpoint_url ec2 public || true) |
|
| 274 | 274 |
if [[ -z $EC2_URL ]]; then |
| 275 | 275 |
EC2_URL="$EC2_SERVICE_PROTOCOL://$SERVICE_HOST:8773/" |
| 276 | 276 |
fi |
| 277 |
- S3_URL=$(openstack endpoint show -f value -c publicurl s3 || true) |
|
| 277 |
+ S3_URL=$(get_endpoint_url s3 public || true) |
|
| 278 | 278 |
if [[ -z $S3_URL ]]; then |
| 279 | 279 |
S3_URL="http://$SERVICE_HOST:${S3_SERVICE_PORT:-3333}"
|
| 280 | 280 |
fi |
| ... | ... |
@@ -210,9 +210,8 @@ function create_zaqar_accounts {
|
| 210 | 210 |
|
| 211 | 211 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
| 212 | 212 |
|
| 213 |
- local zaqar_service=$(get_or_create_service "zaqar" \ |
|
| 214 |
- "messaging" "Zaqar Service") |
|
| 215 |
- get_or_create_endpoint $zaqar_service \ |
|
| 213 |
+ get_or_create_service "zaqar" "messaging" "Zaqar Service" |
|
| 214 |
+ get_or_create_endpoint "messaging" \ |
|
| 216 | 215 |
"$REGION_NAME" \ |
| 217 | 216 |
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT" \ |
| 218 | 217 |
"$ZAQAR_SERVICE_PROTOCOL://$ZAQAR_SERVICE_HOST:$ZAQAR_SERVICE_PORT" \ |