Move endpoint registering into the devstack plugin

Endpoing registering which was previously restricted to the
functional tests, now can be enabled in the devstack plugin by
adding `REGISTER_MIXMATCH=true` to `local.conf`.

Change-Id: I1aedcd57819d41a26f38dd5e30b6bc4692684f36
This commit is contained in:
Kristi Nikolla 2017-07-05 10:23:11 +00:00
parent 6f5a885fa4
commit 8ee42dff50
4 changed files with 50 additions and 41 deletions

View File

@ -56,3 +56,45 @@ function configure_mixmatch {
iniset $GLANCE_CONF oslo_messaging_notifications driver messaging
iniset $CINDER_CONF oslo_messaging_notifications topics notifications
}
function get_endpoint_ids {
echo `openstack endpoint list --service $1 -c ID -f value`
}
function register_mixmatch {
if [ "$REGISTER_MIXMATCH" == "true" ]; then
# Update the endpoints
openstack endpoint delete `get_endpoint_ids image`
openstack endpoint delete `get_endpoint_ids volume`
openstack endpoint delete `get_endpoint_ids volumev2`
openstack endpoint delete `get_endpoint_ids volumev3`
get_or_create_endpoint \
"image" \
"$REGION_NAME" \
"http://$HOST_IP:5001/image" \
"http://$HOST_IP:5001/image" \
"http://$HOST_IP:5001/image"
get_or_create_endpoint \
"volume" \
"$REGION_NAME" \
"http://$HOST_IP:5001/volume/v1/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v1/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v1/\$(project_id)s"
get_or_create_endpoint \
"volumev2" \
"$REGION_NAME" \
"http://$HOST_IP:5001/volume/v2/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v2/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v2/\$(project_id)s"
get_or_create_endpoint \
"volumev3" \
"$REGION_NAME" \
"http://$HOST_IP:5001/volume/v3/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v3/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v3/\$(project_id)s"
fi
}

View File

@ -36,7 +36,9 @@ elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# This phase is executed after the projects have been started
echo "Mix & match plugin - Extra phase"
:
if is_service_enabled mixmatch; then
register_mixmatch
fi
fi
if [[ "$1" == "unstack" ]]; then

View File

@ -6,3 +6,5 @@ MIXMATCH_CONF=/etc/mixmatch/mixmatch.conf
MIXMATCH_SERVICE_PORT=${MIXMATCH_SERVICE_PORT:-5001}
MIXMATCH_SERVICE_PROTOCOL=${MIXMATCH_SERVICE_PROTOCOL:-http}
REGISTER_MIXMATCH=${REGISTER_MIXMATCH:-false}

View File

@ -14,50 +14,13 @@
# License for the specific language governing permissions and limitations
# under the License.
function get_endpoint_ids {
echo `openstack endpoint list --service $1 -c ID -f value`
}
function register_mixmatch {
# Update the endpoints
openstack endpoint delete `get_endpoint_ids image`
openstack endpoint delete `get_endpoint_ids volume`
openstack endpoint delete `get_endpoint_ids volumev2`
openstack endpoint delete `get_endpoint_ids volumev3`
get_or_create_endpoint \
"image" \
"$REGION_NAME" \
"http://$HOST_IP:5001/image" \
"http://$HOST_IP:5001/image" \
"http://$HOST_IP:5001/image"
get_or_create_endpoint \
"volume" \
"$REGION_NAME" \
"http://$HOST_IP:5001/volume/v1/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v1/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v1/\$(project_id)s"
get_or_create_endpoint \
"volumev2" \
"$REGION_NAME" \
"http://$HOST_IP:5001/volume/v2/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v2/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v2/\$(project_id)s"
get_or_create_endpoint \
"volumev3" \
"$REGION_NAME" \
"http://$HOST_IP:5001/volume/v3/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v3/\$(project_id)s" \
"http://$HOST_IP:5001/volume/v3/\$(project_id)s"
}
# Get admin credentials
cd $BASE/new/devstack
source openrc admin admin
# Register the endpoints
source $BASE/new/mixmatch/devstack/mixmatch.sh
REGISTER_MIXMATCH=true
register_mixmatch
# Restart Nova and Cinder so they use the proxy endpoints