diff --git a/devstack/mixmatch.sh b/devstack/mixmatch.sh new file mode 100644 index 0000000..a14daaa --- /dev/null +++ b/devstack/mixmatch.sh @@ -0,0 +1,64 @@ +# Copyright 2016 Massachusetts Open Cloud +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +function install_mixmatch { + cd $MIXMATCH_DIR + pip_install -r requirements.txt + sudo python setup.py install + + pip_install uwsgi +} + +function configure_mixmatch { + # Proxy + sudo mkdir -p /etc/mixmatch + sudo chown $STACK_USER:$STACK_USER /etc/mixmatch + cp $MIXMATCH_DIR/etc/mixmatch.conf.sample $MIXMATCH_CONF + + iniset $MIXMATCH_CONF database connection "sqlite://" + iniset $MIXMATCH_CONF DEFAULT port $MIXMATCH_SERVICE_PORT + iniset $MIXMATCH_CONF DEFAULT service_providers default + iniset $MIXMATCH_CONF DEFAULT aggregation False + + iniset $MIXMATCH_CONF auth auth_url \ + "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v3" + iniset $MIXMATCH_CONF auth username admin + iniset $MIXMATCH_CONF auth user_domain_id default + iniset $MIXMATCH_CONF auth project_name admin + iniset $MIXMATCH_CONF auth project_domain_id default + iniset $MIXMATCH_CONF auth password $ADMIN_PASSWORD + + iniset $MIXMATCH_CONF sp_default sp_name default + iniset $MIXMATCH_CONF sp_default auth_url \ + "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v3" + iniset $MIXMATCH_CONF sp_default image_endpoint \ + "$GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT" + iniset $MIXMATCH_CONF sp_default volume_endpoint \ + "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT" + + run_process mixmatch "$MIXMATCH_DIR/run_proxy.sh" + + # Nova + iniset $NOVA_CONF glance api_servers "$MIXMATCH_SERVICE_PROTOCOL://$HOST_IP:$MIXMATCH_SERVICE_PORT/image" + + # Cinder + iniset $CINDER_CONF DEFAULT glance_api_servers \ + "$MIXMATCH_SERVICE_PROTOCOL://$HOST_IP:$MIXMATCH_SERVICE_PORT/image" + iniset $CINDER_CONF oslo_messaging_notifications driver messaging + iniset $CINDER_CONF oslo_messaging_notifications topics notifications + + # Glance + iniset $GLANCE_CONF oslo_messaging_notifications driver messaging + iniset $CINDER_CONF oslo_messaging_notifications topics notifications +} diff --git a/devstack/plugin.sh b/devstack/plugin.sh index f09e08b..d95b7fc 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -12,6 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. +source $MIXMATCH_PLUGIN/mixmatch.sh + # For more information on Devstack plugins, including a more detailed # explanation on when the different steps are executed please see: # http://docs.openstack.org/developer/devstack/plugins.html @@ -19,16 +21,22 @@ if [[ "$1" == "stack" && "$2" == "install" ]]; then # This phase is executed after the projects have been installed echo "Mix & match plugin - Install phase" + if is_service_enabled mixmatch; then + install_mixmatch + fi elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then # This phase is executed after the projects have been configured and # before they are started echo "Mix & match plugin - Post-config phase" + if is_service_enabled mixmatch; then + configure_mixmatch + fi elif [[ "$1" == "stack" && "$2" == "extra" ]]; then # This phase is executed after the projects have been started echo "Mix & match plugin - Extra phase" - + : fi if [[ "$1" == "unstack" ]]; then diff --git a/devstack/settings b/devstack/settings new file mode 100644 index 0000000..9859d4c --- /dev/null +++ b/devstack/settings @@ -0,0 +1,8 @@ +enable_service mixmatch + +MIXMATCH_DIR=$DEST/mixmatch +MIXMATCH_PLUGIN=$DEST/mixmatch/devstack +MIXMATCH_CONF=/etc/mixmatch/mixmatch.conf + +MIXMATCH_SERVICE_PORT=${MIXMATCH_SERVICE_PORT:-5001} +MIXMATCH_SERVICE_PROTOCOL=${MIXMATCH_SERVICE_PROTOCOL:-http} diff --git a/mixmatch/tests/functional/hooks/dsvm_hook.sh b/mixmatch/tests/functional/hooks/dsvm_hook.sh old mode 100644 new mode 100755 index 1b1cbac..f47c7a5 --- a/mixmatch/tests/functional/hooks/dsvm_hook.sh +++ b/mixmatch/tests/functional/hooks/dsvm_hook.sh @@ -14,4 +14,50 @@ # 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_mixmatch + exit 0