Merge "Add Marconi to Tempest config"
diff --git a/.gitignore b/.gitignore
index c49b4a3..4365202 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,5 @@
 devstack-docs-*
 docs/
 docs-files
+.localrc.auto
+local.conf
diff --git a/files/default_catalog.templates b/files/default_catalog.templates
index 277904a..e64f68f 100644
--- a/files/default_catalog.templates
+++ b/files/default_catalog.templates
@@ -47,7 +47,17 @@
 catalog.RegionOne.image.internalURL = http://%SERVICE_HOST%:9292
 catalog.RegionOne.image.name = Image Service
 
-catalog.RegionOne.orchestration.publicURL = http://%SERVICE_HOST%:8000/v1
-catalog.RegionOne.orchestration.adminURL = http://%SERVICE_HOST%:8000/v1
-catalog.RegionOne.orchestration.internalURL = http://%SERVICE_HOST%:8000/v1
+catalog.RegionOne.cloudformation.publicURL = http://%SERVICE_HOST%:8000/v1
+catalog.RegionOne.cloudformation.adminURL = http://%SERVICE_HOST%:8000/v1
+catalog.RegionOne.cloudformation.internalURL = http://%SERVICE_HOST%:8000/v1
+catalog.RegionOne.cloudformation.name = Heat CloudFormation Service
+
+catalog.RegionOne.orchestration.publicURL = http://%SERVICE_HOST%:8004/v1/$(tenant_id)s
+catalog.RegionOne.orchestration.adminURL = http://%SERVICE_HOST%:8004/v1/$(tenant_id)s
+catalog.RegionOne.orchestration.internalURL = http://%SERVICE_HOST%:8004/v1/$(tenant_id)s
 catalog.RegionOne.orchestration.name = Heat Service
+
+catalog.RegionOne.metering.publicURL = http://%SERVICE_HOST%:8777/v1
+catalog.RegionOne.metering.adminURL = http://%SERVICE_HOST%:8777/v1
+catalog.RegionOne.metering.internalURL = http://%SERVICE_HOST%:8777/v1
+catalog.RegionOne.metering.name = Telemetry Service
diff --git a/lib/ceilometer b/lib/ceilometer
index 211303f..75058c0 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -48,8 +48,50 @@
 # Set up database backend
 CEILOMETER_BACKEND=${CEILOMETER_BACKEND:-mysql}
 
+# Ceilometer connection info.
+CEILOMETER_SERVICE_PROTOCOL=http
+CEILOMETER_SERVICE_HOST=$SERVICE_HOST
+CEILOMETER_SERVICE_PORT=${CEILOMETER_SERVICE_PORT:-8777}
+#
+
 # Functions
 # ---------
+#
+# create_ceilometer_accounts() - Set up common required ceilometer accounts
+
+create_ceilometer_accounts() {
+
+    SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
+    ADMIN_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }")
+
+    # Ceilometer
+    if [[ "$ENABLED_SERVICES" =~ "ceilometer-api" ]]; then
+        CEILOMETER_USER=$(keystone user-create \
+            --name=ceilometer \
+            --pass="$SERVICE_PASSWORD" \
+            --tenant_id $SERVICE_TENANT \
+            --email=ceilometer@example.com \
+            | grep " id " | get_field 2)
+        keystone user-role-add \
+            --tenant-id $SERVICE_TENANT \
+            --user-id $CEILOMETER_USER \
+            --role-id $ADMIN_ROLE
+        if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
+            CEILOMETER_SERVICE=$(keystone service-create \
+                --name=ceilometer \
+                --type=metering \
+                --description="OpenStack Telemetry Service" \
+                | grep " id " | get_field 2)
+            keystone endpoint-create \
+                --region RegionOne \
+                --service_id $CEILOMETER_SERVICE \
+                --publicurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/" \
+                --adminurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/" \
+                --internalurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/"
+        fi
+    fi
+}
+
 
 # cleanup_ceilometer() - Remove residual data files, anything left over from previous
 # runs that a clean run would need to clean up
diff --git a/lib/cinder b/lib/cinder
index 111b974..5397308 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -390,7 +390,7 @@
                 --adminurl "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(tenant_id)s" \
                 --internalurl "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(tenant_id)s"
             CINDER_V2_SERVICE=$(keystone service-create \
-                --name=cinder \
+                --name=cinderv2 \
                 --type=volumev2 \
                 --description="Cinder Volume Service V2" \
                 | grep " id " | get_field 2)
diff --git a/lib/nova b/lib/nova
index 4eb56b8..a508789 100644
--- a/lib/nova
+++ b/lib/nova
@@ -338,7 +338,7 @@
                 --adminurl "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2/\$(tenant_id)s" \
                 --internalurl "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2/\$(tenant_id)s"
             NOVA_V3_SERVICE=$(keystone service-create \
-                --name=nova \
+                --name=novav3 \
                 --type=computev3 \
                 --description="Nova Compute Service V3" \
                 | grep " id " | get_field 2)
@@ -649,6 +649,14 @@
     fi
 
     if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
+        # Enable client side traces for libvirt
+        export LIBVIRT_LOG_FILTERS="1:libvirt"
+        export LIBVIRT_LOG_OUTPUTS="1:file:/var/log/libvirt/libvirtd-nova.log"
+
+        # Enable server side traces for libvirtd
+        echo "log_filters=\"1:libvirt 1:qemu\"" | sudo tee -a /etc/libvirt/libvirtd.conf
+        echo "log_outputs=\"1:file:/var/log/libvirt/libvirtd.log\"" | sudo tee -a /etc/libvirt/libvirtd.conf
+
         # The group **$LIBVIRT_GROUP** is added to the current user in this script.
         # Use 'sg' to execute nova-compute as a member of the **$LIBVIRT_GROUP** group.
         screen_it n-cpu "cd $NOVA_DIR && sg $LIBVIRT_GROUP '$NOVA_BIN_DIR/nova-compute --config-file $compute_cell_conf'"
diff --git a/stack.sh b/stack.sh
index c303dc3..7da41a9 100755
--- a/stack.sh
+++ b/stack.sh
@@ -901,6 +901,10 @@
         create_trove_accounts
     fi
 
+    if is_service_enabled ceilometer; then
+        create_ceilometer_accounts
+    fi
+
     if is_service_enabled swift || is_service_enabled s-proxy; then
         create_swift_accounts
     fi