From 699d34346004aff344521961754b1a456b842ec6 Mon Sep 17 00:00:00 2001 From: Ignatious Johnson Christopher Date: Sat, 13 Feb 2016 22:44:05 -0800 Subject: [PATCH] Though the user sets regoin_name in testbed.py, RegionName is hardcoded to RegionOne while creating endpoints. Fixing it to use the user provided region name. Change-Id: I79f2adf89218eeb478202c625c7e1702d4d9bdf6 Partial-Bug: 1483902 --- .../config/quantum_in_keystone_setup.py | 3 ++- .../ha/scripts/contrail-ha-keystone-setup.sh | 16 +++++++------- .../scripts/contrail-keystone-setup.sh | 18 +++++++-------- .../scripts/keystone-server-setup.sh | 3 +++ contrail_provisioning/openstack/setup.py | 3 +++ .../storage/storagefs/setup.py | 22 ++++++++++++------- 6 files changed, 39 insertions(+), 26 deletions(-) diff --git a/contrail_provisioning/config/quantum_in_keystone_setup.py b/contrail_provisioning/config/quantum_in_keystone_setup.py index 12799667..bf0212ea 100644 --- a/contrail_provisioning/config/quantum_in_keystone_setup.py +++ b/contrail_provisioning/config/quantum_in_keystone_setup.py @@ -243,7 +243,8 @@ def quant_set_user_admin_role(self): def quant_set_endpoints(self): # check if endpoint exists try: - quant_ends = self.kshandle.endpoints.find(service_id=self.quant_svc_id) + quant_ends = self.kshandle.endpoints.find(region=self._args.region_name, + service_id=self.quant_svc_id) if quant_ends: # service tenant exists! possible that the openstack node is setup independently # delete and recreate it diff --git a/contrail_provisioning/openstack/ha/scripts/contrail-ha-keystone-setup.sh b/contrail_provisioning/openstack/ha/scripts/contrail-ha-keystone-setup.sh index 335713ee..0255f929 100755 --- a/contrail_provisioning/openstack/ha/scripts/contrail-ha-keystone-setup.sh +++ b/contrail_provisioning/openstack/ha/scripts/contrail-ha-keystone-setup.sh @@ -199,7 +199,7 @@ fi if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $NOVA_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $NOVA_SERVICE \ + keystone endpoint-create --region $REGION_NAME --service-id $NOVA_SERVICE \ --publicurl 'http://'$CONTROLLER':8774/v1.1/$(tenant_id)s' \ --adminurl 'http://localhost:$(compute_port)s/v1.1/$(tenant_id)s' \ --internalurl 'http://'$CONTROLLER':8774/v1.1/$(tenant_id)s' @@ -209,7 +209,7 @@ fi EC2_SERVICE=$(get_service ec2 ec2 "EC2 Compatibility Layer") if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $EC2_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $EC2_SERVICE \ + keystone endpoint-create --region $REGION_NAME --service-id $EC2_SERVICE \ --publicurl http://localhost:8773/services/Cloud \ --adminurl http://localhost:8773/services/Admin \ --internalurl http://localhost:8773/services/Cloud @@ -227,7 +227,7 @@ fi if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $GLANCE_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $GLANCE_SERVICE \ + keystone endpoint-create --region $REGION_NAME --service-id $GLANCE_SERVICE \ --publicurl http://$CONTROLLER:9292/v1 \ --adminurl http://localhost:9393/v1 \ --internalurl http://localhost:9393/v1 @@ -237,7 +237,7 @@ fi KEYSTONE_SERVICE=$(get_service keystone identity "Keystone Identity Service") if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $KEYSTONE_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $KEYSTONE_SERVICE \ + keystone endpoint-create --region $REGION_NAME --service-id $KEYSTONE_SERVICE \ --publicurl 'http://'$CONTROLLER':5000/v2.0' \ --adminurl 'http://'$CONTROLLER':35357/v2.0' \ --internalurl 'http://'$CONTROLLER':35357/v2.0' @@ -255,7 +255,7 @@ fi if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $CINDER_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $CINDER_SERVICE \ + keystone endpoint-create --region $REGION_NAME --service-id $CINDER_SERVICE \ --publicurl 'http://'$CONTROLLER':8776/v1/$(tenant_id)s' \ --adminurl 'http://localhost:9776/v1/$(tenant_id)s' \ --internalurl 'http://localhost:9776/v1/$(tenant_id)s' @@ -277,7 +277,7 @@ if [[ -n "$ENABLE_SWIFT" ]]; then --user-id $SWIFT_USER \ --role-id $ADMIN_ROLE if [[ -n "$ENABLE_ENDPOINTS" ]]; then - keystone endpoint-create --region RegionOne --service-id $SWIFT_SERVICE \ + keystone endpoint-create --region $REGION_NAME --service-id $SWIFT_SERVICE \ --publicurl 'http://localhost:8080/v1/AUTH_$(tenant_id)s' \ --adminurl 'http://localhost:8080/v1/AUTH_$(tenant_id)s' \ --internalurl 'http://localhost:8080/v1/AUTH_$(tenant_id)s' @@ -295,7 +295,7 @@ if [[ -n "$ENABLE_QUANTUM" ]]; then if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $QUANTUM_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $QUANTUM_SERVICE \ + keystone endpoint-create --region $REGION_NAME --service-id $QUANTUM_SERVICE \ --publicurl http://'$CONTROLLER':9696 \ --adminurl http://'$CONTROLLER':9696 \ --internalurl http://'$CONTROLLER':9696 @@ -316,7 +316,7 @@ if [[ -n "$ENABLE_HEAT" ]]; then if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $HEAT_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $HEAT_SERVICE \ + keystone endpoint-create --region $REGION_NAME --service-id $HEAT_SERVICE \ --publicurl 'http://'$CONTROLLER':8004/v1/%(tenant_id)s' \ --adminurl 'http://'$CONTROLLER:'8004/v1/%(tenant_id)s' \ --internalurl 'http://'$CONTROLLER':8004/v1/%(tenant_id)s' diff --git a/contrail_provisioning/openstack/scripts/contrail-keystone-setup.sh b/contrail_provisioning/openstack/scripts/contrail-keystone-setup.sh index 2968eb8f..b66364b4 100644 --- a/contrail_provisioning/openstack/scripts/contrail-keystone-setup.sh +++ b/contrail_provisioning/openstack/scripts/contrail-keystone-setup.sh @@ -184,7 +184,7 @@ function get_service_user() { } function endpoint_lookup() { - echo $(keystone endpoint-list | grep ' '$1' ' | awk '{print $2;}' ) + echo $(keystone --os-region-name $OS_REGION_NAME endpoint-list | grep ' '$1' ' | awk '{print $2;}' ) } NOVA_SERVICE=$(get_service nova compute "Nova Compute Service") @@ -198,7 +198,7 @@ fi if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $NOVA_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $NOVA_SERVICE \ + keystone endpoint-create --region $OS_REGION_NAME --service-id $NOVA_SERVICE \ --publicurl 'http://'$CONTROLLER':$(compute_port)s/v1.1/$(tenant_id)s' \ --adminurl 'http://'$CONTROLLER:'$(compute_port)s/v1.1/$(tenant_id)s' \ --internalurl 'http://'$CONTROLLER:'$(compute_port)s/v1.1/$(tenant_id)s' @@ -208,7 +208,7 @@ fi EC2_SERVICE=$(get_service ec2 ec2 "EC2 Compatibility Layer") if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $EC2_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $EC2_SERVICE \ + keystone endpoint-create --region $OS_REGION_NAME --service-id $EC2_SERVICE \ --publicurl http://localhost:8773/services/Cloud \ --adminurl http://localhost:8773/services/Admin \ --internalurl http://localhost:8773/services/Cloud @@ -226,7 +226,7 @@ fi if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $GLANCE_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $GLANCE_SERVICE \ + keystone endpoint-create --region $OS_REGION_NAME --service-id $GLANCE_SERVICE \ --publicurl http://$CONTROLLER:9292/v1 \ --adminurl http://$CONTROLLER:9292/v1 \ --internalurl http://$CONTROLLER:9292/v1 @@ -236,7 +236,7 @@ fi KEYSTONE_SERVICE=$(get_service keystone identity "Keystone Identity Service") if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $KEYSTONE_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $KEYSTONE_SERVICE \ + keystone endpoint-create --region $OS_REGION_NAME --service-id $KEYSTONE_SERVICE \ --publicurl 'http://'$CONTROLLER':$(public_port)s/v2.0' \ --adminurl 'http://'$CONTROLLER':$(admin_port)s/v2.0' \ --internalurl 'http://'$CONTROLLER':$(admin_port)s/v2.0' @@ -280,7 +280,7 @@ fi if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $CINDER_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $CINDER_SERVICE \ + keystone endpoint-create --region $OS_REGION_NAME --service-id $CINDER_SERVICE \ --publicurl 'http://'$CONTROLLER':8776/'$CINDER_SERVICE_TYPE'/$(tenant_id)s' \ --adminurl 'http://'$CONTROLLER':8776/'$CINDER_SERVICE_TYPE'/$(tenant_id)s' \ --internalurl 'http://'$CONTROLLER':8776/'$CINDER_SERVICE_TYPE'/$(tenant_id)s' @@ -302,7 +302,7 @@ if [[ -n "$ENABLE_SWIFT" ]]; then --user-id $SWIFT_USER \ --role-id $ADMIN_ROLE if [[ -n "$ENABLE_ENDPOINTS" ]]; then - keystone endpoint-create --region RegionOne --service-id $SWIFT_SERVICE \ + keystone endpoint-create --region $OS_REGION_NAME --service-id $SWIFT_SERVICE \ --publicurl 'http://localhost:8080/v1/AUTH_$(tenant_id)s' \ --adminurl 'http://localhost:8080/v1/AUTH_$(tenant_id)s' \ --internalurl 'http://localhost:8080/v1/AUTH_$(tenant_id)s' @@ -320,7 +320,7 @@ if [[ -n "$ENABLE_QUANTUM" ]]; then if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $QUANTUM_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $QUANTUM_SERVICE \ + keystone endpoint-create --region $OS_REGION_NAME --service-id $QUANTUM_SERVICE \ --publicurl http://localhost:9696 \ --adminurl http://localhost:9696 \ --internalurl http://localhost:9696 @@ -341,7 +341,7 @@ if [[ -n "$ENABLE_HEAT" ]]; then if [[ -n "$ENABLE_ENDPOINTS" ]]; then if [ -z $(endpoint_lookup $HEAT_SERVICE) ]; then - keystone endpoint-create --region RegionOne --service-id $HEAT_SERVICE \ + keystone endpoint-create --region $OS_REGION_NAME --service-id $HEAT_SERVICE \ --publicurl 'http://'$CONTROLLER':8004/v1/%(tenant_id)s' \ --adminurl 'http://'$CONTROLLER:'8004/v1/%(tenant_id)s' \ --internalurl 'http://'$CONTROLLER':8004/v1/%(tenant_id)s' diff --git a/contrail_provisioning/openstack/scripts/keystone-server-setup.sh b/contrail_provisioning/openstack/scripts/keystone-server-setup.sh index 231b0366..ce357623 100755 --- a/contrail_provisioning/openstack/scripts/keystone-server-setup.sh +++ b/contrail_provisioning/openstack/scripts/keystone-server-setup.sh @@ -113,6 +113,7 @@ if [ -d /var/log/keystone ]; then fi # Set up a keystonerc file with admin password +REGION_NAME=${REGION_NAME:-RegionOne} OPENSTACK_INDEX=${OPENSTACK_INDEX:-0} INTERNAL_VIP=${INTERNAL_VIP:-none} if [ "$INTERNAL_VIP" != "none" ]; then @@ -132,12 +133,14 @@ export OS_PASSWORD=$ADMIN_PASSWORD export OS_TENANT_NAME=admin export OS_AUTH_URL=${AUTH_PROTOCOL}://$controller_ip:5000/v2.0/ export OS_NO_CACHE=1 +export OS_REGION_NAME=$REGION_NAME EOF cat > $CONF_DIR/keystonerc <