diff --git a/devstack/README.rst b/devstack/README.rst new file mode 100644 index 0000000..419bf22 --- /dev/null +++ b/devstack/README.rst @@ -0,0 +1,25 @@ +========================= +Enabling Aetos in DevStack +========================= + +1. Download DevStack:: + + git clone https://opendev.org/openstack/devstack.git + cd devstack + +2. Add this repo as an external repository in ``local.conf`` file:: + + [[local|localrc]] + enable_plugin aetos https://opendev.org/openstack/aetos + + To use stable branches, make sure devstack is on that branch, and specify + the branch name to enable_plugin, for example:: + + enable_plugin aetos https://opendev.org/openstack/aetos stable/2025.1 + + There are some options, defined in + ``aetos/devstack/settings``, they can be used to configure the installation + of Aetos. If you don't want to use their default value, you can set a new + one in ``local.conf``. + +3. Run ``stack.sh``. diff --git a/devstack/plugin.sh b/devstack/plugin.sh new file mode 100644 index 0000000..4c8754f --- /dev/null +++ b/devstack/plugin.sh @@ -0,0 +1,130 @@ +# Install and start **Aetos** service in devstack +# +# To enable Aetos in devstack add an entry to local.conf that +# looks like +# +# [[local|localrc]] +# enable_plugin aetos https://opendev.org/openstack/aetos + +# Support potential entry-points console scripts in VENV or not +if [[ ${USE_VENV} = True ]]; then + PROJECT_VENV["aetos"]=${AETOS_DIR}.venv + AETOS_BIN_DIR=${PROJECT_VENV["aetos"]}/bin +else + AETOS_BIN_DIR=$(get_python_exec_prefix) +fi + +# Test if any Aetos services are enabled +# is_aetos_enabled +function is_aetos_enabled { + [[ ,${ENABLED_SERVICES} =~ ,"aetos" ]] && return 0 + return 1 +} + +function aetos_service_url { + echo "$AETOS_SERVICE_PROTOCOL://$AETOS_SERVICE_HOST/prometheus" +} + +# Create aetos related accounts in Keystone +function _aetos_create_accounts { + if is_service_enabled aetos; then + + create_service_user "aetos" "admin" + + get_or_create_service "aetos" "prometheus" "OpenStack Aetos Service" + get_or_create_endpoint 'prometheus' "$REGION_NAME" "$(aetos_service_url)" + fi +} + +# cleanup_aetos() - Remove residual data files, anything left over +# from previous runs that a clean run would need to clean up +function cleanup_aetos { + remove_uwsgi_config "$AETOS_UWSGI_CONF" "aetos" +} + +# Configure Aetos +function configure_aetos { + iniset $AETOS_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL" + + # Set up logging + iniset $AETOS_CONF DEFAULT use_syslog $SYSLOG + + # Format logging + setup_logging $AETOS_CONF DEFAULT + + iniset $AETOS_CONF service_credentials auth_type password + iniset $AETOS_CONF service_credentials username aetos + iniset $AETOS_CONF service_credentials user_domain_id default + iniset $AETOS_CONF service_credentials project_domain_id default + iniset $AETOS_CONF service_credentials password $SERVICE_PASSWORD + iniset $AETOS_CONF service_credentials project_name $SERVICE_PROJECT_NAME + iniset $AETOS_CONF service_credentials region_name $REGION_NAME + iniset $AETOS_CONF service_credentials auth_url $KEYSTONE_SERVICE_URI + + configure_keystone_authtoken_middleware $AETOS_CONF aetos + + # iniset creates these files when it's called if they don't exist. + write_uwsgi_config "$AETOS_UWSGI_CONF" "$AETOS_UWSGI" "/prometheus" "" "aetos" +} + +# init_aetos() - Initialize etc. +function init_aetos { + # Get aetos keystone settings in place + _aetos_create_accounts +} + +# Install Aetos. +function install_aetos { + setup_develop $AETOS_DIR $AETOS_BACKEND + sudo install -d -o $STACK_USER -m 755 $AETOS_CONF_DIR + + pip_install uwsgi +} + +# start_aetos() - Start running processes, including screen +function start_aetos { + run_process aetos "$AETOS_BIN_DIR/uwsgi --ini $AETOS_UWSGI_CONF" +} + +# configure_tempest_for_aetos() +function configure_tempest_for_aetos { + if is_service_enabled tempest; then + iniset $TEMPEST_CONFIG service_available aetos True + fi +} + +# stop_aetos() - Stop running processes +function stop_aetos { + stop_process aetos +} + +# This is the main for plugin.sh +if is_service_enabled aetos; then + if [[ "$1" == "stack" && "$2" == "install" ]]; then + echo_summary "Installing Aetos" + # Use stack_install_service here to account for virtualenv + stack_install_service aetos + elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + echo_summary "Configuring Aetos" + configure_aetos + elif [[ "$1" == "stack" && "$2" == "extra" ]]; then + echo_summary "Initializing Aetos" + # Tidy base for aetos + init_aetos + # Start the service + start_aetos + elif [[ "$1" == "stack" && "$2" == "test-config" ]]; then + echo_summary "Configuring Tempest for Aetos" + configure_tempest_for_aetos + fi + + if [[ "$1" == "unstack" ]]; then + echo_summary "Shutting Down Aetos" + stop_aetos + fi + + if [[ "$1" == "clean" ]]; then + echo_summary "Cleaning Aetos" + cleanup_aetos + fi +fi diff --git a/devstack/settings b/devstack/settings new file mode 100644 index 0000000..7cb6930 --- /dev/null +++ b/devstack/settings @@ -0,0 +1,13 @@ +# Aetos service +enable_service aetos + +# Default directories +AETOS_DIR=$DEST/aetos +AETOS_CONF_DIR=/etc/aetos +AETOS_CONF=$AETOS_CONF_DIR/aetos.conf +AETOS_UWSGI_CONF=$AETOS_CONF_DIR/aetos-uwsgi.ini +AETOS_UWSGI=aetos.wsgi.api:application + +# Aetos connection info. +AETOS_SERVICE_PROTOCOL=http +AETOS_SERVICE_HOST=${AETOS_SERVICE_HOST:-$SERVICE_HOST}