Rename all Savanna usages to Sahara

There are several backward compatibility nits.

Change-Id: I93cac543375896602d158860cc557f86e41bcb63
This commit is contained in:
Sergey Lukjanov 2014-03-10 20:04:51 +04:00
parent 0c76039622
commit 7ff8443e46
7 changed files with 290 additions and 286 deletions

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash
# **savanna.sh**
# **sahara.sh**
# Sanity check that Savanna started if enabled
# Sanity check that Sahara started if enabled
echo "*********************************************************************"
echo "Begin DevStack Exercise: $0"
@ -33,9 +33,9 @@ source $TOP_DIR/openrc
# Import exercise configuration
source $TOP_DIR/exerciserc
is_service_enabled savanna || exit 55
is_service_enabled sahara || exit 55
curl http://$SERVICE_HOST:8386/ 2>/dev/null | grep -q 'Auth' || die $LINENO "Savanna API not functioning!"
curl http://$SERVICE_HOST:8386/ 2>/dev/null | grep -q 'Auth' || die $LINENO "Sahara API isn't functioning!"
set +o xtrace
echo "*********************************************************************"

37
extras.d/70-sahara.sh Normal file
View File

@ -0,0 +1,37 @@
# sahara.sh - DevStack extras script to install Sahara
if is_service_enabled sahara; then
if [[ "$1" == "source" ]]; then
# Initial source
source $TOP_DIR/lib/sahara
source $TOP_DIR/lib/sahara-dashboard
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing sahara"
install_sahara
cleanup_sahara
if is_service_enabled horizon; then
install_sahara_dashboard
fi
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring sahara"
configure_sahara
create_sahara_accounts
if is_service_enabled horizon; then
configure_sahara_dashboard
fi
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
echo_summary "Initializing sahara"
start_sahara
fi
if [[ "$1" == "unstack" ]]; then
stop_sahara
if is_service_enabled horizon; then
cleanup_sahara_dashboard
fi
fi
if [[ "$1" == "clean" ]]; then
cleanup_sahara
fi
fi

View File

@ -1,37 +0,0 @@
# savanna.sh - DevStack extras script to install Savanna
if is_service_enabled savanna; then
if [[ "$1" == "source" ]]; then
# Initial source
source $TOP_DIR/lib/savanna
source $TOP_DIR/lib/savanna-dashboard
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing Savanna"
install_savanna
cleanup_savanna
if is_service_enabled horizon; then
install_savanna_dashboard
fi
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring Savanna"
configure_savanna
create_savanna_accounts
if is_service_enabled horizon; then
configure_savanna_dashboard
fi
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
echo_summary "Initializing Savanna"
start_savanna
fi
if [[ "$1" == "unstack" ]]; then
stop_savanna
if is_service_enabled horizon; then
cleanup_savanna_dashboard
fi
fi
if [[ "$1" == "clean" ]]; then
cleanup_savanna
fi
fi

177
lib/sahara Normal file
View File

