Don't check for existing endpoints
We really should only have code that create endpoints once, making all osc calls get_or_set adds 3 seconds per call for no really good reason. This also stops creating the internal endpoints in the service catalog. It's a pattern that we're trying not to propogate, so lets not have it in devstack any more. Change-Id: Ia8cefe43753900d62117beae330db46deb6a9fc9
This commit is contained in:
parent
54f331969f
commit
7d1ec43004
@ -987,38 +987,35 @@ function get_or_create_service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Create an endpoint with a specific interface
|
# Create an endpoint with a specific interface
|
||||||
# Usage: _get_or_create_endpoint_with_interface <service> <interface> <url> <region>
|
# Usage: _create_endpoint_with_interface <service> <interface> <url> <region>
|
||||||
function _get_or_create_endpoint_with_interface {
|
function _create_endpoint_with_interface {
|
||||||
|
# Creates new endpoint
|
||||||
local endpoint_id
|
local endpoint_id
|
||||||
endpoint_id=$(openstack endpoint list \
|
endpoint_id=$(openstack endpoint create \
|
||||||
--service $1 \
|
$1 $2 $3 --region $4 -f value -c id)
|
||||||
--interface $2 \
|
|
||||||
--region $4 \
|
|
||||||
-c ID -f value)
|
|
||||||
if [[ -z "$endpoint_id" ]]; then
|
|
||||||
# Creates new endpoint
|
|
||||||
endpoint_id=$(openstack endpoint create \
|
|
||||||
$1 $2 $3 --region $4 -f value -c id)
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo $endpoint_id
|
echo $endpoint_id
|
||||||
}
|
}
|
||||||
|
|
||||||
# Gets or creates endpoint
|
# TODO(sdague): remove in O
|
||||||
# Usage: get_or_create_endpoint <service> <region> <publicurl> <adminurl> <internalurl>
|
|
||||||
function get_or_create_endpoint {
|
function get_or_create_endpoint {
|
||||||
|
deprecated "get_or_create_endpoint is deprecated. Use create_endpoint instead"
|
||||||
|
create_endpoint $@
|
||||||
|
}
|
||||||
|
|
||||||
|
# Gets or creates endpoint
|
||||||
|
# Usage: create_endpoint <service> <region> <publicurl> <adminurl>
|
||||||
|
function create_endpoint {
|
||||||
# NOTE(jamielennnox): when converting to v3 endpoint creation we go from
|
# NOTE(jamielennnox): when converting to v3 endpoint creation we go from
|
||||||
# creating one endpoint with multiple urls to multiple endpoints each with
|
# creating one endpoint with multiple urls to multiple endpoints each with
|
||||||
# a different interface. To maintain the existing function interface we
|
# a different interface. To maintain the existing function interface we
|
||||||
# create 3 endpoints and return the id of the public one. In reality
|
# create 2 endpoints and return the id of the public one. In reality
|
||||||
# returning the public id will not make a lot of difference as there are no
|
# returning the public id will not make a lot of difference as there are no
|
||||||
# scenarios currently that use the returned id. Ideally this behaviour
|
# scenarios currently that use the returned id. Ideally this behaviour
|
||||||
# should be pushed out to the service setups and let them create the
|
# should be pushed out to the service setups and let them create the
|
||||||
# endpoints they need.
|
# endpoints they need.
|
||||||
local public_id
|
local public_id
|
||||||
public_id=$(_get_or_create_endpoint_with_interface $1 public $3 $2)
|
public_id=$(_create_endpoint_with_interface $1 public $3 $2)
|
||||||
_get_or_create_endpoint_with_interface $1 admin $4 $2
|
_create_endpoint_with_interface $1 admin $4 $2
|
||||||
_get_or_create_endpoint_with_interface $1 internal $5 $2
|
|
||||||
|
|
||||||
# return the public id to indicate success, and this is the endpoint most likely wanted
|
# return the public id to indicate success, and this is the endpoint most likely wanted
|
||||||
echo $public_id
|
echo $public_id
|
||||||
|
@ -372,7 +372,7 @@ function create_cinder_accounts {
|
|||||||
create_service_user "cinder"
|
create_service_user "cinder"
|
||||||
|
|
||||||
get_or_create_service "cinder" "volume" "Cinder Volume Service"
|
get_or_create_service "cinder" "volume" "Cinder Volume Service"
|
||||||
get_or_create_endpoint \
|
create_endpoint \
|
||||||
"volume" \
|
"volume" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(project_id)s" \
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(project_id)s" \
|
||||||
@ -380,7 +380,7 @@ function create_cinder_accounts {
|
|||||||
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(project_id)s"
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(project_id)s"
|
||||||
|
|
||||||
get_or_create_service "cinderv2" "volumev2" "Cinder Volume Service V2"
|
get_or_create_service "cinderv2" "volumev2" "Cinder Volume Service V2"
|
||||||
get_or_create_endpoint \
|
create_endpoint \
|
||||||
"volumev2" \
|
"volumev2" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(project_id)s" \
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(project_id)s" \
|
||||||
@ -388,7 +388,7 @@ function create_cinder_accounts {
|
|||||||
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(project_id)s"
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(project_id)s"
|
||||||
|
|
||||||
get_or_create_service "cinderv3" "volumev3" "Cinder Volume Service V3"
|
get_or_create_service "cinderv3" "volumev3" "Cinder Volume Service V3"
|
||||||
get_or_create_endpoint \
|
create_endpoint \
|
||||||
"volumev3" \
|
"volumev3" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v3/\$(project_id)s" \
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v3/\$(project_id)s" \
|
||||||
|
@ -292,7 +292,7 @@ function create_glance_accounts {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
get_or_create_service "glance" "image" "Glance Image Service"
|
get_or_create_service "glance" "image" "Glance Image Service"
|
||||||
get_or_create_endpoint \
|
create_endpoint \
|
||||||
"image" \
|
"image" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT" \
|
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT" \
|
||||||
@ -305,7 +305,7 @@ function create_glance_accounts {
|
|||||||
create_service_user "glare"
|
create_service_user "glare"
|
||||||
get_or_create_service "glare" "artifact" "Glance Artifact Service"
|
get_or_create_service "glare" "artifact" "Glance Artifact Service"
|
||||||
|
|
||||||
get_or_create_endpoint "artifact" \
|
create_endpoint "artifact" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_GLARE_HOSTPORT" \
|
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_GLARE_HOSTPORT" \
|
||||||
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_GLARE_HOSTPORT" \
|
"$GLANCE_SERVICE_PROTOCOL://$GLANCE_GLARE_HOSTPORT" \
|
||||||
|
4
lib/heat
4
lib/heat
@ -388,7 +388,7 @@ function create_heat_accounts {
|
|||||||
|
|
||||||
create_service_user "heat" "admin"
|
create_service_user "heat" "admin"
|
||||||
get_or_create_service "heat" "orchestration" "Heat Orchestration Service"
|
get_or_create_service "heat" "orchestration" "Heat Orchestration Service"
|
||||||
get_or_create_endpoint \
|
create_endpoint \
|
||||||
"orchestration" \
|
"orchestration" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(project_id)s" \
|
"$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(project_id)s" \
|
||||||
@ -396,7 +396,7 @@ function create_heat_accounts {
|
|||||||
"$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(project_id)s"
|
"$SERVICE_PROTOCOL://$HEAT_API_HOST:$HEAT_API_PORT/v1/\$(project_id)s"
|
||||||
|
|
||||||
get_or_create_service "heat-cfn" "cloudformation" "Heat CloudFormation Service"
|
get_or_create_service "heat-cfn" "cloudformation" "Heat CloudFormation Service"
|
||||||
get_or_create_endpoint \
|
create_endpoint \
|
||||||
"cloudformation" \
|
"cloudformation" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \
|
"$SERVICE_PROTOCOL://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1" \
|
||||||
|
@ -534,7 +534,7 @@ function create_neutron_accounts {
|
|||||||
create_service_user "neutron"
|
create_service_user "neutron"
|
||||||
|
|
||||||
get_or_create_service "neutron" "network" "Neutron Service"
|
get_or_create_service "neutron" "network" "Neutron Service"
|
||||||
get_or_create_endpoint \
|
create_endpoint \
|
||||||
"network" \
|
"network" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$Q_PROTOCOL://$SERVICE_HOST:$Q_PORT/" \
|
"$Q_PROTOCOL://$SERVICE_HOST:$Q_PORT/" \
|
||||||
|
6
lib/nova
6
lib/nova
@ -418,7 +418,7 @@ function create_nova_accounts {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
get_or_create_service "nova_legacy" "compute_legacy" "Nova Compute Service (Legacy 2.0)"
|
get_or_create_service "nova_legacy" "compute_legacy" "Nova Compute Service (Legacy 2.0)"
|
||||||
get_or_create_endpoint \
|
create_endpoint \
|
||||||
"compute_legacy" \
|
"compute_legacy" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$nova_api_url/v2/\$(project_id)s" \
|
"$nova_api_url/v2/\$(project_id)s" \
|
||||||
@ -426,7 +426,7 @@ function create_nova_accounts {
|
|||||||
"$nova_api_url/v2/\$(project_id)s"
|
"$nova_api_url/v2/\$(project_id)s"
|
||||||
|
|
||||||
get_or_create_service "nova" "compute" "Nova Compute Service"
|
get_or_create_service "nova" "compute" "Nova Compute Service"
|
||||||
get_or_create_endpoint \
|
create_endpoint \
|
||||||
"compute" \
|
"compute" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$nova_api_url/v2.1" \
|
"$nova_api_url/v2.1" \
|
||||||
@ -446,7 +446,7 @@ function create_nova_accounts {
|
|||||||
# S3
|
# S3
|
||||||
if is_service_enabled swift3; then
|
if is_service_enabled swift3; then
|
||||||
get_or_create_service "s3" "s3" "S3"
|
get_or_create_service "s3" "s3" "S3"
|
||||||
get_or_create_endpoint \
|
create_endpoint \
|
||||||
"s3" \
|
"s3" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"http://$SERVICE_HOST:$S3_SERVICE_PORT" \
|
"http://$SERVICE_HOST:$S3_SERVICE_PORT" \
|
||||||
|
@ -633,7 +633,7 @@ function create_swift_accounts {
|
|||||||
create_service_user "swift" "admin"
|
create_service_user "swift" "admin"
|
||||||
|
|
||||||
get_or_create_service "swift" "object-store" "Swift Service"
|
get_or_create_service "swift" "object-store" "Swift Service"
|
||||||
get_or_create_endpoint \
|
create_endpoint \
|
||||||
"object-store" \
|
"object-store" \
|
||||||
"$REGION_NAME" \
|
"$REGION_NAME" \
|
||||||
"$SWIFT_SERVICE_PROTOCOL://$SERVICE_HOST:$SWIFT_DEFAULT_BIND_PORT/v1/AUTH_\$(project_id)s" \
|
"$SWIFT_SERVICE_PROTOCOL://$SERVICE_HOST:$SWIFT_DEFAULT_BIND_PORT/v1/AUTH_\$(project_id)s" \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user