Register cinder when using sql keystone catalog.

* Fixes bug #1020735

Change-Id: Ibd954cdda3c855800ae1080950c62dd71b094a01
diff --git a/files/keystone_data.sh b/files/keystone_data.sh
index 7886072..ba14a47 100755
--- a/files/keystone_data.sh
+++ b/files/keystone_data.sh
@@ -283,4 +283,16 @@
     keystone user-role-add --tenant_id $SERVICE_TENANT \
                            --user_id $CINDER_USER \
                            --role_id $ADMIN_ROLE
+    if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
+        CINDER_SERVICE=$(get_id keystone service-create \
+            --name=cinder \
+            --type=volume \
+            --description="Cinder Service")
+        keystone endpoint-create \
+            --region RegionOne \
+            --service_id $CINDER_SERVICE \
+            --publicurl "http://$SERVICE_HOST:8776/v1/\$(tenant_id)s" \
+            --adminurl "http://$SERVICE_HOST:8776/v1/\$(tenant_id)s" \
+            --internalurl "http://$SERVICE_HOST:8776/v1/\$(tenant_id)s"
+    fi
 fi