Merge "If heat is enabled, replace nova flavors."
diff --git a/exercises/boot_from_volume.sh b/exercises/boot_from_volume.sh
index 183efa6..460b50c 100755
--- a/exercises/boot_from_volume.sh
+++ b/exercises/boot_from_volume.sh
@@ -139,16 +139,10 @@
nova add-floating-ip $VOL_VM_UUID $FLOATING_IP
# Test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then
- echo "Couldn't ping volume-backed server with floating ip"
- exit 1
-fi
+ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT
# Make sure our volume-backed instance launched
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! ssh -o StrictHostKeyChecking=no -i $KEY_FILE ${DEFAULT_INSTANCE_USER}@$FLOATING_IP echo success ; do sleep 1; done"; then
- echo "server didn't become ssh-able!"
- exit 1
-fi
+ssh_check "$PUBLIC_NETWORK_NAME" $KEY_FILE $FLOATING_IP $DEFAULT_INSTANCE_USER $ACTIVE_TIMEOUT
# Remove floating ip from volume-backed instance
nova remove-floating-ip $VOL_VM_UUID $FLOATING_IP
diff --git a/exercises/euca.sh b/exercises/euca.sh
index 58b5d91..b121493 100755
--- a/exercises/euca.sh
+++ b/exercises/euca.sh
@@ -130,10 +130,7 @@
die "Failure authorizing rule in $SECGROUP"
# Test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then
- echo "Couldn't ping server with floating ip"
- exit 1
-fi
+ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT
# Revoke pinging
euca-revoke -P icmp -s 0.0.0.0/0 -t -1:-1 $SECGROUP || \
diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh
index 77f020e..6787878 100755
--- a/exercises/floating_ips.sh
+++ b/exercises/floating_ips.sh
@@ -118,23 +118,10 @@
fi
# get the IP of the server
-IP=`nova show $VM_UUID | grep "private network" | get_field 2`
+IP=`nova show $VM_UUID | grep "$PRIVATE_NETWORK_NAME" | get_field 2`
die_if_not_set IP "Failure retrieving IP address"
-# for single node deployments, we can ping private ips
-MULTI_HOST=`trueorfalse False $MULTI_HOST`
-if [ "$MULTI_HOST" = "False" ]; then
- # sometimes the first ping fails (10 seconds isn't enough time for the VM's
- # network to respond?), so let's ping for a default of 15 seconds with a
- # timeout of a second for each ping.
- if ! timeout $BOOT_TIMEOUT sh -c "while ! ping -c1 -w1 $IP; do sleep 1; done"; then
- echo "Couldn't ping server"
- exit 1
- fi
-else
- # On a multi-host system, without vm net access, do a sleep to wait for the boot
- sleep $BOOT_TIMEOUT
-fi
+ping_check "$PRIVATE_NETWORK_NAME" $IP $BOOT_TIMEOUT
# Security Groups & Floating IPs
# ------------------------------
@@ -166,10 +153,7 @@
die "Failure adding floating IP $FLOATING_IP to $NAME"
# test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then
- echo "Couldn't ping server with floating ip"
- exit 1
-fi
+ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT
# Allocate an IP from second floating pool
TEST_FLOATING_IP=`nova floating-ip-create $TEST_FLOATING_POOL | grep $TEST_FLOATING_POOL | get_field 1`
@@ -187,19 +171,16 @@
# FIXME (anthony): make xs support security groups
if [ "$VIRT_DRIVER" != "xenserver" -a "$VIRT_DRIVER" != "openvz" ]; then
# test we can aren't able to ping our floating ip within ASSOCIATE_TIMEOUT seconds
- if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then
- print "Security group failure - ping should not be allowed!"
- echo "Couldn't ping server with floating ip"
- exit 1
- fi
+ ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT
fi
-# de-allocate the floating ip
-nova floating-ip-delete $FLOATING_IP || die "Failure deleting floating IP $FLOATING_IP"
-
# Delete second floating IP
nova floating-ip-delete $TEST_FLOATING_IP || die "Failure deleting floating IP $TEST_FLOATING_IP"
+
+# de-allocate the floating ip
+nova floating-ip-delete $FLOATING_IP || die "Failure deleting floating IP $FLOATING_IP"
+
# Shutdown the server
nova delete $VM_UUID || die "Failure deleting instance $NAME"
diff --git a/exercises/volumes.sh b/exercises/volumes.sh
index ffa12c4..1c73786 100755
--- a/exercises/volumes.sh
+++ b/exercises/volumes.sh
@@ -119,23 +119,11 @@
fi
# get the IP of the server
-IP=`nova show $VM_UUID | grep "private network" | get_field 2`
+IP=`nova show $VM_UUID | grep "$PRIVATE_NETWORK_NAME" | get_field 2`
die_if_not_set IP "Failure retrieving IP address"
# for single node deployments, we can ping private ips
-MULTI_HOST=`trueorfalse False $MULTI_HOST`
-if [ "$MULTI_HOST" = "False" ]; then
- # sometimes the first ping fails (10 seconds isn't enough time for the VM's
- # network to respond?), so let's ping for a default of 15 seconds with a
- # timeout of a second for each ping.
- if ! timeout $BOOT_TIMEOUT sh -c "while ! ping -c1 -w1 $IP; do sleep 1; done"; then
- echo "Couldn't ping server"
- exit 1
- fi
-else
- # On a multi-host system, without vm net access, do a sleep to wait for the boot
- sleep $BOOT_TIMEOUT
-fi
+ping_check "$PRIVATE_NETWORK_NAME" $IP $BOOT_TIMEOUT
# Volumes
# -------
diff --git a/files/keystone_data.sh b/files/keystone_data.sh
index 7da07aa..9520b17 100755
--- a/files/keystone_data.sh
+++ b/files/keystone_data.sh
@@ -262,6 +262,21 @@
fi
fi
+if [[ "$ENABLED_SERVICES" =~ "ceilometer-api" ]]; then
+ if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
+ CEILOMETER_SERVICE=$(get_id keystone service-create \
+ --name=ceilometer \
+ --type=metering \
+ --description="Ceilometer Service")
+ keystone endpoint-create \
+ --region RegionOne \
+ --service_id $CEILOMETER_SERVICE \
+ --publicurl "http://$SERVICE_HOST:8777/" \
+ --adminurl "http://$SERVICE_HOST:8777/" \
+ --internalurl "http://$SERVICE_HOST:8777/"
+ fi
+fi
+
# EC2
if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
diff --git a/functions b/functions
index 0d0df51..dbe9d30 100644
--- a/functions
+++ b/functions
@@ -849,6 +849,42 @@
yum install -y "$@"
}
+# ping check
+# Uses globals ``ENABLED_SERVICES``
+function ping_check() {
+ _ping_check_novanet "$1" $2 $3
+}
+
+# ping check for nova
+# Uses globals ``MULTI_HOST``, ``PRIVATE_NETWORK``
+function _ping_check_novanet() {
+ local from_net=$1
+ local ip=$2
+ local boot_timeout=$3
+ MULTI_HOST=`trueorfalse False $MULTI_HOST`
+ if [[ "$MULTI_HOST" = "True" && "$from_net" = "$PRIVATE_NETWORK_NAME" ]]; then
+ sleep $boot_timeout
+ return
+ fi
+ if ! timeout $boot_timeout sh -c "while ! ping -c1 -w1 $ip; do sleep 1; done"; then
+ echo "Couldn't ping server"
+ exit 1
+ fi
+}
+
+# ssh check
+function ssh_check() {
+ local NET_NAME=$1
+ local KEY_FILE=$2
+ local FLOATING_IP=$3
+ local DEFAULT_INSTANCE_USER=$4
+ local ACTIVE_TIMEOUT=$5
+ local probe_cmd = ""
+ if ! timeout $ACTIVE_TIMEOUT sh -c "while ! ssh -o StrictHostKeyChecking=no -i $KEY_FILE ${DEFAULT_INSTANCE_USER}@$FLOATING_IP echo success ; do sleep 1; done"; then
+ echo "server didn't become ssh-able!"
+ exit 1
+ fi
+}
# Restore xtrace
$XTRACE
diff --git a/lib/ceilometer b/lib/ceilometer
index 7154ccb..b0f0377 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -8,7 +8,6 @@
# - functions
# - OS_USERNAME, OS_PASSWORD, OS_TENANT_NAME, OS_AUTH_URL set for admin credentials
# - DEST set to the destination directory
-# - NOVA_CONF set to the nova configuration file
# stack.sh
# ---------
@@ -36,15 +35,13 @@
CEILOMETER_BIN_DIR=/usr/local/bin
fi
CEILOMETER_CONF_DIR=/etc/ceilometer
-CEILOMETER_AGENT_CONF=$CEILOMETER_CONF_DIR/ceilometer-agent.conf
-CEILOMETER_COLLECTOR_CONF=$CEILOMETER_CONF_DIR/ceilometer-collector.conf
+CEILOMETER_CONF=$CEILOMETER_CONF_DIR/ceilometer.conf
CEILOMETER_API_LOG_DIR=/var/log/ceilometer-api
# cleanup_ceilometer() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_ceilometer() {
- # This function intentionally left blank
- :
+ mongo ceilometer --eval "db.dropDatabase();"
}
# configure_ceilometer() - Set config files, create data dirs, etc
@@ -57,13 +54,15 @@
[ ! -d $CEILOMETER_API_LOG_DIR ] && sudo mkdir -m 755 -p $CEILOMETER_API_LOG_DIR
sudo chown $USER $CEILOMETER_API_LOG_DIR
- # ceilometer confs are copy of /etc/nova/nova.conf which must exist first
- grep -v format_string $NOVA_CONF > $CEILOMETER_AGENT_CONF
- iniset $CEILOMETER_AGENT_CONF DEFAULT rpc_backend 'ceilometer.openstack.common.rpc.impl_kombu'
+ iniset $CEILOMETER_CONF DEFAULT rpc_backend 'ceilometer.openstack.common.rpc.impl_kombu'
+ iniset $CEILOMETER_CONF DEFAULT notification_topics 'notifications,glance_notifications'
+ iniset $CEILOMETER_CONF DEFAULT verbose True
+ iniset $CEILOMETER_CONF DEFAULT rabbit_host $RABBIT_HOST
+ iniset $CEILOMETER_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
+ iniset $CEILOMETER_CONF DEFAULT sql_connection $BASE_SQL_CONN/nova?charset=utf8
- grep -v format_string $NOVA_CONF > $CEILOMETER_COLLECTOR_CONF
- iniset $CEILOMETER_COLLECTOR_CONF DEFAULT rpc_backend 'ceilometer.openstack.common.rpc.impl_kombu'
- iniset $CEILOMETER_COLLECTOR_CONF DEFAULT notification_topics 'notifications,glance_notifications'
+ iniset $CEILOMETER_CONF keystone_authtoken auth_protocol http
+ cleanup_ceilometer
}
# install_ceilometer() - Collect source and prepare
@@ -73,10 +72,10 @@
# start_ceilometer() - Start running processes, including screen
function start_ceilometer() {
- screen_it ceilometer-acompute "cd $CEILOMETER_DIR && sg libvirtd \"$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_AGENT_CONF\""
- screen_it ceilometer-acentral "export OS_USERNAME=$OS_USERNAME OS_PASSWORD=$OS_PASSWORD OS_TENANT_NAME=$OS_TENANT_NAME OS_AUTH_URL=$OS_AUTH_URL && cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_AGENT_CONF"
- screen_it ceilometer-collector "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-collector --config-file $CEILOMETER_COLLECTOR_CONF"
- screen_it ceilometer-api "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-api -d -v --log-dir=$CEILOMETER_API_LOG_DIR"
+ screen_it ceilometer-acompute "cd $CEILOMETER_DIR && sg libvirtd \"$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF\""
+ screen_it ceilometer-acentral "export OS_USERNAME=$OS_USERNAME OS_PASSWORD=$OS_PASSWORD OS_TENANT_NAME=$OS_TENANT_NAME OS_AUTH_URL=$OS_AUTH_URL && cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_CONF"
+ screen_it ceilometer-collector "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-collector --config-file $CEILOMETER_CONF"
+ screen_it ceilometer-api "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-api -d -v --log-dir=$CEILOMETER_API_LOG_DIR --config-file $CEILOMETER_CONF"
}
# stop_ceilometer() - Stop running processes
diff --git a/lib/keystone b/lib/keystone
index 06920f8..73d82c5 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -47,6 +47,7 @@
KEYSTONE_SERVICE_HOST=${KEYSTONE_SERVICE_HOST:-$SERVICE_HOST}
KEYSTONE_SERVICE_PORT=${KEYSTONE_SERVICE_PORT:-5000}
KEYSTONE_SERVICE_PROTOCOL=${KEYSTONE_SERVICE_PROTOCOL:-http}
+KEYSTONE_TOKEN_FORMAT=${KEYSTONE_TOKEN_FORMAT:-PKI}
# Entry Points
@@ -82,6 +83,7 @@
# Rewrite stock ``keystone.conf``
iniset $KEYSTONE_CONF DEFAULT admin_token "$SERVICE_TOKEN"
+ iniset $KEYSTONE_CONF signing token_format "$KEYSTONE_TOKEN_FORMAT"
iniset $KEYSTONE_CONF sql connection "$BASE_SQL_CONN/keystone?charset=utf8"
iniset $KEYSTONE_CONF ec2 driver "keystone.contrib.ec2.backends.sql.Ec2"
sed -e "
diff --git a/lib/nova b/lib/nova
index c005c29..95d5d87 100644
--- a/lib/nova
+++ b/lib/nova
@@ -316,6 +316,7 @@
fi
if [ -n "$NOVA_STATE_PATH" ]; then
add_nova_opt "state_path=$NOVA_STATE_PATH"
+ add_nova_opt "lock_path=$NOVA_STATE_PATH"
fi
if [ -n "$NOVA_INSTANCES_PATH" ]; then
add_nova_opt "instances_path=$NOVA_INSTANCES_PATH"
@@ -340,6 +341,13 @@
# Show user_name and project_name instead of user_id and project_id
add_nova_opt "logging_context_format_string=%(asctime)s %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
fi
+ if is_service_enabled ceilometer; then
+ add_nova_opt "instance_usage_audit=True"
+ add_nova_opt "instance_usage_audit_period=hour"
+ add_nova_opt "notification_driver=nova.openstack.common.notifier.rabbit_notifier"
+ add_nova_opt "notification_driver=ceilometer.compute.nova_notifier"
+ fi
+
# Provide some transition from ``EXTRA_FLAGS`` to ``EXTRA_OPTS``
if [[ -z "$EXTRA_OPTS" && -n "$EXTRA_FLAGS" ]]; then
diff --git a/lib/quantum b/lib/quantum
index 0b26622..f9e1782 100644
--- a/lib/quantum
+++ b/lib/quantum
@@ -50,7 +50,7 @@
}
function is_quantum_ovs_base_plugin() {
- local plguin=$1
+ local plugin=$1
if [[ ",openvswitch,ryu," =~ ,${plugin}, ]]; then
return 0
fi
diff --git a/openrc b/openrc
index 08ef98b..0a6a215 100644
--- a/openrc
+++ b/openrc
@@ -72,3 +72,6 @@
# set log level to DEBUG (helps debug issues)
# export KEYSTONECLIENT_DEBUG=1
# export NOVACLIENT_DEBUG=1
+
+# set qunatum debug command
+export TEST_CONFIG_FILE=/etc/quantum/debug.ini
diff --git a/stack.sh b/stack.sh
index 90e612c..7272ec0 100755
--- a/stack.sh
+++ b/stack.sh
@@ -503,7 +503,7 @@
# Set ``SWIFT_DATA_DIR`` to the location of swift drives and objects.
# Default is the common DevStack data directory.
-SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DEST}/data/swift}
+SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DATA_DIR}/swift}
# Set ``SWIFT_CONFIG_DIR`` to the location of the configuration files.
# Default is ``/etc/swift``.
@@ -1039,6 +1039,11 @@
SCREEN_HARDSTATUS='%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})'
fi
+# Clear screen rc file
+SCREENRC=$TOP_DIR/$SCREEN_NAME-screenrc
+if [[ -e $SCREENRC ]]; then
+ echo -n > $SCREENRC
+fi
# Create a new named screen to run processes in
screen -d -m -S $SCREEN_NAME -t shell -s /bin/bash
sleep 1
@@ -1266,8 +1271,10 @@
Q_PLUGIN_CONF_FILENAME=ryu.ini
Q_DB_NAME="ovs_quantum"
Q_PLUGIN_CLASS="quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2"
- else
- echo "Unknown Quantum plugin '$Q_PLUGIN'.. exiting"
+ fi
+
+ if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then
+ echo "Quantum plugin not set.. exiting"
exit 1
fi
@@ -1439,6 +1446,7 @@
# Set debug
iniset $Q_DHCP_CONF_FILE DEFAULT debug True
iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
+ iniset $Q_DHCP_CONF_FILE DEFAULT state_path $DATA_DIR/quantum
quantum_setup_keystone $Q_DHCP_CONF_FILE DEFAULT set_auth_url
@@ -1943,14 +1951,14 @@
# Create a small network
# Since quantum command is executed in admin context at this point,
# ``--tenant_id`` needs to be specified.
- NET_ID=$(quantum net-create --tenant_id $TENANT_ID net1 | grep ' id ' | get_field 2)
+ NET_ID=$(quantum net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
if is_service_enabled q-l3; then
# Create a router, and add the private subnet as one of its interfaces
ROUTER_ID=$(quantum router-create --tenant_id $TENANT_ID router1 | grep ' id ' | get_field 2)
quantum router-interface-add $ROUTER_ID $SUBNET_ID
# Create an external network, and a subnet. Configure the external network as router gw
- EXT_NET_ID=$(quantum net-create ext_net -- --router:external=True | grep ' id ' | get_field 2)
+ EXT_NET_ID=$(quantum net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2)
EXT_GW_IP=$(quantum subnet-create --ip_version 4 $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2)
quantum router-gateway-set $ROUTER_ID $EXT_NET_ID
if is_quantum_ovs_base_plugin "$Q_PLUGIN" && [[ "$Q_USE_NAMESPACE" = "True" ]]; then
@@ -1968,10 +1976,10 @@
elif is_service_enabled mysql && is_service_enabled nova; then
# Create a small network
- $NOVA_BIN_DIR/nova-manage network create private $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS
+ $NOVA_BIN_DIR/nova-manage network create "$PRIVATE_NETWORK_NAME" $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS
# Create some floating ips
- $NOVA_BIN_DIR/nova-manage floating create $FLOATING_RANGE
+ $NOVA_BIN_DIR/nova-manage floating create $FLOATING_RANGE --pool=$PUBLIC_NETWORK
# Create a second pool
$NOVA_BIN_DIR/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL
diff --git a/stackrc b/stackrc
index f9a41bd..e587efa 100644
--- a/stackrc
+++ b/stackrc
@@ -136,10 +136,10 @@
#IMAGE_URLS="http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img" # cirros full disk image
# Set default image based on ``VIRT_DRIVER`` and ``LIBVIRT_TYPE``, either of
-# which may be set in ``localrc``. Also allow ``DEFAULT_IMAGE_NAME`` and
+# which may be set in ``localrc``. Also allow ``DEFAULT_IMAGE_NAME`` and
# ``IMAGE_URLS`` to be set directly in ``localrc``.
case "$VIRT_DRIVER" in
- openvz)
+ openvz)
DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ubuntu-11.10-x86_64}
IMAGE_URLS=${IMAGE_URLS:-"http://download.openvz.org/template/precreated/ubuntu-11.10-x86_64.tar.gz"};;
libvirt)
@@ -159,3 +159,6 @@
# 5Gb default volume backing file size
VOLUME_BACKING_FILE_SIZE=${VOLUME_BACKING_FILE_SIZE:-5130M}
+
+PRIVATE_NETWORK_NAME=${PRIVATE_NETWORK_NAME:-"private"}
+PUBLIC_NETWORK_NAME=${PUBLIC_NETWORK_NAME:-"nova"}