@ -0,0 +1,177 @@
# lib/sahara
# Dependencies:
# ``functions`` file
# ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
# ``stack.sh`` calls the entry points in this order:
#
# install_sahara
# configure_sahara
# start_sahara
# stop_sahara
# cleanup_sahara
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Defaults
# --------
# Set up default repos
SAHARA_REPO=${SAHARA_REPO:-${GIT_BASE}/openstack/sahara.git}
SAHARA_BRANCH=${SAHARA_BRANCH:-master}
# Set up default directories
SAHARA_DIR=$DEST/sahara
SAHARA_CONF_DIR=${SAHARA_CONF_DIR:-/etc/sahara}
SAHARA_CONF_FILE=${SAHARA_CONF_DIR}/sahara.conf
SAHARA_DEBUG=${SAHARA_DEBUG:-True}
SAHARA_SERVICE_HOST=${SAHARA_SERVICE_HOST:-$SERVICE_HOST}
SAHARA_SERVICE_PORT=${SAHARA_SERVICE_PORT:-8386}
SAHARA_SERVICE_PROTOCOL=${SAHARA_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
SAHARA_AUTH_CACHE_DIR=${SAHARA_AUTH_CACHE_DIR:-/var/cache/sahara}
# Support entry points installation of console scripts
if [[ -d $SAHARA_DIR/bin ]]; then
SAHARA_BIN_DIR=$SAHARA_DIR/bin
else
SAHARA_BIN_DIR=$(get_python_exec_prefix)
fi
# Tell Tempest this project is present
TEMPEST_SERVICES+=,sahara
# For backward compatibility with current tests in Tempest
TEMPEST_SERVICES+=,savanna
# Functions
# ---------
# create_sahara_accounts() - Set up common required sahara accounts
#
# Tenant User Roles
# ------------------------------
# service sahara admin
function create_sahara_accounts {
SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
SAHARA_USER=$(openstack user create \
sahara \
--password "$SERVICE_PASSWORD" \
--project $SERVICE_TENANT \
--email sahara@example.com \
| grep " id " | get_field 2)
openstack role add \
$ADMIN_ROLE \
--project $SERVICE_TENANT \
--user $SAHARA_USER
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
SAHARA_SERVICE=$(openstack service create \
sahara \
--type=data_processing \
--description="Sahara Data Processing" \
| grep " id " | get_field 2)
openstack endpoint create \
$SAHARA_SERVICE \
--region RegionOne \
--publicurl "$SAHARA_SERVICE_PROTOCOL://$SAHARA_SERVICE_HOST:$SAHARA_SERVICE_PORT/v1.1/\$(tenant_id)s" \
--adminurl "$SAHARA_SERVICE_PROTOCOL://$SAHARA_SERVICE_HOST:$SAHARA_SERVICE_PORT/v1.1/\$(tenant_id)s" \
--internalurl "$SAHARA_SERVICE_PROTOCOL://$SAHARA_SERVICE_HOST:$SAHARA_SERVICE_PORT/v1.1/\$(tenant_id)s"
fi
}
# cleanup_sahara() - Remove residual data files, anything left over from
# previous runs that would need to clean up.
function cleanup_sahara {
# Cleanup auth cache dir
sudo rm -rf $SAHARA_AUTH_CACHE_DIR
}
# configure_sahara() - Set config files, create data dirs, etc
function configure_sahara {
if [[ ! -d $SAHARA_CONF_DIR ]]; then
sudo mkdir -p $SAHARA_CONF_DIR
fi
sudo chown $STACK_USER $SAHARA_CONF_DIR
# Copy over sahara configuration file and configure common parameters.
# TODO(slukjanov): rename when sahara internals will be updated
cp $SAHARA_DIR/etc/savanna/savanna.conf.sample $SAHARA_CONF_FILE
# Create auth cache dir
sudo mkdir -p $SAHARA_AUTH_CACHE_DIR
sudo chown $STACK_USER $SAHARA_AUTH_CACHE_DIR
rm -rf $SAHARA_AUTH_CACHE_DIR/*
# Set obsolete keystone auth configs for backward compatibility
iniset $SAHARA_CONF_FILE DEFAULT os_auth_host $KEYSTONE_SERVICE_HOST
iniset $SAHARA_CONF_FILE DEFAULT os_auth_port $KEYSTONE_SERVICE_PORT
iniset $SAHARA_CONF_FILE DEFAULT os_auth_protocol $KEYSTONE_SERVICE_PROTOCOL
iniset $SAHARA_CONF_FILE DEFAULT os_admin_password $SERVICE_PASSWORD
iniset $SAHARA_CONF_FILE DEFAULT os_admin_username sahara
iniset $SAHARA_CONF_FILE DEFAULT os_admin_tenant_name $SERVICE_TENANT_NAME
# Set actual keystone auth configs
iniset $SAHARA_CONF_FILE keystone_authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/
iniset $SAHARA_CONF_FILE keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
iniset $SAHARA_CONF_FILE keystone_authtoken admin_user sahara
iniset $SAHARA_CONF_FILE keystone_authtoken admin_password $SERVICE_PASSWORD
iniset $SAHARA_CONF_FILE keystone_authtoken signing_dir $SAHARA_AUTH_CACHE_DIR
iniset $SAHARA_CONF_FILE keystone_authtoken cafile $KEYSTONE_SSL_CA
iniset $SAHARA_CONF_FILE DEFAULT debug $SAHARA_DEBUG
iniset $SAHARA_CONF_FILE database connection `database_connection_url sahara`
if is_service_enabled neutron; then
iniset $SAHARA_CONF_FILE DEFAULT use_neutron true
iniset $SAHARA_CONF_FILE DEFAULT use_floating_ips true
fi
if is_service_enabled heat; then
iniset $SAHARA_CONF_FILE DEFAULT infrastructure_engine heat
else
iniset $SAHARA_CONF_FILE DEFAULT infrastructure_engine direct
fi
iniset $SAHARA_CONF_FILE DEFAULT use_syslog $SYSLOG
recreate_database sahara utf8
$SAHARA_BIN_DIR/sahara-db-manage --config-file $SAHARA_CONF_FILE upgrade head
}
# install_sahara() - Collect source and prepare
function install_sahara {
git_clone $SAHARA_REPO $SAHARA_DIR $SAHARA_BRANCH
setup_develop $SAHARA_DIR
}
# start_sahara() - Start running processes, including screen
function start_sahara {
screen_it sahara "cd $SAHARA_DIR && $SAHARA_BIN_DIR/sahara-api --config-file $SAHARA_CONF_FILE"
}
# stop_sahara() - Stop running processes
function stop_sahara {
# Kill the Sahara screen windows
screen -S $SCREEN_NAME -p sahara -X kill
}
# Restore xtrace
$XTRACE
# Local variables:
# mode: shell-script
# End:

72
lib/sahara-dashboard Normal file
View File

@ -0,0 +1,72 @@
# lib/sahara-dashboard
# Dependencies:
#
# - ``functions`` file
# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
# - ``SERVICE_HOST``
# ``stack.sh`` calls the entry points in this order:
#
# - install_sahara_dashboard
# - configure_sahara_dashboard
# - cleanup_sahara_dashboard
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
source $TOP_DIR/lib/horizon
# Defaults
# --------
# Set up default repos
SAHARA_DASHBOARD_REPO=${SAHARA_DASHBOARD_REPO:-${GIT_BASE}/openstack/sahara-dashboard.git}
SAHARA_DASHBOARD_BRANCH=${SAHARA_DASHBOARD_BRANCH:-master}
SAHARA_PYTHONCLIENT_REPO=${SAHARA_PYTHONCLIENT_REPO:-${GIT_BASE}/openstack/python-saharaclient.git}
SAHARA_PYTHONCLIENT_BRANCH=${SAHARA_PYTHONCLIENT_BRANCH:-master}
# Set up default directories
SAHARA_DASHBOARD_DIR=$DEST/sahara-dashboard
SAHARA_PYTHONCLIENT_DIR=$DEST/python-saharaclient
# Functions
# ---------
function configure_sahara_dashboard {
echo -e "AUTO_ASSIGNMENT_ENABLED = False" >> $HORIZON_DIR/openstack_dashboard/local/local_settings.py
echo -e "HORIZON_CONFIG['dashboards'] += ('sahara',)" >> $HORIZON_DIR/openstack_dashboard/settings.py
echo -e "INSTALLED_APPS += ('saharadashboard',)" >> $HORIZON_DIR/openstack_dashboard/settings.py
if is_service_enabled neutron; then
echo -e "SAHARA_USE_NEUTRON = True" >> $HORIZON_DIR/openstack_dashboard/local/local_settings.py
fi
}
# install_sahara_dashboard() - Collect source and prepare
function install_sahara_dashboard {
install_python_saharaclient
git_clone $SAHARA_DASHBOARD_REPO $SAHARA_DASHBOARD_DIR $SAHARA_DASHBOARD_BRANCH
setup_develop $SAHARA_DASHBOARD_DIR
}
function install_python_saharaclient {
git_clone $SAHARA_PYTHONCLIENT_REPO $SAHARA_PYTHONCLIENT_DIR $SAHARA_PYTHONCLIENT_BRANCH
setup_develop $SAHARA_PYTHONCLIENT_DIR
}
# Cleanup file settings.py from Sahara
function cleanup_sahara_dashboard {
sed -i '/sahara/d' $HORIZON_DIR/openstack_dashboard/settings.py
}
# Restore xtrace
$XTRACE
# Local variables:
# mode: shell-script
# End:

View File

@ -1,173 +0,0 @@
# lib/savanna
# Dependencies:
# ``functions`` file
# ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
# ``stack.sh`` calls the entry points in this order:
#
# install_savanna
# configure_savanna
# start_savanna
# stop_savanna
# cleanup_savanna
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Defaults
# --------
# Set up default repos
SAVANNA_REPO=${SAVANNA_REPO:-${GIT_BASE}/openstack/savanna.git}
SAVANNA_BRANCH=${SAVANNA_BRANCH:-master}
# Set up default directories
SAVANNA_DIR=$DEST/savanna
SAVANNA_CONF_DIR=${SAVANNA_CONF_DIR:-/etc/savanna}
SAVANNA_CONF_FILE=${SAVANNA_CONF_DIR}/savanna.conf
SAVANNA_DEBUG=${SAVANNA_DEBUG:-True}
SAVANNA_SERVICE_HOST=${SAVANNA_SERVICE_HOST:-$SERVICE_HOST}
SAVANNA_SERVICE_PORT=${SAVANNA_SERVICE_PORT:-8386}
SAVANNA_SERVICE_PROTOCOL=${SAVANNA_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
SAVANNA_AUTH_CACHE_DIR=${SAVANNA_AUTH_CACHE_DIR:-/var/cache/savanna}
# Support entry points installation of console scripts
if [[ -d $SAVANNA_DIR/bin ]]; then
SAVANNA_BIN_DIR=$SAVANNA_DIR/bin
else
SAVANNA_BIN_DIR=$(get_python_exec_prefix)
fi
# Tell Tempest this project is present
TEMPEST_SERVICES+=,savanna
# Functions
# ---------
# create_savanna_accounts() - Set up common required savanna accounts
#
# Tenant User Roles
# ------------------------------
# service savanna admin
function create_savanna_accounts {
SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
SAVANNA_USER=$(openstack user create \
savanna \
--password "$SERVICE_PASSWORD" \
--project $SERVICE_TENANT \
--email savanna@example.com \
| grep " id " | get_field 2)
openstack role add \
$ADMIN_ROLE \
--project $SERVICE_TENANT \
--user $SAVANNA_USER
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
SAVANNA_SERVICE=$(openstack service create \
savanna \
--type=data_processing \
--description="Savanna Data Processing" \
| grep " id " | get_field 2)
openstack endpoint create \
$SAVANNA_SERVICE \
--region RegionOne \
--publicurl "$SAVANNA_SERVICE_PROTOCOL://$SAVANNA_SERVICE_HOST:$SAVANNA_SERVICE_PORT/v1.1/\$(tenant_id)s" \
--adminurl "$SAVANNA_SERVICE_PROTOCOL://$SAVANNA_SERVICE_HOST:$SAVANNA_SERVICE_PORT/v1.1/\$(tenant_id)s" \
--internalurl "$SAVANNA_SERVICE_PROTOCOL://$SAVANNA_SERVICE_HOST:$SAVANNA_SERVICE_PORT/v1.1/\$(tenant_id)s"
fi
}
# cleanup_savanna() - Remove residual data files, anything left over from
# previous runs that would need to clean up.
function cleanup_savanna {
# Cleanup auth cache dir
sudo rm -rf $SAVANNA_AUTH_CACHE_DIR
}
# configure_savanna() - Set config files, create data dirs, etc
function configure_savanna {
if [[ ! -d $SAVANNA_CONF_DIR ]]; then
sudo mkdir -p $SAVANNA_CONF_DIR
fi
sudo chown $STACK_USER $SAVANNA_CONF_DIR
# Copy over savanna configuration file and configure common parameters.
cp $SAVANNA_DIR/etc/savanna/savanna.conf.sample $SAVANNA_CONF_FILE
# Create auth cache dir
sudo mkdir -p $SAVANNA_AUTH_CACHE_DIR
sudo chown $STACK_USER $SAVANNA_AUTH_CACHE_DIR
rm -rf $SAVANNA_AUTH_CACHE_DIR/*
# Set obsolete keystone auth configs for backward compatibility
iniset $SAVANNA_CONF_FILE DEFAULT os_auth_host $KEYSTONE_SERVICE_HOST
iniset $SAVANNA_CONF_FILE DEFAULT os_auth_port $KEYSTONE_SERVICE_PORT
iniset $SAVANNA_CONF_FILE DEFAULT os_auth_protocol $KEYSTONE_SERVICE_PROTOCOL
iniset $SAVANNA_CONF_FILE DEFAULT os_admin_password $SERVICE_PASSWORD
iniset $SAVANNA_CONF_FILE DEFAULT os_admin_username savanna
iniset $SAVANNA_CONF_FILE DEFAULT os_admin_tenant_name $SERVICE_TENANT_NAME
# Set actual keystone auth configs
iniset $SAVANNA_CONF_FILE keystone_authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/
iniset $SAVANNA_CONF_FILE keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
iniset $SAVANNA_CONF_FILE keystone_authtoken admin_user savanna
iniset $SAVANNA_CONF_FILE keystone_authtoken admin_password $SERVICE_PASSWORD
iniset $SAVANNA_CONF_FILE keystone_authtoken signing_dir $SAVANNA_AUTH_CACHE_DIR
iniset $SAVANNA_CONF_FILE keystone_authtoken cafile $KEYSTONE_SSL_CA
iniset $SAVANNA_CONF_FILE DEFAULT debug $SAVANNA_DEBUG
iniset $SAVANNA_CONF_FILE database connection `database_connection_url savanna`
if is_service_enabled neutron; then
iniset $SAVANNA_CONF_FILE DEFAULT use_neutron true
iniset $SAVANNA_CONF_FILE DEFAULT use_floating_ips true
fi
if is_service_enabled heat; then
iniset $SAVANNA_CONF_FILE DEFAULT infrastructure_engine heat
else
iniset $SAVANNA_CONF_FILE DEFAULT infrastructure_engine savanna
fi
iniset $SAVANNA_CONF_FILE DEFAULT use_syslog $SYSLOG
recreate_database savanna utf8
$SAVANNA_BIN_DIR/savanna-db-manage --config-file $SAVANNA_CONF_FILE upgrade head
}
# install_savanna() - Collect source and prepare
function install_savanna {
git_clone $SAVANNA_REPO $SAVANNA_DIR $SAVANNA_BRANCH
setup_develop $SAVANNA_DIR
}
# start_savanna() - Start running processes, including screen
function start_savanna {
screen_it savanna "cd $SAVANNA_DIR && $SAVANNA_BIN_DIR/savanna-api --config-file $SAVANNA_CONF_FILE"
}
# stop_savanna() - Stop running processes
function stop_savanna {
# Kill the Savanna screen windows
screen -S $SCREEN_NAME -p savanna -X kill
}
# Restore xtrace
$XTRACE
# Local variables:
# mode: shell-script
# End:

View File

@ -1,72 +0,0 @@
# lib/savanna-dashboard
# Dependencies:
#
# - ``functions`` file
# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
# - ``SERVICE_HOST``
# ``stack.sh`` calls the entry points in this order:
#
# - install_savanna_dashboard
# - configure_savanna_dashboard
# - cleanup_savanna_dashboard
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
source $TOP_DIR/lib/horizon
# Defaults
# --------
# Set up default repos
SAVANNA_DASHBOARD_REPO=${SAVANNA_DASHBOARD_REPO:-${GIT_BASE}/openstack/savanna-dashboard.git}
SAVANNA_DASHBOARD_BRANCH=${SAVANNA_DASHBOARD_BRANCH:-master}
SAVANNA_PYTHONCLIENT_REPO=${SAVANNA_PYTHONCLIENT_REPO:-${GIT_BASE}/openstack/python-savannaclient.git}
SAVANNA_PYTHONCLIENT_BRANCH=${SAVANNA_PYTHONCLIENT_BRANCH:-master}
# Set up default directories
SAVANNA_DASHBOARD_DIR=$DEST/savanna-dashboard
SAVANNA_PYTHONCLIENT_DIR=$DEST/python-savannaclient
# Functions
# ---------
function configure_savanna_dashboard {
echo -e "AUTO_ASSIGNMENT_ENABLED = False" >> $HORIZON_DIR/openstack_dashboard/local/local_settings.py
echo -e "HORIZON_CONFIG['dashboards'] += ('savanna',)" >> $HORIZON_DIR/openstack_dashboard/settings.py
echo -e "INSTALLED_APPS += ('savannadashboard',)" >> $HORIZON_DIR/openstack_dashboard/settings.py
if is_service_enabled neutron; then
echo -e "SAVANNA_USE_NEUTRON = True" >> $HORIZON_DIR/openstack_dashboard/local/local_settings.py
fi
}
# install_savanna_dashboard() - Collect source and prepare
function install_savanna_dashboard {
install_python_savannaclient
git_clone $SAVANNA_DASHBOARD_REPO $SAVANNA_DASHBOARD_DIR $SAVANNA_DASHBOARD_BRANCH
setup_develop $SAVANNA_DASHBOARD_DIR
}
function install_python_savannaclient {
git_clone $SAVANNA_PYTHONCLIENT_REPO $SAVANNA_PYTHONCLIENT_DIR $SAVANNA_PYTHONCLIENT_BRANCH
setup_develop $SAVANNA_PYTHONCLIENT_DIR
}
# Cleanup file settings.py from Savanna
function cleanup_savanna_dashboard {
sed -i '/savanna/d' $HORIZON_DIR/openstack_dashboard/settings.py
}
# Restore xtrace
$XTRACE
# Local variables:
# mode: shell-script
# End: