Merge "Enable Zaqar to run in debug mode"
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 21b31e4..c31a755 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -173,6 +173,7 @@
* `extras.d/60-ceph.sh <extras.d/60-ceph.sh.html>`__
* `extras.d/70-sahara.sh <extras.d/70-sahara.sh.html>`__
* `extras.d/70-trove.sh <extras.d/70-trove.sh.html>`__
+* `extras.d/70-tuskar.sh <extras.d/70-tuskar.sh.html>`__
* `extras.d/70-zaqar.sh <extras.d/70-zaqar.sh.html>`__
* `extras.d/80-opendaylight.sh <extras.d/80-opendaylight.sh.html>`__
* `extras.d/80-tempest.sh <extras.d/80-tempest.sh.html>`__
diff --git a/extras.d/70-tuskar.sh b/extras.d/70-tuskar.sh
new file mode 100644
index 0000000..e77c504
--- /dev/null
+++ b/extras.d/70-tuskar.sh
@@ -0,0 +1,205 @@
+# Install and start the **Tuskar** service
+#
+# To enable, add the following to your localrc
+#
+# enable_service tuskar
+# enable_service tuskar-api
+
+
+if is_service_enabled tuskar; then
+ if [[ "$1" == "source" ]]; then
+ # Initial source, do nothing as functions sourced
+ # are below rather than in lib/tuskar
+ echo_summary "source extras tuskar"
+ elif [[ "$1" == "stack" && "$2" == "install" ]]; then
+ echo_summary "Installing Tuskar"
+ install_tuskarclient
+ install_tuskar
+ elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
+ echo_summary "Configuring Tuskar"
+ configure_tuskar
+ configure_tuskarclient
+
+ if is_service_enabled key; then
+ create_tuskar_accounts
+ fi
+
+ elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
+ echo_summary "Initializing Tuskar"
+ init_tuskar
+ start_tuskar
+ fi
+
+ if [[ "$1" == "unstack" ]]; then
+ stop_tuskar
+ fi
+fi
+
+# library code (equivalent to lib/tuskar)
+# ---------
+# - install_tuskarclient
+# - install_tuskar
+# - configure_tuskarclient
+# - configure_tuskar
+# - init_tuskar
+# - start_tuskar
+# - stop_tuskar
+# - cleanup_tuskar
+
+# Save trace setting
+XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Defaults
+# --------
+
+# tuskar repos
+TUSKAR_REPO=${TUSKAR_REPO:-${GIT_BASE}/openstack/tuskar.git}
+TUSKAR_BRANCH=${TUSKAR_BRANCH:-master}
+
+TUSKARCLIENT_REPO=${TUSKARCLIENT_REPO:-${GIT_BASE}/openstack/python-tuskarclient.git}
+TUSKARCLIENT_BRANCH=${TUSKARCLIENT_BRANCH:-master}
+
+# set up default directories
+TUSKAR_DIR=$DEST/tuskar
+TUSKARCLIENT_DIR=$DEST/python-tuskarclient
+TUSKAR_AUTH_CACHE_DIR=${TUSKAR_AUTH_CACHE_DIR:-/var/cache/tuskar}
+TUSKAR_STANDALONE=`trueorfalse False $TUSKAR_STANDALONE`
+TUSKAR_CONF_DIR=/etc/tuskar
+TUSKAR_CONF=$TUSKAR_CONF_DIR/tuskar.conf
+TUSKAR_API_HOST=${TUSKAR_API_HOST:-$HOST_IP}
+TUSKAR_API_PORT=${TUSKAR_API_PORT:-8585}
+
+# Tell Tempest this project is present
+TEMPEST_SERVICES+=,tuskar
+
+# Functions
+# ---------
+
+# Test if any Tuskar services are enabled
+# is_tuskar_enabled
+function is_tuskar_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"tuskar-" ]] && return 0
+ return 1
+}
+
+# cleanup_tuskar() - Remove residual data files, anything left over from previous
+# runs that a clean run would need to clean up
+function cleanup_tuskar {
+ sudo rm -rf $TUSKAR_AUTH_CACHE_DIR
+}
+
+# configure_tuskar() - Set config files, create data dirs, etc
+function configure_tuskar {
+ setup_develop $TUSKAR_DIR
+
+ if [[ ! -d $TUSKAR_CONF_DIR ]]; then
+ sudo mkdir -p $TUSKAR_CONF_DIR
+ fi
+ sudo chown $STACK_USER $TUSKAR_CONF_DIR
+ # remove old config files
+ rm -f $TUSKAR_CONF_DIR/tuskar-*.conf
+
+ TUSKAR_POLICY_FILE=$TUSKAR_CONF_DIR/policy.json
+
+ cp $TUSKAR_DIR/etc/tuskar/policy.json $TUSKAR_POLICY_FILE
+ cp $TUSKAR_DIR/etc/tuskar/tuskar.conf.sample $TUSKAR_CONF
+
+ # common options
+ iniset $TUSKAR_CONF database connection `database_connection_url tuskar`
+
+ # logging
+ iniset $TUSKAR_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
+ iniset $TUSKAR_CONF DEFAULT use_syslog $SYSLOG
+ if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
+ # Add color to logging output
+ setup_colorized_logging $TUSKAR_CONF DEFAULT tenant user
+ fi
+
+ configure_auth_token_middleware $TUSKAR_CONF tuskar $TUSKAR_AUTH_CACHE_DIR
+
+ if is_ssl_enabled_service "key"; then
+ iniset $TUSKAR_CONF clients_keystone ca_file $SSL_BUNDLE_FILE
+ fi
+
+ iniset $TUSKAR_CONF tuskar_api bind_port $TUSKAR_API_PORT
+
+}
+
+# init_tuskar() - Initialize database
+function init_tuskar {
+
+ # (re)create tuskar database
+ recreate_database tuskar utf8
+
+ tuskar-dbsync --config-file $TUSKAR_CONF
+ create_tuskar_cache_dir
+}
+
+# create_tuskar_cache_dir() - Part of the init_tuskar() process
+function create_tuskar_cache_dir {
+ # Create cache dirs
+ sudo mkdir -p $TUSKAR_AUTH_CACHE_DIR
+ sudo chown $STACK_USER $TUSKAR_AUTH_CACHE_DIR
+}
+
+# install_tuskarclient() - Collect source and prepare
+function install_tuskarclient {
+ git_clone $TUSKARCLIENT_REPO $TUSKARCLIENT_DIR $TUSKARCLIENT_BRANCH
+ setup_develop $TUSKARCLIENT_DIR
+}
+
+# configure_tuskarclient() - Set config files, create data dirs, etc
+function configure_tuskarclient {
+ setup_develop $TUSKARCLIENT_DIR
+}
+
+# install_tuskar() - Collect source and prepare
+function install_tuskar {
+ git_clone $TUSKAR_REPO $TUSKAR_DIR $TUSKAR_BRANCH
+}
+
+# start_tuskar() - Start running processes, including screen
+function start_tuskar {
+ run_process tuskar-api "tuskar-api --config-file=$TUSKAR_CONF"
+}
+
+# stop_tuskar() - Stop running processes
+function stop_tuskar {
+ # Kill the screen windows
+ local serv
+ for serv in tuskar-api; do
+ stop_process $serv
+ done
+}
+
+# create_tuskar_accounts() - Set up common required tuskar accounts
+function create_tuskar_accounts {
+ # migrated from files/keystone_data.sh
+ local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
+ local admin_role=$(openstack role list | awk "/ admin / { print \$2 }")
+
+ local tuskar_user=$(get_or_create_user "tuskar" \
+ "$SERVICE_PASSWORD" $service_tenant)
+ get_or_add_user_role $admin_role $tuskar_user $service_tenant
+
+ if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
+
+ local tuskar_service=$(get_or_create_service "tuskar" \
+ "management" "Tuskar Management Service")
+ get_or_create_endpoint $tuskar_service \
+ "$REGION_NAME" \
+ "$SERVICE_PROTOCOL://$TUSKAR_API_HOST:$TUSKAR_API_PORT" \
+ "$SERVICE_PROTOCOL://$TUSKAR_API_HOST:$TUSKAR_API_PORT" \
+ "$SERVICE_PROTOCOL://$TUSKAR_API_HOST:$TUSKAR_API_PORT"
+ fi
+}
+
+# Restore xtrace
+$XTRACE
+
+# Tell emacs to use shell-script-mode
+## Local variables:
+## mode: shell-script
+## End:
diff --git a/files/apts b/files/apts
new file mode 120000
index 0000000..ef926de
--- /dev/null
+++ b/files/apts
@@ -0,0 +1 @@
+debs/
\ No newline at end of file
diff --git a/files/apts/baremetal b/files/debs/baremetal
similarity index 100%
rename from files/apts/baremetal
rename to files/debs/baremetal
diff --git a/files/apts/ceilometer-collector b/files/debs/ceilometer-collector
similarity index 100%
rename from files/apts/ceilometer-collector
rename to files/debs/ceilometer-collector
diff --git a/files/apts/ceph b/files/debs/ceph
similarity index 100%
rename from files/apts/ceph
rename to files/debs/ceph
diff --git a/files/apts/cinder b/files/debs/cinder
similarity index 100%
rename from files/apts/cinder
rename to files/debs/cinder
diff --git a/files/apts/dstat b/files/debs/dstat
similarity index 100%
rename from files/apts/dstat
rename to files/debs/dstat
diff --git a/files/apts/general b/files/debs/general
similarity index 100%
rename from files/apts/general
rename to files/debs/general
diff --git a/files/apts/glance b/files/debs/glance
similarity index 100%
rename from files/apts/glance
rename to files/debs/glance
diff --git a/files/apts/heat b/files/debs/heat
similarity index 100%
rename from files/apts/heat
rename to files/debs/heat
diff --git a/files/apts/horizon b/files/debs/horizon
similarity index 100%
rename from files/apts/horizon
rename to files/debs/horizon
diff --git a/files/apts/ironic b/files/debs/ironic
similarity index 100%
rename from files/apts/ironic
rename to files/debs/ironic
diff --git a/files/apts/keystone b/files/debs/keystone
similarity index 100%
rename from files/apts/keystone
rename to files/debs/keystone
diff --git a/files/apts/ldap b/files/debs/ldap
similarity index 100%
rename from files/apts/ldap
rename to files/debs/ldap
diff --git a/files/apts/n-api b/files/debs/n-api
similarity index 100%
rename from files/apts/n-api
rename to files/debs/n-api
diff --git a/files/apts/n-cpu b/files/debs/n-cpu
similarity index 100%
rename from files/apts/n-cpu
rename to files/debs/n-cpu
diff --git a/files/apts/n-novnc b/files/debs/n-novnc
similarity index 100%
rename from files/apts/n-novnc
rename to files/debs/n-novnc
diff --git a/files/apts/neutron b/files/debs/neutron
similarity index 100%
rename from files/apts/neutron
rename to files/debs/neutron
diff --git a/files/apts/nova b/files/debs/nova
similarity index 100%
rename from files/apts/nova
rename to files/debs/nova
diff --git a/files/apts/openvswitch b/files/debs/openvswitch
similarity index 100%
rename from files/apts/openvswitch
rename to files/debs/openvswitch
diff --git a/files/apts/postgresql b/files/debs/postgresql
similarity index 100%
rename from files/apts/postgresql
rename to files/debs/postgresql
diff --git a/files/apts/q-agt b/files/debs/q-agt
similarity index 100%
rename from files/apts/q-agt
rename to files/debs/q-agt
diff --git a/files/apts/q-l3 b/files/debs/q-l3
similarity index 100%
rename from files/apts/q-l3
rename to files/debs/q-l3
diff --git a/files/apts/qpid b/files/debs/qpid
similarity index 100%
rename from files/apts/qpid
rename to files/debs/qpid
diff --git a/files/apts/ryu b/files/debs/ryu
similarity index 100%
rename from files/apts/ryu
rename to files/debs/ryu
diff --git a/files/apts/swift b/files/debs/swift
similarity index 100%
rename from files/apts/swift
rename to files/debs/swift
diff --git a/files/apts/tempest b/files/debs/tempest
similarity index 100%
rename from files/apts/tempest
rename to files/debs/tempest
diff --git a/files/apts/tls-proxy b/files/debs/tls-proxy
similarity index 100%
rename from files/apts/tls-proxy
rename to files/debs/tls-proxy
diff --git a/files/apts/trema b/files/debs/trema
similarity index 100%
rename from files/apts/trema
rename to files/debs/trema
diff --git a/files/apts/trove b/files/debs/trove
similarity index 100%
rename from files/apts/trove
rename to files/debs/trove
diff --git a/files/apts/zaqar-server b/files/debs/zaqar-server
similarity index 100%
rename from files/apts/zaqar-server
rename to files/debs/zaqar-server
diff --git a/functions-common b/functions-common
index e890b75..24507fe 100644
--- a/functions-common
+++ b/functions-common
@@ -945,7 +945,7 @@
function _get_package_dir {
local pkg_dir
if is_ubuntu; then
- pkg_dir=$FILES/apts
+ pkg_dir=$FILES/debs
elif is_fedora; then
pkg_dir=$FILES/rpms
elif is_suse; then
@@ -975,7 +975,7 @@
}
# get_packages() collects a list of package names of any type from the
-# prerequisite files in ``files/{apts|rpms}``. The list is intended
+# prerequisite files in ``files/{debs|rpms}``. The list is intended
# to be passed to a package installer such as apt or yum.
#
# Only packages required for the services in 1st argument will be
diff --git a/lib/ceph b/lib/ceph
index 2ddf5db..5214306 100644
--- a/lib/ceph
+++ b/lib/ceph
@@ -106,8 +106,13 @@
sudo rm -f ${CEPH_DISK_IMAGE}
fi
uninstall_package ceph ceph-common python-ceph libcephfs1 > /dev/null 2>&1
- VIRSH_UUID=$(sudo virsh secret-list | awk '/^ ?[0-9a-z]/ { print $1 }')
- sudo virsh secret-undefine ${VIRSH_UUID} >/dev/null 2>&1
+ if is_service_enabled cinder || is_service_enabled nova; then
+ local virsh_uuid=$(sudo virsh secret-list | awk '/^ ?[0-9a-z]/ { print $1 }')
+ sudo virsh secret-undefine ${virsh_uuid} >/dev/null 2>&1
+ fi
+ if is_service_enabled nova; then
+ iniset $NOVA_CONF libvirt rbd_secret_uuid ""
+ fi
}
# configure_ceph() - Set config files, create data dirs, etc
diff --git a/lib/databases/mysql b/lib/databases/mysql
index bbf2fd0..eab1aa4 100644
--- a/lib/databases/mysql
+++ b/lib/databases/mysql
@@ -141,12 +141,14 @@
chmod 0600 $HOME/.my.cnf
fi
# Install mysql-server
- if is_ubuntu || is_fedora; then
- if [[ $DISTRO =~ (rhel6|precise) ]]; then
+ if is_fedora; then
+ if [[ $DISTRO =~ (rhel6) ]]; then
install_package mysql-server
else
install_package mariadb-server
fi
+ elif is_ubuntu; then
+ install_package mysql-server
elif is_suse; then
if ! is_package_installed mariadb; then
install_package mysql-community-server
diff --git a/lib/heat b/lib/heat
index 2b55cf0..3ed9a5f 100644
--- a/lib/heat
+++ b/lib/heat
@@ -94,7 +94,6 @@
cp $HEAT_DIR/etc/heat/api-paste.ini $HEAT_API_PASTE_FILE
cp $HEAT_DIR/etc/heat/policy.json $HEAT_POLICY_FILE
- cp $HEAT_DIR/etc/heat/heat.conf.sample $HEAT_CONF
# common options
iniset_rpc_backend heat $HEAT_CONF DEFAULT
diff --git a/lib/ironic b/lib/ironic
index 622c189..28f8fe8 100644
--- a/lib/ironic
+++ b/lib/ironic
@@ -500,9 +500,23 @@
create_ovs_taps
}
+function wait_for_nova_resources {
+ # After nodes have been enrolled, we need to wait for n-cpu's periodic
+ # task populate the resource tracker with available nodes. Wait for 2
+ # minutes before timing out.
+ local expected_count=$1
+ echo_summary "Waiting 2 minutes for Nova resource tracker to pick up $expected_count Ironic nodes"
+ for i in $(seq 1 120); do
+ if [ $(nova hypervisor-stats | grep " count " | get_field 2) -ge $expected_count ]; then
+ return 0
+ fi
+ sleep 1
+ done
+ die $LINENO "Nova hypervisor-stats did not register at least $expected_count nodes"
+}
+
function enroll_nodes {
local chassis_id=$(ironic chassis-create -d "ironic test chassis" | grep " uuid " | get_field 2)
- local idx=0
if [[ "$IRONIC_DEPLOY_DRIVER" == "pxe_ssh" ]] ; then
local _IRONIC_DEPLOY_KERNEL_KEY=pxe_deploy_kernel
@@ -536,6 +550,7 @@
fi
fi
+ local total_nodes=0
while read hardware_info; do
if ! is_ironic_hardware; then
local mac_address=$hardware_info
@@ -566,7 +581,7 @@
ironic port-create --address $mac_address --node_uuid $node_id
- idx=$((idx+1))
+ total_nodes=$((total_nodes+1))
done < $ironic_hwinfo_file
# create the nova flavor
@@ -581,6 +596,10 @@
# from the flavor after the completion of
# https://blueprints.launchpad.net/ironic/+spec/add-node-instance-info
nova flavor-key baremetal set "cpu_arch"="x86_64" "baremetal:deploy_kernel_id"="$IRONIC_DEPLOY_KERNEL_ID" "baremetal:deploy_ramdisk_id"="$IRONIC_DEPLOY_RAMDISK_ID"
+
+ if [ "$VIRT_DRIVER" == "ironic" ]; then
+ wait_for_nova_resources $total_nodes
+ fi
}
function configure_iptables {
diff --git a/lib/nova b/lib/nova
index 9a8614b..d5fe7ac 100644
--- a/lib/nova
+++ b/lib/nova
@@ -458,8 +458,7 @@
if is_ssl_enabled_service "cinder" || is_service_enabled tls-proxy; then
CINDER_SERVICE_HOST=${CINDER_SERVICE_HOST:-$SERVICE_HOST}
CINDER_SERVICE_PORT=${CINDER_SERVICE_PORT:-8776}
- iniset $NOVA_CONF cinder endpoint_template "https://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/%(project_id)s"
- iniset $NOVA_CONF cinder ca_certificates_file $SSL_BUNDLE_FILE
+ iniset $NOVA_CONF cinder cafile $SSL_BUNDLE_FILE
fi
fi
diff --git a/lib/tempest b/lib/tempest
index 6bcfaec..46c9e26 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -304,7 +304,6 @@
iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
iniset $TEMPEST_CONFIG compute-feature-enabled block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
iniset $TEMPEST_CONFIG compute-feature-enabled api_extensions ${COMPUTE_API_EXTENSIONS:-"all"}
- iniset $TEMPEST_CONFIG compute-feature-enabled xml_api_v2 ${TEMPEST_ENABLE_NOVA_XML_API:-True}
iniset $TEMPEST_CONFIG compute-feature-disabled api_extensions ${DISABLE_COMPUTE_API_EXTENSIONS}
# Compute admin