Merge "Cleanup cinder-rootwrap support"
diff --git a/clean.sh b/clean.sh
index e16bdb7..09f08dc 100755
--- a/clean.sh
+++ b/clean.sh
@@ -97,7 +97,7 @@
fi
# Do the hypervisor cleanup until this can be moved back into lib/nova
-if [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
+if is_service_enabled nova && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
cleanup_nova_hypervisor
fi
diff --git a/driver_certs/cinder_driver_cert.sh b/driver_certs/cinder_driver_cert.sh
index edcc6d4..8380dee 100755
--- a/driver_certs/cinder_driver_cert.sh
+++ b/driver_certs/cinder_driver_cert.sh
@@ -89,9 +89,8 @@
sleep 5
# run tempest api/volume/test_*
-log_message "Run the actual tempest volume tests (./tools/pretty_tox.sh api.volume_*)...", True
-exec 2> >(tee -a $TEMPFILE)
-`./tools/pretty_tox.sh api.volume`
+log_message "Run the actual tempest volume tests (./tools/pretty_tox.sh api.volume)...", True
+./tools/pretty_tox.sh api.volume 2>&1 | tee -a $TEMPFILE
if [[ $? = 0 ]]; then
log_message "CONGRATULATIONS!!! Device driver PASSED!", True
log_message "Submit output: ($TEMPFILE)"
diff --git a/exercises/boot_from_volume.sh b/exercises/boot_from_volume.sh
index ed8ba63..7912046 100755
--- a/exercises/boot_from_volume.sh
+++ b/exercises/boot_from_volume.sh
@@ -30,14 +30,12 @@
# Import common functions
source $TOP_DIR/functions
+# Import project functions
+source $TOP_DIR/lib/cinder
+
# Import configuration
source $TOP_DIR/openrc
-# Import neutron functions if needed
-if is_service_enabled neutron; then
- source $TOP_DIR/lib/neutron
-fi
-
# Import exercise configuration
source $TOP_DIR/exerciserc
diff --git a/exercises/euca.sh b/exercises/euca.sh
index 51b2644..ad852a4 100755
--- a/exercises/euca.sh
+++ b/exercises/euca.sh
@@ -33,11 +33,6 @@
# Import EC2 configuration
source $TOP_DIR/eucarc
-# Import neutron functions if needed
-if is_service_enabled neutron; then
- source $TOP_DIR/lib/neutron
-fi
-
# Import exercise configuration
source $TOP_DIR/exerciserc
diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh
index 4ca90a5..b981aa8 100755
--- a/exercises/floating_ips.sh
+++ b/exercises/floating_ips.sh
@@ -27,14 +27,12 @@
# Import common functions
source $TOP_DIR/functions
+# Import project functions
+source $TOP_DIR/lib/neutron
+
# Import configuration
source $TOP_DIR/openrc
-# Import neutron functions if needed
-if is_service_enabled neutron; then
- source $TOP_DIR/lib/neutron
-fi
-
# Import exercise configuration
source $TOP_DIR/exerciserc
diff --git a/exercises/volumes.sh b/exercises/volumes.sh
index 21b5d21..33e2458 100755
--- a/exercises/volumes.sh
+++ b/exercises/volumes.sh
@@ -27,14 +27,12 @@
# Import common functions
source $TOP_DIR/functions
+# Import project functions
+source $TOP_DIR/lib/cinder
+
# Import configuration
source $TOP_DIR/openrc
-# Import neutron functions if needed
-if is_service_enabled neutron; then
- source $TOP_DIR/lib/neutron
-fi
-
# Import exercise configuration
source $TOP_DIR/exerciserc
diff --git a/extras.d/50-ironic.sh b/extras.d/50-ironic.sh
new file mode 100644
index 0000000..f68a146
--- /dev/null
+++ b/extras.d/50-ironic.sh
@@ -0,0 +1,33 @@
+# ironic.sh - Devstack extras script to install ironic
+
+if is_service_enabled ir-api ir-cond; then
+ if [[ "$1" == "source" ]]; then
+ # Initial source
+ source $TOP_DIR/lib/ironic
+ elif [[ "$1" == "stack" && "$2" == "install" ]]; then
+ echo_summary "Installing Ironic"
+ install_ironic
+ install_ironicclient
+ cleanup_ironic
+ elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
+ echo_summary "Configuring Ironic"
+ configure_ironic
+
+ if is_service_enabled key; then
+ create_ironic_accounts
+ fi
+
+ elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
+ # Initialize ironic
+ init_ironic
+
+ # Start the ironic API and ironic taskmgr components
+ echo_summary "Starting Ironic"
+ start_ironic
+ fi
+
+ if [[ "$1" == "unstack" ]]; then
+ stop_ironic
+ cleanup_ironic
+ fi
+fi
diff --git a/files/apts/dstat b/files/apts/dstat
new file mode 100644
index 0000000..2b643b8
--- /dev/null
+++ b/files/apts/dstat
@@ -0,0 +1 @@
+dstat
diff --git a/files/rpms-suse/dstat b/files/rpms-suse/dstat
new file mode 100644
index 0000000..2b643b8
--- /dev/null
+++ b/files/rpms-suse/dstat
@@ -0,0 +1 @@
+dstat
diff --git a/files/rpms/dstat b/files/rpms/dstat
new file mode 100644
index 0000000..8a8f8fe
--- /dev/null
+++ b/files/rpms/dstat
@@ -0,0 +1 @@
+dstat
\ No newline at end of file
diff --git a/functions b/functions
index 281b676..dc3278b 100644
--- a/functions
+++ b/functions
@@ -840,6 +840,16 @@
services=$@
for service in ${services}; do
[[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
+
+ # Look for top-level 'enabled' function for this service
+ if type is_${service}_enabled >/dev/null 2>&1; then
+ # A function exists for this service, use it
+ is_${service}_enabled
+ return $?
+ fi
+
+ # TODO(dtroyer): Remove these legacy special-cases after the is_XXX_enabled()
+ # are implemented
[[ ${service} == n-cell-* && ${ENABLED_SERVICES} =~ "n-cell" ]] && return 0
[[ ${service} == "nova" && ${ENABLED_SERVICES} =~ "n-" ]] && return 0
[[ ${service} == "cinder" && ${ENABLED_SERVICES} =~ "c-" ]] && return 0
diff --git a/lib/ceilometer b/lib/ceilometer
index f9c7691..4ca77bb 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -59,7 +59,14 @@
# Functions
# ---------
-#
+
+# Test if any Ceilometer services are enabled
+# is_ceilometer_enabled
+function is_ceilometer_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"ceilometer-" ]] && return 0
+ return 1
+}
+
# create_ceilometer_accounts() - Set up common required ceilometer accounts
create_ceilometer_accounts() {
diff --git a/lib/cinder b/lib/cinder
index 75e9c97..d5e78bb 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -27,6 +27,12 @@
# set up default driver
CINDER_DRIVER=${CINDER_DRIVER:-default}
+CINDER_PLUGINS=$TOP_DIR/lib/cinder_plugins
+
+# grab plugin config if specified via cinder_driver
+if [[ -r $CINDER_PLUGINS/$CINDER_DRIVER ]]; then
+ source $CINDER_PLUGINS/$CINDER_DRIVER
+fi
# set up default directories
CINDER_DIR=$DEST/cinder
@@ -85,6 +91,14 @@
# Functions
# ---------
+
+# Test if any Cinder services are enabled
+# is_cinder_enabled
+function is_cinder_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"c-" ]] && return 0
+ return 1
+}
+
# _clean_lvm_lv removes all cinder LVM volumes
#
# Usage: _clean_lvm_lv $VOLUME_GROUP $VOLUME_NAME_PREFIX
@@ -285,42 +299,8 @@
setup_colorized_logging $CINDER_CONF DEFAULT "project_id" "user_id"
fi
- if [ "$CINDER_DRIVER" == "XenAPINFS" ]; then
- (
- set -u
- iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.xenapi.sm.XenAPINFSDriver"
- iniset $CINDER_CONF DEFAULT xenapi_connection_url "$CINDER_XENAPI_CONNECTION_URL"
- iniset $CINDER_CONF DEFAULT xenapi_connection_username "$CINDER_XENAPI_CONNECTION_USERNAME"
- iniset $CINDER_CONF DEFAULT xenapi_connection_password "$CINDER_XENAPI_CONNECTION_PASSWORD"
- iniset $CINDER_CONF DEFAULT xenapi_nfs_server "$CINDER_XENAPI_NFS_SERVER"
- iniset $CINDER_CONF DEFAULT xenapi_nfs_serverpath "$CINDER_XENAPI_NFS_SERVERPATH"
- )
- elif [ "$CINDER_DRIVER" == "nfs" ]; then
- iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.nfs.NfsDriver"
- iniset $CINDER_CONF DEFAULT nfs_shares_config "$CINDER_CONF_DIR/nfs_shares.conf"
- echo "$CINDER_NFS_SERVERPATH" | sudo tee "$CINDER_CONF_DIR/nfs_shares.conf"
- sudo chmod 666 $CINDER_CONF_DIR/nfs_shares.conf
- elif [ "$CINDER_DRIVER" == "sheepdog" ]; then
- iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.sheepdog.SheepdogDriver"
- elif [ "$CINDER_DRIVER" == "glusterfs" ]; then
- # To use glusterfs, set the following in localrc:
- # CINDER_DRIVER=glusterfs
- # CINDER_GLUSTERFS_SHARES="127.0.0.1:/vol1;127.0.0.1:/vol2"
- # Shares are <host>:<volume> and separated by semicolons.
-
- iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.glusterfs.GlusterfsDriver"
- iniset $CINDER_CONF DEFAULT glusterfs_shares_config "$CINDER_CONF_DIR/glusterfs_shares"
- touch $CINDER_CONF_DIR/glusterfs_shares
- if [ ! -z "$CINDER_GLUSTERFS_SHARES" ]; then
- CINDER_GLUSTERFS_SHARES=$(echo $CINDER_GLUSTERFS_SHARES | tr ";" "\n")
- echo "$CINDER_GLUSTERFS_SHARES" > $CINDER_CONF_DIR/glusterfs_shares
- fi
- elif [ "$CINDER_DRIVER" == "vsphere" ]; then
- echo_summary "Using VMware vCenter driver"
- iniset $CINDER_CONF DEFAULT vmware_host_ip "$VMWAREAPI_IP"
- iniset $CINDER_CONF DEFAULT vmware_host_username "$VMWAREAPI_USER"
- iniset $CINDER_CONF DEFAULT vmware_host_password "$VMWAREAPI_PASSWORD"
- iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver"
+ if [[ -r $CINDER_PLUGINS/$CINDER_DRIVER ]]; then
+ configure_cinder_driver
fi
if [[ is_fedora && $DISTRO =~ (rhel6) ]]; then
diff --git a/lib/cinder_plugins/XenAPINFS b/lib/cinder_plugins/XenAPINFS
new file mode 100644
index 0000000..72e1c13
--- /dev/null
+++ b/lib/cinder_plugins/XenAPINFS
@@ -0,0 +1,44 @@
+# lib/cinder_plugins/XenAPINFS
+# Configure the XenAPINFS driver
+
+# Enable with:
+#
+# CINDER_DRIVER=XenAPINFS
+
+# Dependencies:
+#
+# - ``functions`` file
+# - ``cinder`` configurations
+
+# configure_cinder_driver - make configuration changes, including those to other services
+
+# Save trace setting
+MY_XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Defaults
+# --------
+
+# Set up default directories
+
+
+# Entry Points
+# ------------
+
+# configure_cinder_driver - Set config files, create data dirs, etc
+function configure_cinder_driver() {
+ iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.xenapi.sm.XenAPINFSDriver"
+ iniset $CINDER_CONF DEFAULT xenapi_connection_url "$CINDER_XENAPI_CONNECTION_URL"
+ iniset $CINDER_CONF DEFAULT xenapi_connection_username "$CINDER_XENAPI_CONNECTION_USERNAME"
+ iniset $CINDER_CONF DEFAULT xenapi_connection_password "$CINDER_XENAPI_CONNECTION_PASSWORD"
+ iniset $CINDER_CONF DEFAULT xenapi_nfs_server "$CINDER_XENAPI_NFS_SERVER"
+ iniset $CINDER_CONF DEFAULT xenapi_nfs_serverpath "$CINDER_XENAPI_NFS_SERVERPATH"
+}
+
+# Restore xtrace
+$MY_XTRACE
+
+# Local variables:
+# mode: shell-script
+# End:
diff --git a/lib/cinder_plugins/glusterfs b/lib/cinder_plugins/glusterfs
new file mode 100644
index 0000000..a0c5ae8
--- /dev/null
+++ b/lib/cinder_plugins/glusterfs
@@ -0,0 +1,50 @@
+# lib/cinder_plugins/glusterfs
+# Configure the glusterfs driver
+
+# Enable with:
+#
+# CINDER_DRIVER=glusterfs
+
+# Dependencies:
+#
+# - ``functions`` file
+# - ``cinder`` configurations
+
+# configure_cinder_driver - make configuration changes, including those to other services
+
+# Save trace setting
+MY_XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Defaults
+# --------
+
+# Set up default directories
+
+
+# Entry Points
+# ------------
+
+# configure_cinder_driver - Set config files, create data dirs, etc
+function configure_cinder_driver() {
+ # To use glusterfs, set the following in localrc:
+ # CINDER_DRIVER=glusterfs
+ # CINDER_GLUSTERFS_SHARES="127.0.0.1:/vol1;127.0.0.1:/vol2"
+ # Shares are <host>:<volume> and separated by semicolons.
+
+ iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.glusterfs.GlusterfsDriver"
+ iniset $CINDER_CONF DEFAULT glusterfs_shares_config "$CINDER_CONF_DIR/glusterfs_shares"
+ touch $CINDER_CONF_DIR/glusterfs_shares
+ if [ ! -z "$CINDER_GLUSTERFS_SHARES" ]; then
+ CINDER_GLUSTERFS_SHARES=$(echo $CINDER_GLUSTERFS_SHARES | tr ";" "\n")
+ echo "$CINDER_GLUSTERFS_SHARES" > $CINDER_CONF_DIR/glusterfs_shares
+ fi
+}
+
+# Restore xtrace
+$MY_XTRACE
+
+# Local variables:
+# mode: shell-script
+# End:
diff --git a/lib/cinder_plugins/nfs b/lib/cinder_plugins/nfs
new file mode 100644
index 0000000..ea2c9ce
--- /dev/null
+++ b/lib/cinder_plugins/nfs
@@ -0,0 +1,42 @@
+# lib/cinder_plugins/nfs
+# Configure the nfs driver
+
+# Enable with:
+#
+# CINDER_DRIVER=nfs
+
+# Dependencies:
+#
+# - ``functions`` file
+# - ``cinder`` configurations
+
+# configure_cinder_driver - make configuration changes, including those to other services
+
+# Save trace setting
+MY_XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Defaults
+# --------
+
+# Set up default directories
+
+
+# Entry Points
+# ------------
+
+# configure_cinder_driver - Set config files, create data dirs, etc
+function configure_cinder_driver() {
+ iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.nfs.NfsDriver"
+ iniset $CINDER_CONF DEFAULT nfs_shares_config "$CINDER_CONF_DIR/nfs_shares.conf"
+ echo "$CINDER_NFS_SERVERPATH" | sudo tee "$CINDER_CONF_DIR/nfs_shares.conf"
+ sudo chmod 660 $CINDER_CONF_DIR/nfs_shares.conf
+}
+
+# Restore xtrace
+$MY_XTRACE
+
+# Local variables:
+# mode: shell-script
+# End:
diff --git a/lib/cinder_plugins/sheepdog b/lib/cinder_plugins/sheepdog
new file mode 100644
index 0000000..4435932
--- /dev/null
+++ b/lib/cinder_plugins/sheepdog
@@ -0,0 +1,39 @@
+# lib/cinder_plugins/sheepdog
+# Configure the sheepdog driver
+
+# Enable with:
+#
+# CINDER_DRIVER=sheepdog
+
+# Dependencies:
+#
+# - ``functions`` file
+# - ``cinder`` configurations
+
+# configure_cinder_driver - make configuration changes, including those to other services
+
+# Save trace setting
+MY_XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Defaults
+# --------
+
+# Set up default directories
+
+
+# Entry Points
+# ------------
+
+# configure_cinder_driver - Set config files, create data dirs, etc
+function configure_cinder_driver() {
+ iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.sheepdog.SheepdogDriver"
+}
+
+# Restore xtrace
+$MY_XTRACE
+
+# Local variables:
+# mode: shell-script
+# End:
diff --git a/lib/cinder_plugins/solidfire b/lib/cinder_plugins/solidfire
new file mode 100644
index 0000000..47c113e
--- /dev/null
+++ b/lib/cinder_plugins/solidfire
@@ -0,0 +1,48 @@
+# lib/cinder_plugins/solidfire
+# Configure the solidfire driver
+
+# Enable with:
+#
+# CINDER_DRIVER=solidfire
+
+# Dependencies:
+#
+# - ``functions`` file
+# - ``cinder`` configurations
+
+# configure_cinder_driver - make configuration changes, including those to other services
+
+# Save trace setting
+MY_XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Defaults
+# --------
+
+# Set up default directories
+
+
+# Entry Points
+# ------------
+
+# configure_cinder_driver - Set config files, create data dirs, etc
+function configure_cinder_driver() {
+ # To use solidfire, set the following in localrc:
+ # CINDER_DRIVER=solidfire
+ # SAN_IP=<mvip>
+ # SAN_LOGIN=<cluster-admin-account>
+ # SAN_PASSWORD=<cluster-admin-password>
+
+ iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.solidfire.SolidFireDriver"
+ iniset $CINDER_CONF DEFAULT san_ip $SAN_IP
+ iniset $CINDER_CONF DEFAULT san_login $SAN_LOGIN
+ iniset $CINDER_CONF DEFAULT san_password $SAN_PASSWORD
+}
+
+# Restore xtrace
+$MY_XTRACE
+
+# Local variables:
+# mode: shell-script
+# End:
diff --git a/lib/cinder_plugins/vsphere b/lib/cinder_plugins/vsphere
new file mode 100644
index 0000000..c8cab6a
--- /dev/null
+++ b/lib/cinder_plugins/vsphere
@@ -0,0 +1,42 @@
+# lib/cinder_plugins/vsphere
+# Configure the vsphere driver
+
+# Enable with:
+#
+# CINDER_DRIVER=vsphere
+
+# Dependencies:
+#
+# - ``functions`` file
+# - ``cinder`` configurations
+
+# configure_cinder_driver - make configuration changes, including those to other services
+
+# Save trace setting
+MY_XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Defaults
+# --------
+
+# Set up default directories
+
+
+# Entry Points
+# ------------
+
+# configure_cinder_driver - Set config files, create data dirs, etc
+function configure_cinder_driver() {
+ iniset $CINDER_CONF DEFAULT vmware_host_ip "$VMWAREAPI_IP"
+ iniset $CINDER_CONF DEFAULT vmware_host_username "$VMWAREAPI_USER"
+ iniset $CINDER_CONF DEFAULT vmware_host_password "$VMWAREAPI_PASSWORD"
+ iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver"
+}
+
+# Restore xtrace
+$MY_XTRACE
+
+# Local variables:
+# mode: shell-script
+# End:
diff --git a/lib/glance b/lib/glance
index a5cb360..1ebeeb3 100644
--- a/lib/glance
+++ b/lib/glance
@@ -59,6 +59,13 @@
# Functions
# ---------
+# Test if any Glance services are enabled
+# is_glance_enabled
+function is_glance_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"g-" ]] && return 0
+ return 1
+}
+
# cleanup_glance() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_glance() {
diff --git a/lib/horizon b/lib/horizon
index c64d850..2f5795d 100644
--- a/lib/horizon
+++ b/lib/horizon
@@ -81,9 +81,6 @@
# init_horizon() - Initialize databases, etc.
function init_horizon() {
- # Remove stale session database.
- rm -f $HORIZON_DIR/openstack_dashboard/local/dashboard_openstack.sqlite3
-
# ``local_settings.py`` is used to override horizon default settings.
local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py
cp $HORIZON_SETTINGS $local_settings
@@ -106,12 +103,6 @@
_horizon_config_set $local_settings OPENSTACK_NEUTRON_NETWORK enable_vpn True
fi
- # Initialize the horizon database (it stores sessions and notices shown to
- # users). The user system is external (keystone).
- cd $HORIZON_DIR
- python manage.py syncdb --noinput
- cd $TOP_DIR
-
# Create an empty directory that apache uses as docroot
sudo mkdir -p $HORIZON_DIR/.blackhole
diff --git a/lib/ironic b/lib/ironic
index b8838f5..3c0e3cb 100644
--- a/lib/ironic
+++ b/lib/ironic
@@ -49,6 +49,13 @@
# Functions
# ---------
+# Test if any Ironic services are enabled
+# is_ironic_enabled
+function is_ironic_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"ir-" ]] && return 0
+ return 1
+}
+
# install_ironic() - Collect source and prepare
function install_ironic() {
git_clone $IRONIC_REPO $IRONIC_DIR $IRONIC_BRANCH
@@ -105,11 +112,6 @@
iniset $IRONIC_CONF_FILE keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
iniset $IRONIC_CONF_FILE keystone_authtoken admin_user ironic
iniset $IRONIC_CONF_FILE keystone_authtoken admin_password $SERVICE_PASSWORD
- if is_service_enabled qpid; then
- iniset $IRONIC_CONF_FILE DEFAULT notifier_strategy qpid
- elif [ -n "$RABBIT_HOST" ] && [ -n "$RABBIT_PASSWORD" ]; then
- iniset $IRONIC_CONF_FILE DEFAULT notifier_strategy rabbit
- fi
iniset_rpc_backend ironic $IRONIC_CONF_FILE DEFAULT
iniset $IRONIC_CONF_FILE keystone_authtoken signing_dir $IRONIC_AUTH_CACHE_DIR/api
diff --git a/lib/marconi b/lib/marconi
index 1eaebbd..7c8fd14 100644
--- a/lib/marconi
+++ b/lib/marconi
@@ -58,6 +58,13 @@
# Functions
# ---------
+# Test if any Marconi services are enabled
+# is_marconi_enabled
+function is_marconi_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"marconi-" ]] && return 0
+ return 1
+}
+
# cleanup_marconi() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_marconi() {
@@ -82,10 +89,6 @@
iniset $MARCONI_CONF DEFAULT verbose True
iniset $MARCONI_CONF 'drivers:transport:wsgi' bind '0.0.0.0'
- # Install the policy file for the API server
- cp $MARCONI_DIR/etc/marconi/policy.json $MARCONI_CONF_DIR
- iniset $MARCONI_CONF DEFAULT policy_file $MARCONI_CONF_DIR/policy.json
-
iniset $MARCONI_CONF keystone_authtoken auth_protocol http
iniset $MARCONI_CONF keystone_authtoken admin_user marconi
iniset $MARCONI_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
@@ -102,9 +105,16 @@
function configure_mongodb() {
# Set nssize to 2GB. This increases the number of namespaces supported
# # per database.
- sudo sed -i '/--nssize/!s/OPTIONS=\"/OPTIONS=\"--nssize 2047 /' /etc/sysconfig/mongod
-
- restart_service mongod
+ if is_ubuntu; then
+ sudo sed -i -e "
+ s|[^ \t]*#[ \t]*\(nssize[ \t]*=.*\$\)|\1|
+ s|^\(nssize[ \t]*=[ \t]*\).*\$|\1 2047|
+ " /etc/mongodb.conf
+ restart_service mongodb
+ elif is_fedora; then
+ sudo sed -i '/--nssize/!s/OPTIONS=\"/OPTIONS=\"--nssize 2047 /' /etc/sysconfig/mongod
+ restart_service mongod
+ fi
}
# init_marconi() - Initialize etc.
@@ -147,10 +157,12 @@
MARCONI_USER=$(get_id keystone user-create --name=marconi \
--pass="$SERVICE_PASSWORD" \
--tenant-id $SERVICE_TENANT \
- --email=marconi@example.com)
+ --email=marconi@example.com \
+ | grep " id " | get_field 2)
keystone user-role-add --tenant-id $SERVICE_TENANT \
--user-id $MARCONI_USER \
--role-id $ADMIN_ROLE
+
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
MARCONI_SERVICE=$(keystone service-create \
--name=marconi \
diff --git a/lib/neutron b/lib/neutron
index 81db2a7..5bd38bc 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -244,6 +244,13 @@
# Functions
# ---------
+# Test if any Neutron services are enabled
+# is_neutron_enabled
+function is_neutron_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0
+ return 1
+}
+
# configure_neutron()
# Set common config for all neutron server and agents.
function configure_neutron() {
diff --git a/lib/neutron_plugins/embrane b/lib/neutron_plugins/embrane
new file mode 100644
index 0000000..4206a20
--- /dev/null
+++ b/lib/neutron_plugins/embrane
@@ -0,0 +1,40 @@
+# Neutron Embrane plugin
+# ---------------------------
+
+# Save trace setting
+MY_XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+source $TOP_DIR/lib/neutron_plugins/openvswitch
+
+save_function() {
+ local ORIG_FUNC=$(declare -f $1)
+ local NEW_FUNC="$2${ORIG_FUNC#$1}"
+ eval "$NEW_FUNC"
+}
+
+save_function neutron_plugin_configure_service _neutron_plugin_configure_service
+
+function neutron_plugin_configure_common() {
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/embrane
+ Q_PLUGIN_CONF_FILENAME=heleos_conf.ini
+ Q_DB_NAME="ovs_neutron"
+ Q_PLUGIN_CLASS="neutron.plugins.embrane.plugins.embrane_ovs_plugin.EmbraneOvsPlugin"
+}
+
+function neutron_plugin_configure_service() {
+ _neutron_plugin_configure_service
+ iniset /$Q_PLUGIN_CONF_FILE heleos esm_mgmt $HELEOS_ESM_MGMT
+ iniset /$Q_PLUGIN_CONF_FILE heleos admin_username $HELEOS_ADMIN_USERNAME
+ iniset /$Q_PLUGIN_CONF_FILE heleos admin_password $HELEOS_ADMIN_PASSWORD
+ iniset /$Q_PLUGIN_CONF_FILE heleos router_image $HELEOS_ROUTER_IMAGE
+ iniset /$Q_PLUGIN_CONF_FILE heleos mgmt_id $HELEOS_MGMT_ID
+ iniset /$Q_PLUGIN_CONF_FILE heleos inband_id $HELEOS_INBAND_ID
+ iniset /$Q_PLUGIN_CONF_FILE heleos oob_id $HELEOS_OOB_ID
+ iniset /$Q_PLUGIN_CONF_FILE heleos dummy_utif_id $HELEOS_DUMMY_UTIF_ID
+ iniset /$Q_PLUGIN_CONF_FILE heleos resource_pool_id $HELEOS_RESOURCE_POOL_ID
+ iniset /$Q_PLUGIN_CONF_FILE heleos async_requests $HELEOS_ASYNC_REQUESTS
+}
+
+# Restore xtrace
+$MY_XTRACE
\ No newline at end of file
diff --git a/lib/nova b/lib/nova
index dbc5c3d..eaaaa62 100644
--- a/lib/nova
+++ b/lib/nova
@@ -129,6 +129,20 @@
# Functions
# ---------
+# Test if any Nova services are enabled
+# is_nova_enabled
+function is_nova_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"n-" ]] && return 0
+ return 1
+}
+
+# Test if any Nova Cell services are enabled
+# is_nova_enabled
+function is_n-cell_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"n-cell-" ]] && return 0
+ return 1
+}
+
# Helper to clean iptables rules
function clean_iptables() {
# Delete rules
@@ -389,6 +403,10 @@
fi
if is_service_enabled n-api; then
+ if is_service_enabled n-api-meta; then
+ # If running n-api-meta as a separate service
+ NOVA_ENABLED_APIS=$(echo $NOVA_ENABLED_APIS | sed "s/,metadata//")
+ fi
iniset $NOVA_CONF DEFAULT enabled_apis "$NOVA_ENABLED_APIS"
if is_service_enabled tls-proxy; then
# Set the service port for a proxy to take the original
@@ -442,7 +460,7 @@
iniset $NOVA_CONF DEFAULT instance_usage_audit "True"
iniset $NOVA_CONF DEFAULT instance_usage_audit_period "hour"
iniset $NOVA_CONF DEFAULT notify_on_state_change "vm_and_task_state"
- iniset $NOVA_CONF DEFAULT notification_driver "nova.openstack.common.notifier.rpc_notifier"
+ iniset $NOVA_CONF DEFAULT notification_driver "messaging"
fi
# Provide some transition from ``EXTRA_FLAGS`` to ``EXTRA_OPTS``
diff --git a/lib/nova_plugins/hypervisor-docker b/lib/nova_plugins/hypervisor-docker
index bb934b8..cdd9317 100644
--- a/lib/nova_plugins/hypervisor-docker
+++ b/lib/nova_plugins/hypervisor-docker
@@ -31,8 +31,8 @@
DOCKER_PID_FILE=/var/run/docker.pid
DOCKER_REGISTRY_PORT=${DOCKER_REGISTRY_PORT:-5042}
-DOCKER_IMAGE=${DOCKER_IMAGE:-busybox:latest}
-DOCKER_IMAGE_NAME=busybox
+DOCKER_IMAGE=${DOCKER_IMAGE:-cirros:latest}
+DOCKER_IMAGE_NAME=cirros
DOCKER_REGISTRY_IMAGE=${DOCKER_REGISTRY_IMAGE:-registry:latest}
DOCKER_REGISTRY_IMAGE_NAME=registry
DOCKER_REPOSITORY_NAME=${SERVICE_HOST}:${DOCKER_REGISTRY_PORT}/${DOCKER_IMAGE_NAME}
diff --git a/lib/nova_plugins/hypervisor-xenserver b/lib/nova_plugins/hypervisor-xenserver
index f47994f..9843261 100644
--- a/lib/nova_plugins/hypervisor-xenserver
+++ b/lib/nova_plugins/hypervisor-xenserver
@@ -56,6 +56,34 @@
# Need to avoid crash due to new firewall support
XEN_FIREWALL_DRIVER=${XEN_FIREWALL_DRIVER:-"nova.virt.firewall.IptablesFirewallDriver"}
iniset $NOVA_CONF DEFAULT firewall_driver "$XEN_FIREWALL_DRIVER"
+
+ local dom0_ip
+ dom0_ip=$(echo "$XENAPI_CONNECTION_URL" | cut -d "/" -f 3-)
+
+ local ssh_dom0
+ ssh_dom0="sudo -u $DOMZERO_USER ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$dom0_ip"
+
+ # install nova plugins to dom0
+ tar -czf - -C $NOVA_DIR/plugins/xenserver/xenapi/etc/xapi.d/plugins/ ./ |
+ $ssh_dom0 'tar -xzf - -C /etc/xapi.d/plugins/ && chmod a+x /etc/xapi.d/plugins/*'
+
+ # install console logrotate script
+ tar -czf - -C $NOVA_DIR/tools/xenserver/ rotate_xen_guest_logs.sh |
+ $ssh_dom0 'tar -xzf - -C /root/ && chmod +x /root/rotate_xen_guest_logs.sh && mkdir -p /var/log/xen/guest'
+
+ # Create a cron job that will rotate guest logs
+ $ssh_dom0 crontab - << CRONTAB
+* * * * * /root/rotate_xen_guest_logs.sh
+CRONTAB
+
+ # Create directories for kernels and images
+ {
+ echo "set -eux"
+ cat $TOP_DIR/tools/xen/functions
+ echo "create_directory_for_images"
+ echo "create_directory_for_kernels"
+ } | $ssh_dom0
+
}
# install_nova_hypervisor() - Install external components
diff --git a/lib/swift b/lib/swift
index 54d6f1c..be25c81 100644
--- a/lib/swift
+++ b/lib/swift
@@ -118,6 +118,13 @@
# Functions
# ---------
+# Test if any Swift services are enabled
+# is_swift_enabled
+function is_swift_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"s-" ]] && return 0
+ return 1
+}
+
# cleanup_swift() - Remove residual data files
function cleanup_swift() {
rm -f ${SWIFT_CONF_DIR}{*.builder,*.ring.gz,backups/*.builder,backups/*.ring.gz}
@@ -341,7 +348,7 @@
# NOTE(chmou): s3token middleware is not updated yet to use only
# username and password.
[filter:s3token]
-paste.filter_factory = keystone.middleware.s3_token:filter_factory
+paste.filter_factory = keystoneclient.middleware.s3_token:filter_factory
auth_port = ${KEYSTONE_AUTH_PORT}
auth_host = ${KEYSTONE_AUTH_HOST}
auth_protocol = ${KEYSTONE_AUTH_PROTOCOL}
@@ -513,6 +520,11 @@
# swifttenanttest2 swiftusertest2 admin
function create_swift_accounts() {
+ # Defines specific passwords used by tools/create_userrc.sh
+ SWIFTUSERTEST1_PASSWORD=testing
+ SWIFTUSERTEST2_PASSWORD=testing2
+ SWIFTUSERTEST3_PASSWORD=testing3
+
KEYSTONE_CATALOG_BACKEND=${KEYSTONE_CATALOG_BACKEND:-sql}
SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
@@ -535,17 +547,17 @@
SWIFT_TENANT_TEST1=$(keystone tenant-create --name=swifttenanttest1 | grep " id " | get_field 2)
die_if_not_set $LINENO SWIFT_TENANT_TEST1 "Failure creating SWIFT_TENANT_TEST1"
- SWIFT_USER_TEST1=$(keystone user-create --name=swiftusertest1 --pass=testing --email=test@example.com | grep " id " | get_field 2)
+ SWIFT_USER_TEST1=$(keystone user-create --name=swiftusertest1 --pass=$SWIFTUSERTEST1_PASSWORD --email=test@example.com | grep " id " | get_field 2)
die_if_not_set $LINENO SWIFT_USER_TEST1 "Failure creating SWIFT_USER_TEST1"
keystone user-role-add --user-id $SWIFT_USER_TEST1 --role-id $ADMIN_ROLE --tenant-id $SWIFT_TENANT_TEST1
- SWIFT_USER_TEST3=$(keystone user-create --name=swiftusertest3 --pass=testing3 --email=test3@example.com | grep " id " | get_field 2)
+ SWIFT_USER_TEST3=$(keystone user-create --name=swiftusertest3 --pass=$SWIFTUSERTEST3_PASSWORD --email=test3@example.com | grep " id " | get_field 2)
die_if_not_set $LINENO SWIFT_USER_TEST3 "Failure creating SWIFT_USER_TEST3"
keystone user-role-add --user-id $SWIFT_USER_TEST3 --role-id $ANOTHER_ROLE --tenant-id $SWIFT_TENANT_TEST1
SWIFT_TENANT_TEST2=$(keystone tenant-create --name=swifttenanttest2 | grep " id " | get_field 2)
die_if_not_set $LINENO SWIFT_TENANT_TEST2 "Failure creating SWIFT_TENANT_TEST2"
- SWIFT_USER_TEST2=$(keystone user-create --name=swiftusertest2 --pass=testing2 --email=test2@example.com | grep " id " | get_field 2)
+ SWIFT_USER_TEST2=$(keystone user-create --name=swiftusertest2 --pass=$SWIFTUSERTEST2_PASSWORD --email=test2@example.com | grep " id " | get_field 2)
die_if_not_set $LINENO SWIFT_USER_TEST2 "Failure creating SWIFT_USER_TEST2"
keystone user-role-add --user-id $SWIFT_USER_TEST2 --role-id $ADMIN_ROLE --tenant-id $SWIFT_TENANT_TEST2
}
@@ -657,10 +669,8 @@
if type -p swift-init >/dev/null; then
swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
fi
- for type in proxy object container account; do
- # Dump all of the servers
- pkill -f swift-
- done
+ # Dump all of the servers
+ pkill -f swift-
}
# Restore xtrace
diff --git a/lib/tempest b/lib/tempest
index 06183b1..c8eebfc 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -251,6 +251,7 @@
# Identity
iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v2.0/"
+ iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v3/"
iniset $TEMPEST_CONFIG identity password "$password"
iniset $TEMPEST_CONFIG identity alt_username $ALT_USERNAME
iniset $TEMPEST_CONFIG identity alt_password "$password"
@@ -266,11 +267,6 @@
# Compute
iniset $TEMPEST_CONFIG compute change_password_available False
- # Note(nati) current tempest don't create network for each tenant
- # so reuse same tenant for now
- if is_service_enabled neutron; then
- TEMPEST_ALLOW_TENANT_ISOLATION=${TEMPEST_ALLOW_TENANT_ISOLATION:-False}
- fi
iniset $TEMPEST_CONFIG compute allow_tenant_isolation ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
iniset $TEMPEST_CONFIG compute ssh_user ${DEFAULT_INSTANCE_USER:-cirros} # DEPRECATED
iniset $TEMPEST_CONFIG compute network_for_ssh $PRIVATE_NETWORK_NAME
@@ -323,7 +319,7 @@
fi
CINDER_MULTI_LVM_BACKEND=$(trueorfalse False $CINDER_MULTI_LVM_BACKEND)
if [ $CINDER_MULTI_LVM_BACKEND == "True" ]; then
- iniset $TEMPEST_CONFIG volume multi_backend_enabled "True"
+ iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
iniset $TEMPEST_CONFIG volume backend1_name "LVM_iSCSI"
iniset $TEMPEST_CONFIG volume backend2_name "LVM_iSCSI_2"
fi
@@ -352,9 +348,6 @@
fi
done
- echo "Created tempest configuration file:"
- cat $TEMPEST_CONFIG
-
# Restore IFS
IFS=$ifs
#Restore errexit
diff --git a/lib/template b/lib/template
index 629e110..b8e7c4d 100644
--- a/lib/template
+++ b/lib/template
@@ -10,6 +10,7 @@
# ``stack.sh`` calls the entry points in this order:
#
+# - is_XXXX_enabled
# - install_XXXX
# - configure_XXXX
# - init_XXXX
@@ -35,6 +36,13 @@
# Entry Points
# ------------
+# Test if any XXXX services are enabled
+# is_XXXX_enabled
+function is_XXXX_enabled {
+ [[ ,${ENABLED_SERVICES} =~ ,"XX-" ]] && return 0
+ return 1
+}
+
# cleanup_XXXX() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_XXXX() {
diff --git a/stack.sh b/stack.sh
index 15e1430..1dc4b74 100755
--- a/stack.sh
+++ b/stack.sh
@@ -298,6 +298,8 @@
SYSSTAT_FILE=${SYSSTAT_FILE:-"sysstat.dat"}
SYSSTAT_INTERVAL=${SYSSTAT_INTERVAL:-"1"}
+DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"}
+
PIDSTAT_FILE=${PIDSTAT_FILE:-"pidstat.txt"}
PIDSTAT_INTERVAL=${PIDSTAT_INTERVAL:-"5"}
@@ -336,7 +338,6 @@
source $TOP_DIR/lib/neutron
source $TOP_DIR/lib/baremetal
source $TOP_DIR/lib/ldap
-source $TOP_DIR/lib/ironic
# Extras Source
# --------------
@@ -363,7 +364,11 @@
var=$1; msg=$2
pw=${!var}
- localrc=$TOP_DIR/localrc
+ if [[ -f $RC_DIR/localrc ]]; then
+ localrc=$TOP_DIR/localrc
+ else
+ localrc=$TOP_DIR/.localrc.auto
+ fi
# If the password is not defined yet, proceed to prompt user for a password.
if [ ! $pw ]; then
@@ -746,11 +751,6 @@
# don't be naive and add to existing line!
fi
-if is_service_enabled ir-api ir-cond; then
- install_ironic
- install_ironicclient
- configure_ironic
-fi
# Extras Install
# --------------
@@ -881,6 +881,16 @@
fi
fi
+if is_service_enabled dstat; then
+ # Per-process stats
+ DSTAT_OPTS="-tcndylp --top-cpu-adv"
+ if [[ -n ${SCREEN_LOGDIR} ]]; then
+ screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $SCREEN_LOGDIR/$DSTAT_FILE"
+ else
+ screen_it dstat "dstat $DSTAT_OPTS"
+ fi
+fi
+
if is_service_enabled pidstat; then
# Per-process stats
PIDSTAT_OPTS="-l -p ALL -T ALL"
@@ -966,15 +976,6 @@
fi
-# Ironic
-# ------
-
-if is_service_enabled ir-api ir-cond; then
- echo_summary "Configuring Ironic"
- init_ironic
-fi
-
-
# Neutron
# -------
@@ -1096,17 +1097,11 @@
fi
# Launch the Glance services
-if is_service_enabled g-api g-reg; then
+if is_service_enabled glance; then
echo_summary "Starting Glance"
start_glance
fi
-# Launch the Ironic services
-if is_service_enabled ir-api ir-cond; then
- echo_summary "Starting Ironic"
- start_ironic
-fi
-
# Create an access key and secret key for nova ec2 register image
if is_service_enabled key && is_service_enabled swift3 && is_service_enabled nova; then
NOVA_USER_ID=$(keystone user-list | grep ' nova ' | get_field 1)
@@ -1186,7 +1181,7 @@
# Configure and launch heat engine, api and metadata
if is_service_enabled heat; then
- # Initialize heat, including replacing nova flavors
+ # Initialize heat
echo_summary "Configuring Heat"
init_heat
echo_summary "Starting Heat"
@@ -1355,11 +1350,6 @@
echo "Horizon is now available at http://$SERVICE_HOST/"
fi
-# Warn that the default flavors have been changed by Heat
-if is_service_enabled heat; then
- echo "Heat has replaced the default flavors. View by running: nova flavor-list"
-fi
-
# If Keystone is present you can point ``nova`` cli to this server
if is_service_enabled key; then
echo "Keystone is serving at $KEYSTONE_AUTH_PROTOCOL://$SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v2.0/"
diff --git a/stackrc b/stackrc
index e89d25e..e362cd1 100644
--- a/stackrc
+++ b/stackrc
@@ -35,7 +35,7 @@
# enable_service neutron
# # Optional, to enable tempest configuration as part of devstack
# enable_service tempest
-ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,tempest,mysql
+ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,tempest,mysql
# Tell Tempest which services are available. The default is set here as
# Tempest falls late in the configuration sequence. This differs from
@@ -171,7 +171,7 @@
# storage service
SWIFT_REPO=${SWIFT_REPO:-${GIT_BASE}/openstack/swift.git}
SWIFT_BRANCH=${SWIFT_BRANCH:-master}
-SWIFT3_REPO=${SWIFT3_REPO:-${GIT_BASE}/fujita/swift3.git}
+SWIFT3_REPO=${SWIFT3_REPO:-http://github.com/fujita/swift3.git}
SWIFT3_BRANCH=${SWIFT3_BRANCH:-master}
# python swift client library
@@ -245,6 +245,10 @@
xenserver)
# Xen config common to nova and neutron
XENAPI_USER=${XENAPI_USER:-"root"}
+ # This user will be used for dom0 - domU communication
+ # should be able to log in to dom0 without a password
+ # will be used to install the plugins
+ DOMZERO_USER=${DOMZERO_USER:-"domzero"}
;;
*)
;;
diff --git a/tools/bash8.py b/tools/bash8.py
index 9fb51ec..7552e0d 100755
--- a/tools/bash8.py
+++ b/tools/bash8.py
@@ -47,7 +47,7 @@
def register_ignores(ignores):
global IGNORE
if ignores:
- IGNORE='^(' + '|'.join(ignores.split(',')) + ')'
+ IGNORE = '^(' + '|'.join(ignores.split(',')) + ')'
def should_ignore(error):
@@ -64,11 +64,15 @@
def not_continuation(line):
return not re.search('\\\\$', line)
+
def check_for_do(line):
if not_continuation(line):
- if re.search('^\s*for ', line):
+ match = re.match('^\s*(for|while|until)\s', line)
+ if match:
+ operator = match.group(1).strip()
if not re.search(';\s*do(\b|$)', line):
- print_error('E010: Do not on same line as for', line)
+ print_error('E010: Do not on same line as %s' % operator,
+ line)
def check_if_then(line):
diff --git a/tools/build_tempest.sh b/tools/build_tempest.sh
deleted file mode 100755
index 6c527f5..0000000
--- a/tools/build_tempest.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env bash
-#
-# **build_tempest.sh**
-
-# Checkout and prepare a Tempest repo: git://git.openstack.org/openstack/tempest.git
-
-function usage {
- echo "$0 - Check out and prepare a Tempest repo"
- echo ""
- echo "Usage: $0"
- exit 1
-}
-
-if [ "$1" = "-h" ]; then
- usage
-fi
-
-# Clean up any resources that may be in use
-cleanup() {
- set +o errexit
-
- # Kill ourselves to signal any calling process
- trap 2; kill -2 $$
-}
-
-trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
-
-# Keep track of the current directory
-TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
-
-# Import common functions
-. $TOP_DIR/functions
-
-# Abort if localrc is not set
-if [ ! -e $TOP_DIR/localrc ]; then
- echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding."
- echo "See stack.sh for required passwords."
- exit 1
-fi
-
-# Source params
-source ./stackrc
-
-# Where Openstack code lives
-DEST=${DEST:-/opt/stack}
-
-TEMPEST_DIR=$DEST/tempest
-
-# Install tests and prerequisites
-git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
-
-trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT
diff --git a/tools/create_userrc.sh b/tools/create_userrc.sh
index 5f4c486..d9c93cc 100755
--- a/tools/create_userrc.sh
+++ b/tools/create_userrc.sh
@@ -71,8 +71,7 @@
ROLE=Member
USER_NAME=""
USER_PASS=""
-while [ $# -gt 0 ]
-do
+while [ $# -gt 0 ]; do
case "$1" in
-h|--help) display_help; exit 0 ;;
--os-username) export OS_USERNAME=$2; shift ;;
@@ -254,6 +253,14 @@
if [ $MODE = one -a "$user_name" != "$USER_NAME" ]; then
continue;
fi
+
+ # Checks for a specific password defined for an user.
+ # Example for an username johndoe:
+ # JOHNDOE_PASSWORD=1234
+ eval SPECIFIC_UPASSWORD="\$${USER_NAME^^}_PASSWORD"
+ if [ -n "$SPECIFIC_UPASSWORD" ]; then
+ USER_PASS=$SPECIFIC_UPASSWORD
+ fi
add_entry "$user_id" "$user_name" "$tenant_id" "$tenant_name" "$USER_PASS"
done
done
diff --git a/tools/docker/install_docker.sh b/tools/docker/install_docker.sh
index 4fa2386..27c8c82 100755
--- a/tools/docker/install_docker.sh
+++ b/tools/docker/install_docker.sh
@@ -30,15 +30,19 @@
# Install Docker Service
# ======================
-# Stop the auto-repo updates and do it when required here
-NO_UPDATE_REPOS=True
+if is_fedora; then
+ install_package docker-io socat
+else
+ # Stop the auto-repo updates and do it when required here
+ NO_UPDATE_REPOS=True
-# Set up home repo
-curl https://get.docker.io/gpg | sudo apt-key add -
-install_package python-software-properties && \
- sudo sh -c "echo deb $DOCKER_APT_REPO docker main > /etc/apt/sources.list.d/docker.list"
-apt_get update
-install_package --force-yes lxc-docker socat
+ # Set up home repo
+ curl https://get.docker.io/gpg | sudo apt-key add -
+ install_package python-software-properties && \
+ sudo sh -c "echo deb $DOCKER_APT_REPO docker main > /etc/apt/sources.list.d/docker.list"
+ apt_get update
+ install_package --force-yes lxc-docker socat
+fi
# Start the daemon - restart just in case the package ever auto-starts...
restart_service docker
@@ -60,5 +64,5 @@
docker tag $DOCKER_IMAGE $DOCKER_IMAGE_NAME
# Get docker-registry image
-docker pull $REGISTRY_IMAGE
-docker tag $REGISTRY_IMAGE $REGISTRY_IMAGE_NAME
+docker pull $DOCKER_REGISTRY_IMAGE
+docker tag $DOCKER_REGISTRY_IMAGE $DOCKER_REGISTRY_IMAGE_NAME
diff --git a/tools/xen/build_xva.sh b/tools/xen/build_xva.sh
index 958102b..fbbfd6f 100755
--- a/tools/xen/build_xva.sh
+++ b/tools/xen/build_xva.sh
@@ -21,9 +21,19 @@
# This directory
TOP_DIR=$(cd $(dirname "$0") && pwd)
+# Source lower level functions
+. $TOP_DIR/../../functions
+
# Include onexit commands
. $TOP_DIR/scripts/on_exit.sh
+# xapi functions
+. $TOP_DIR/functions
+
+# Determine what system we are running on.
+# Might not be XenServer if we're using xenserver-core
+GetDistro
+
# Source params - override xenrc params in your localrc to suite your taste
source xenrc
diff --git a/tools/xen/functions b/tools/xen/functions
index 97c56bc..ab0be84 100644
--- a/tools/xen/functions
+++ b/tools/xen/functions
@@ -336,3 +336,11 @@
xe vm-param-set uuid=$vm VCPUs-max=$cpu_count
xe vm-param-set uuid=$vm VCPUs-at-startup=$cpu_count
}
+
+function get_domid() {
+ local vm_name_label
+
+ vm_name_label="$1"
+
+ xe vm-list name-label="$vm_name_label" params=dom-id minimal=true
+}
diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh
index d172c7b..7b59bae 100755
--- a/tools/xen/install_os_domU.sh
+++ b/tools/xen/install_os_domU.sh
@@ -67,21 +67,6 @@
# Install plugins
-## Nova plugins
-NOVA_ZIPBALL_URL=${NOVA_ZIPBALL_URL:-$(zip_snapshot_location $NOVA_REPO $NOVA_BRANCH)}
-EXTRACTED_NOVA=$(extract_remote_zipball "$NOVA_ZIPBALL_URL")
-install_xapi_plugins_from "$EXTRACTED_NOVA"
-
-LOGROT_SCRIPT=$(find "$EXTRACTED_NOVA" -name "rotate_xen_guest_logs.sh" -print)
-if [ -n "$LOGROT_SCRIPT" ]; then
- mkdir -p "/var/log/xen/guest"
- cp "$LOGROT_SCRIPT" /root/consolelogrotate
- chmod +x /root/consolelogrotate
- echo "* * * * * /root/consolelogrotate" | crontab
-fi
-
-rm -rf "$EXTRACTED_NOVA"
-
## Install the netwrap xapi plugin to support agent control of dom0 networking
if [[ "$ENABLED_SERVICES" =~ "q-agt" && "$Q_PLUGIN" = "openvswitch" ]]; then
NEUTRON_ZIPBALL_URL=${NEUTRON_ZIPBALL_URL:-$(zip_snapshot_location $NEUTRON_REPO $NEUTRON_BRANCH)}
@@ -90,9 +75,6 @@
rm -rf "$EXTRACTED_NEUTRON"
fi
-create_directory_for_kernels
-create_directory_for_images
-
#
# Configure Networking
#
@@ -188,11 +170,10 @@
set +x
echo "Waiting for the VM to halt. Progress in-VM can be checked with vncviewer:"
mgmt_ip=$(echo $XENAPI_CONNECTION_URL | tr -d -c '1234567890.')
- domid=$(xe vm-list name-label="$GUEST_NAME" params=dom-id minimal=true)
+ domid=$(get_domid "$GUEST_NAME")
port=$(xenstore-read /local/domain/$domid/console/vnc-port)
echo "vncviewer -via root@$mgmt_ip localhost:${port:2}"
- while true
- do
+ while true; do
state=$(xe_min vm-list name-label="$GUEST_NAME" power-state=halted)
if [ -n "$state" ]; then
break
@@ -360,6 +341,37 @@
fi
fi
+# Create an ssh-keypair, and set it up for dom0 user
+rm -f /root/dom0key /root/dom0key.pub
+ssh-keygen -f /root/dom0key -P "" -C "dom0"
+DOMID=$(get_domid "$GUEST_NAME")
+
+xenstore-write /local/domain/$DOMID/authorized_keys/$DOMZERO_USER "$(cat /root/dom0key.pub)"
+xenstore-chmod -u /local/domain/$DOMID/authorized_keys/$DOMZERO_USER r$DOMID
+
+function run_on_appliance() {
+ ssh \
+ -i /root/dom0key \
+ -o UserKnownHostsFile=/dev/null \
+ -o StrictHostKeyChecking=no \
+ -o BatchMode=yes \
+ "$DOMZERO_USER@$OS_VM_MANAGEMENT_ADDRESS" "$@"
+}
+
+# Wait until we can log in to the appliance
+while ! run_on_appliance true; do
+ sleep 1
+done
+
+# Remove authenticated_keys updater cronjob
+echo "" | run_on_appliance crontab -
+
+# Generate a passwordless ssh key for domzero user
+echo "ssh-keygen -f /home/$DOMZERO_USER/.ssh/id_rsa -C $DOMZERO_USER@appliance -N \"\" -q" | run_on_appliance
+
+# Authenticate that user to dom0
+run_on_appliance cat /home/$DOMZERO_USER/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
+
# If we have copied our ssh credentials, use ssh to monitor while the installation runs
WAIT_TILL_LAUNCH=${WAIT_TILL_LAUNCH:-1}
COPYENV=${COPYENV:-1}
diff --git a/tools/xen/prepare_guest.sh b/tools/xen/prepare_guest.sh
index 05ac86c..0946126 100755
--- a/tools/xen/prepare_guest.sh
+++ b/tools/xen/prepare_guest.sh
@@ -18,6 +18,57 @@
GUEST_PASSWORD="$1"
XS_TOOLS_PATH="$2"
STACK_USER="$3"
+DOMZERO_USER="$4"
+
+
+function setup_domzero_user() {
+ local username
+
+ username="$1"
+
+ local key_updater_script
+ local sudoers_file
+ key_updater_script="/home/$username/update_authorized_keys.sh"
+ sudoers_file="/etc/sudoers.d/allow_$username"
+
+ # Create user
+ adduser --disabled-password --quiet "$username" --gecos "$username"
+
+ # Give passwordless sudo
+ cat > $sudoers_file << EOF
+ $username ALL = NOPASSWD: ALL
+EOF
+ chmod 0440 $sudoers_file
+
+ # A script to populate this user's authenticated_keys from xenstore
+ cat > $key_updater_script << EOF
+#!/bin/bash
+set -eux
+
+DOMID=\$(sudo xenstore-read domid)
+sudo xenstore-exists /local/domain/\$DOMID/authorized_keys/$username
+sudo xenstore-read /local/domain/\$DOMID/authorized_keys/$username > /home/$username/xenstore_value
+cat /home/$username/xenstore_value > /home/$username/.ssh/authorized_keys
+EOF
+
+ # Give the key updater to the user
+ chown $username:$username $key_updater_script
+ chmod 0700 $key_updater_script
+
+ # Setup the .ssh folder
+ mkdir -p /home/$username/.ssh
+ chown $username:$username /home/$username/.ssh
+ chmod 0700 /home/$username/.ssh
+ touch /home/$username/.ssh/authorized_keys
+ chown $username:$username /home/$username/.ssh/authorized_keys
+ chmod 0600 /home/$username/.ssh/authorized_keys
+
+ # Setup the key updater as a cron job
+ crontab -u $username - << EOF
+* * * * * $key_updater_script
+EOF
+
+}
# Install basics
apt-get update
@@ -48,6 +99,8 @@
echo $STACK_USER:$GUEST_PASSWORD | chpasswd
echo "$STACK_USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
+setup_domzero_user "$DOMZERO_USER"
+
# Add an udev rule, so that new block devices could be written by stack user
cat > /etc/udev/rules.d/50-openstack-blockdev.rules << EOF
KERNEL=="xvd[b-z]", GROUP="$STACK_USER", MODE="0660"
diff --git a/tools/xen/prepare_guest_template.sh b/tools/xen/prepare_guest_template.sh
index 546ac99..eaab2fe 100755
--- a/tools/xen/prepare_guest_template.sh
+++ b/tools/xen/prepare_guest_template.sh
@@ -22,9 +22,19 @@
# This directory
TOP_DIR=$(cd $(dirname "$0") && pwd)
+# Source lower level functions
+. $TOP_DIR/../../functions
+
# Include onexit commands
. $TOP_DIR/scripts/on_exit.sh
+# xapi functions
+. $TOP_DIR/functions
+
+# Determine what system we are running on.
+# Might not be XenServer if we're using xenserver-core
+GetDistro
+
# Source params - override xenrc params in your localrc to suite your taste
source xenrc
@@ -76,7 +86,7 @@
cat <<EOF >$STAGING_DIR/etc/rc.local
#!/bin/sh -e
bash /opt/stack/prepare_guest.sh \\
- "$GUEST_PASSWORD" "$XS_TOOLS_PATH" "$STACK_USER" \\
+ "$GUEST_PASSWORD" "$XS_TOOLS_PATH" "$STACK_USER" "$DOMZERO_USER" \\
> /opt/stack/prepare_guest.log 2>&1
EOF
diff --git a/tools/xen/scripts/install-os-vpx.sh b/tools/xen/scripts/install-os-vpx.sh
index 8412fdc..b9b65fd 100755
--- a/tools/xen/scripts/install-os-vpx.sh
+++ b/tools/xen/scripts/install-os-vpx.sh
@@ -42,8 +42,7 @@
get_params()
{
- while getopts "hbn:r:l:t:" OPTION;
- do
+ while getopts "hbn:r:l:t:" OPTION; do
case $OPTION in
h) usage
exit 1
diff --git a/tools/xen/xenrc b/tools/xen/xenrc
index cd28234..278bb9b 100644
--- a/tools/xen/xenrc
+++ b/tools/xen/xenrc
@@ -35,7 +35,7 @@
GUEST_PASSWORD=${GUEST_PASSWORD:-secrete}
# Extracted variables for OpenStack VM network device numbers.
-# Make sure, they form a continous sequence starting from 0
+# Make sure they form a continuous sequence starting from 0
MGT_DEV_NR=0
VM_DEV_NR=1
PUB_DEV_NR=2
@@ -91,4 +91,7 @@
# Set the size to 0 to avoid creation of additional disk.
XEN_XVDB_SIZE_GB=0
+restore_nounset=`set +o | grep nounset`
+set +u
source ../../stackrc
+$restore_nounset
diff --git a/unstack.sh b/unstack.sh
index 92d0642..6351fe0 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -55,7 +55,6 @@
source $TOP_DIR/lib/neutron
source $TOP_DIR/lib/baremetal
source $TOP_DIR/lib/ldap
-source $TOP_DIR/lib/ironic
# Extras Source
# --------------
@@ -104,7 +103,7 @@
stop_nova
fi
-if is_service_enabled g-api g-reg; then
+if is_service_enabled glance; then
stop_glance
fi
@@ -118,12 +117,6 @@
cleanup_swift
fi
-# Ironic runs daemons
-if is_service_enabled ir-api ir-cond; then
- stop_ironic
- cleanup_ironic
-fi
-
# Apache has the WSGI processes
if is_service_enabled horizon; then
stop_horizon