Initial devstack script

First patch for the devstack script
Install Smaug Api service

Partial-Bug: #1514746
Change-Id: I0a91e0fd9b859d80d65e5ab5bfac5ade1fb4f89d
This commit is contained in:
Eran Gampel 2015-12-03 23:31:38 +02:00
parent b2a624c783
commit bda35bb321
4 changed files with 145 additions and 11 deletions

View File

@ -0,0 +1,23 @@
[[local|localrc]]
API_WORKERS=0
DATABASE_PASSWORD=password
RABBIT_PASSWORD=password
SERVICE_PASSWORD=password
SERVICE_TOKEN=password
ADMIN_PASSWORD=password
enable_plugin smaug http://git.openstack.org/openstack/smaug master
#run the services you want to use
ENABLED_SERVICES=rabbit,mysql,key
ENABLED_SERVICES+=,n-cpu,n-api,n-crt,n-obj,n-cond,n-sch,n-novnc,n-cauth
ENABLED_SERVICES+=,neutron,q-svc,q-agt,q-dhcp,q-meta
ENABLED_SERVICES+=,cinder,g-api,g-reg
ENABLED_SERVICES+=,c-api,c-vol,c-sch,c-bak,horizon
#Add the smaug services
enable_service smaug-api
#disable the default services you don't want to use
disable_service n-net

91
devstack/plugin.sh Normal file
View File

@ -0,0 +1,91 @@
# Devstack extras script to install Smaug
# Test if any smaug services are enabled
# is_smaug_enabled
function is_smaug_enabled {
echo "Checking if Smaug is Enabled"
[[ ,${ENABLED_SERVICES} =~ ,"smaug-" ]] && Q_ENABLE_SMAUG="False"
Q_ENABLE_SMAUG="True"
}
function _create_smaug_conf_dir {
# Put config files in ``SMAUG_CONF_DIR`` for everyone to find
sudo install -d -o $STACK_USER $SMAUG_CONF_DIR
}
function configure_smaug_api {
if is_service_enabled smaug-api ; then
echo "Configuring Smaug API"
cp $SMAUG_DIR/etc/smaug.conf $SMAUG_API_CONF
cp $SMAUG_DIR/etc/api-paste.ini $SMAUG_CONF_DIR
cp $SMAUG_DIR/etc/policy.json $SMAUG_CONF_DIR
iniset $SMAUG_API_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
iniset $SMAUG_API_CONF DEFAULT verbose True
iniset $SMAUG_API_CONF DEFAULT use_syslog $SYSLOG
echo "Configuring Smaug API Database"
iniset $SMAUG_API_CONF database connection `database_connection_url smaug`
setup_colorized_logging $SMAUG_API_CONF DEFAULT tenant_name
echo "Configuring Smaug API colorized"
if is_service_enabled keystone; then
echo "Configuring Smaug keystone Auth"
create_smaug_cache_dir
# Configure auth token middleware
configure_auth_token_middleware $SMAUG_API_CONF smaug \
$SMAUG_AUTH_CACHE_DIR
else
iniset $SMAUG_API_CONF DEFAULT auth_strategy noauth
fi
fi
}
function create_smaug_cache_dir {
# Delete existing dir
sudo rm -rf $SMAUG_AUTH_CACHE_DIR
sudo mkdir -p $SMAUG_AUTH_CACHE_DIR
sudo chown `whoami` $SMAUG_AUTH_CACHE_DIR
}
is_smaug_enabled
if [[ "$Q_ENABLE_SMAUG" == "True" ]]; then
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
echo summary "Smaug pre-install"
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing Smaug"
setup_package $SMAUG_DIR -e
_create_smaug_conf_dir
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring Smaug"
configure_smaug_api
echo export PYTHONPATH=\$PYTHONPATH:$SMAUG_DIR >> $RC_DIR/.localrc.auto
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
echo_summary "Initializing Smaug Service"
SMAUG_BIN_DIR=$(get_python_exec_prefix)
if is_service_enabled smaug-api; then
run_process smaug-api "$SMAUG_BIN_DIR/smaug-api --config-file $SMAUG_API_CONF"
fi
fi
if [[ "$1" == "unstack" ]]; then
if is_service_enabled smaug-api; then
stop_process smaug-api
fi
fi
fi

20
devstack/settings Normal file
View File

@ -0,0 +1,20 @@
# Git information
SMAUG_REPO=${SMAUG_REPO:-https://git.openstack.org/cgit/openstack/smaug/}
SMAUG_DIR=$DEST/smaug
SMAUG_BRANCH=${SMAUG_BRANCH:-master}
# common variables
SMAUG_CONF_DIR=${SMAUG_CONF_DIR:-/etc/smaug}
# smaug rest api
SMAUG_API=$SMAUG_DIR/smaug/cmd/api.py
SMAUG_API_CONF=$SMAUG_CONF_DIR/smaug.conf
SMAUG_API_LISTEN_ADDRESS=${SMAUG_API_LISTEN_ADDRESS:-0.0.0.0}
SMAUG_API_HOST=${SMAUG_API_HOST:-$SERVICE_HOST}
SMAUG_API_PORT=${SMAUG_API_PORT:-19999}
SMAUG_API_PROTOCOL=${SMAUG_API_PROTOCOL:-$SERVICE_PROTOCOL}
SMAUG_AUTH_CACHE_DIR=${SMAUG_AUTH_CACHE_DIR:-/var/cache/smaug}
export PYTHONPATH=$PYTHONPATH:$SMAUG_DIR

View File

@ -1,4 +1,4 @@
#[keystone_authtoken]
[keystone_authtoken]
#signing_dir = /var/cache/smaug
#cafile = /opt/stack/data/ca-bundle.pem
#auth_uri = http://192.168.1.102:5000
@ -11,13 +11,13 @@
#auth_plugin = password
[DEFAULT]
api_paste_config = /etc/smaug/api-paste.ini
logging_context_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [%(request_id)s %(user_id)s %(project_id)s%(color)s] %(instance)s%(color)s%(message)s
logging_debug_format_suffix = from (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d
logging_default_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [-%(color)s] %(instance)s%(color)s%(message)s
logging_exception_prefix = %(color)s%(asctime)s.%(msecs)03d TRACE %(name)s %(instance)s
verbose = True
debug = True
auth_strategy = noauth
log_dir = /var/log/
rpc_backend = rabbit
#api_paste_config = /etc/smaug/api-paste.ini
#logging_context_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [%(request_id)s %(user_id)s %(project_id)s%(color)s] %(instance)s%(color)s%(message)s
#logging_debug_format_suffix = from (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d
#logging_default_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [-%(color)s] %(instance)s%(color)s%(message)s
#logging_exception_prefix = %(color)s%(asctime)s.%(msecs)03d TRACE %(name)s %(instance)s
#verbose = True
#debug = True
#auth_strategy = noauth
#log_dir = /var/log/
#rpc_backend = rabbit