Merge "ceilometer: build the configuration file from scratch"
diff --git a/lib/nova b/lib/nova
index dbfc294..95d5d87 100644
--- a/lib/nova
+++ b/lib/nova
@@ -12,6 +12,7 @@
 #
 # install_nova
 # configure_nova
+# create_nova_conf
 # init_nova
 # start_nova
 # stop_nova
@@ -274,8 +275,8 @@
     fi
 }
 
-# init_nova() - Initialize databases, etc.
-function init_nova() {
+# create_nova_conf() - Create a new nova.conf file
+function create_nova_conf() {
     # Remove legacy ``nova.conf``
     rm -f $NOVA_DIR/bin/nova.conf
 
@@ -299,7 +300,6 @@
     add_nova_opt "libvirt_type=$LIBVIRT_TYPE"
     add_nova_opt "libvirt_cpu_mode=none"
     add_nova_opt "instance_name_template=${INSTANCE_NAME_PREFIX}%08x"
-    add_nova_opt "image_service=nova.image.glance.GlanceImageService"
 
     if is_service_enabled n-api; then
         add_nova_opt "enabled_apis=$NOVA_ENABLED_APIS"
@@ -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
@@ -352,7 +360,10 @@
         # Attempt to convert flags to options
         add_nova_opt ${I//--}
     done
+}
 
+# init_nova() - Initialize databases, etc.
+function init_nova() {
     # Nova Database
     # -------------
 
diff --git a/stack.sh b/stack.sh
index 3fc3204..e58c439 100755
--- a/stack.sh
+++ b/stack.sh
@@ -97,7 +97,7 @@
 
 # Warn users who aren't on an explicitly supported distro, but allow them to
 # override check and attempt installation with ``FORCE=yes ./stack``
-if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|f16|f17) ]]; then
+if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|raring|f16|f17) ]]; then
     echo "WARNING: this script has not been tested on $DISTRO"
     if [[ "$FORCE" != "yes" ]]; then
         echo "If you wish to run this script anyway run with FORCE=yes"
@@ -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``.
@@ -1439,6 +1439,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
 
@@ -1792,6 +1793,8 @@
 
 if is_service_enabled nova; then
     echo_summary "Configuring Nova"
+    # Rebuild the config file from scratch
+    create_nova_conf
     init_nova
 fi