Support for identity version 3
diff --git a/cinder/files/kilo/api-paste.ini.controller.Debian b/cinder/files/kilo/api-paste.ini.controller.Debian
index e5b5444..6ffb02e 100644
--- a/cinder/files/kilo/api-paste.ini.controller.Debian
+++ b/cinder/files/kilo/api-paste.ini.controller.Debian
@@ -59,12 +59,12 @@
 [filter:authtoken]
 paste.filter_factory = keystonemiddleware.auth_token:filter_factory
 service_port=5000
-service_host={{ pillar.cinder.controller.identity.host }}
+service_host={{ controller.identity.host }}
 service_protocol=http
-auth_host = {{ pillar.cinder.controller.identity.host }}
-auth_port = {{ pillar.cinder.controller.identity.port }}
+auth_host = {{ controller.identity.host }}
+auth_port = {{ controller.identity.port }}
 auth_protocol = http
-admin_tenant_name = {{ pillar.cinder.controller.identity.tenant }}
-admin_user = {{ pillar.cinder.controller.identity.user }}
-admin_password = {{ pillar.cinder.controller.identity.password }}
-auth_uri=http://{{ pillar.cinder.controller.identity.host }}:5000/
\ No newline at end of file
+admin_tenant_name = {{ controller.identity.tenant }}
+admin_user = {{ controller.identity.user }}
+admin_password = {{ controller.identity.password }}
+auth_uri=http://{{ controller.identity.host }}:5000/{% if controller.identity.get('version', 2) == 3 %}v3{% endif %}
diff --git a/cinder/files/kilo/api-paste.ini.volume.Debian b/cinder/files/kilo/api-paste.ini.volume.Debian
index a280eb9..0d7ee9f 100644
--- a/cinder/files/kilo/api-paste.ini.volume.Debian
+++ b/cinder/files/kilo/api-paste.ini.volume.Debian
@@ -59,12 +59,12 @@
 [filter:authtoken]
 paste.filter_factory = keystonemiddleware.auth_token:filter_factory
 service_port=5000
-service_host={{ pillar.cinder.volume.identity.host }}
+service_host={{ volume.identity.host }}
 service_protocol=http
-auth_host = {{ pillar.cinder.volume.identity.host }}
-auth_port = {{ pillar.cinder.volume.identity.port }}
+auth_host = {{ volume.identity.host }}
+auth_port = {{ volume.identity.port }}
 auth_protocol = http
-admin_tenant_name = {{ pillar.cinder.volume.identity.tenant }}
-admin_user = {{ pillar.cinder.volume.identity.user }}
-admin_password = {{ pillar.cinder.volume.identity.password }}
-auth_uri=http://{{ pillar.cinder.volume.identity.host }}:5000/
\ No newline at end of file
+admin_tenant_name = {{ volume.identity.tenant }}
+admin_user = {{ volume.identity.user }}
+admin_password = {{ volume.identity.password }}
+auth_uri=http://{{ volume.identity.host }}:5000/{% if volume.identity.get('version', 2) == 3 %}v3{% endif %}
diff --git a/cinder/files/kilo/cinder.conf.controller.Debian b/cinder/files/kilo/cinder.conf.controller.Debian
index 55820a2..120c713 100644
--- a/cinder/files/kilo/cinder.conf.controller.Debian
+++ b/cinder/files/kilo/cinder.conf.controller.Debian
@@ -88,6 +88,8 @@
 rabbit_ha_queues={{ controller.message_queue.ha_queues }}
 kombu_reconnect_delay=5.0
 
+{%- if controller.identity.get('version', 2) == 2 %}
+
 [keystone_authtoken]
 signing_dir=/tmp/keystone-signing-cinder
 admin_password={{ controller.identity.password }}
@@ -99,6 +101,27 @@
 signing_dirname=/tmp/keystone-signing-cinder
 auth_uri=http://{{ controller.identity.host }}:{{ controller.identity.port }}
 
+{%- else %}
+
+[keystone_authtoken]
+signing_dir=/tmp/keystone-signing-cinder
+signing_dirname=/tmp/keystone-signing-cinder
+identity_uri = http://{{ controller.identity.host }}:35357/v3
+revocation_cache_time = 10
+auth_section = generic_password
+
+[generic_password]
+auth_plugin = password
+user_domain_id = {{ controller.identity.get('domain', 'default') }}
+project_domain_id = {{ controller.identity.get('domain', 'default') }}
+project_name = {{ controller.identity.tenant }}
+username = {{ controller.identity.user }}
+password = {{ controller.identity.password }}
+auth_uri=http://{{ controller.identity.host }}:5000/v3
+auth_url=http://{{ controller.identity.host }}:35357/v3
+
+{%- endif %}
+
 [database]
 idle_timeout=3600
 max_pool_size=30
@@ -381,4 +404,4 @@
 
 {%- endif %}
 
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/cinder/files/kilo/cinder.conf.volume.Debian b/cinder/files/kilo/cinder.conf.volume.Debian
index e1706d2..da480c1 100644
--- a/cinder/files/kilo/cinder.conf.volume.Debian
+++ b/cinder/files/kilo/cinder.conf.volume.Debian
@@ -97,6 +97,8 @@
 rabbit_ha_queues={{ volume.message_queue.ha_queues }}
 kombu_reconnect_delay=5.0
 
+{%- if volume.identity.get('version', 2) == 2 %}
+
 [keystone_authtoken]
 signing_dir=/tmp/keystone-signing-cinder
 admin_password={{ volume.identity.password }}
@@ -108,6 +110,27 @@
 signing_dirname=/tmp/keystone-signing-cinder
 auth_uri=http://{{ volume.identity.host }}:{{ volume.identity.port }}
 
+{%- else %}
+
+[keystone_authtoken]
+signing_dir=/tmp/keystone-signing-cinder
+signing_dirname=/tmp/keystone-signing-cinder
+identity_uri = http://{{ volume.identity.host }}:35357/v3
+revocation_cache_time = 10
+auth_section = generic_password
+
+[generic_password]
+auth_plugin = password
+user_domain_id = {{ volume.identity.get('domain', 'default') }}
+project_domain_id = {{ volume.identity.get('domain', 'default') }}
+project_name = {{ volume.identity.tenant }}
+username = {{ volume.identity.user }}
+password = {{ volume.identity.password }}
+auth_uri=http://{{ volume.identity.host }}:5000/v3
+auth_url=http://{{ volume.identity.host }}:35357/v3
+
+{%- endif %}
+
 [database]
 idle_timeout=3600
 max_pool_size=30
@@ -458,4 +481,4 @@
 
 {%- endif %}
 
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/cinder/files/liberty/api-paste.ini.controller.Debian b/cinder/files/liberty/api-paste.ini.controller.Debian
index e5b5444..6ffb02e 100644
--- a/cinder/files/liberty/api-paste.ini.controller.Debian
+++ b/cinder/files/liberty/api-paste.ini.controller.Debian
@@ -59,12 +59,12 @@
 [filter:authtoken]
 paste.filter_factory = keystonemiddleware.auth_token:filter_factory
 service_port=5000
-service_host={{ pillar.cinder.controller.identity.host }}
+service_host={{ controller.identity.host }}
 service_protocol=http
-auth_host = {{ pillar.cinder.controller.identity.host }}
-auth_port = {{ pillar.cinder.controller.identity.port }}
+auth_host = {{ controller.identity.host }}
+auth_port = {{ controller.identity.port }}
 auth_protocol = http
-admin_tenant_name = {{ pillar.cinder.controller.identity.tenant }}
-admin_user = {{ pillar.cinder.controller.identity.user }}
-admin_password = {{ pillar.cinder.controller.identity.password }}
-auth_uri=http://{{ pillar.cinder.controller.identity.host }}:5000/
\ No newline at end of file
+admin_tenant_name = {{ controller.identity.tenant }}
+admin_user = {{ controller.identity.user }}
+admin_password = {{ controller.identity.password }}
+auth_uri=http://{{ controller.identity.host }}:5000/{% if controller.identity.get('version', 2) == 3 %}v3{% endif %}
diff --git a/cinder/files/liberty/api-paste.ini.volume.Debian b/cinder/files/liberty/api-paste.ini.volume.Debian
index a280eb9..0d7ee9f 100644
--- a/cinder/files/liberty/api-paste.ini.volume.Debian
+++ b/cinder/files/liberty/api-paste.ini.volume.Debian
@@ -59,12 +59,12 @@
 [filter:authtoken]
 paste.filter_factory = keystonemiddleware.auth_token:filter_factory
 service_port=5000
-service_host={{ pillar.cinder.volume.identity.host }}
+service_host={{ volume.identity.host }}
 service_protocol=http
-auth_host = {{ pillar.cinder.volume.identity.host }}
-auth_port = {{ pillar.cinder.volume.identity.port }}
+auth_host = {{ volume.identity.host }}
+auth_port = {{ volume.identity.port }}
 auth_protocol = http
-admin_tenant_name = {{ pillar.cinder.volume.identity.tenant }}
-admin_user = {{ pillar.cinder.volume.identity.user }}
-admin_password = {{ pillar.cinder.volume.identity.password }}
-auth_uri=http://{{ pillar.cinder.volume.identity.host }}:5000/
\ No newline at end of file
+admin_tenant_name = {{ volume.identity.tenant }}
+admin_user = {{ volume.identity.user }}
+admin_password = {{ volume.identity.password }}
+auth_uri=http://{{ volume.identity.host }}:5000/{% if volume.identity.get('version', 2) == 3 %}v3{% endif %}
diff --git a/cinder/files/liberty/cinder.conf.controller.Debian b/cinder/files/liberty/cinder.conf.controller.Debian
index ae95e4b..3c12e4b 100644
--- a/cinder/files/liberty/cinder.conf.controller.Debian
+++ b/cinder/files/liberty/cinder.conf.controller.Debian
@@ -88,6 +88,8 @@
 rabbit_ha_queues={{ controller.message_queue.ha_queues }}
 kombu_reconnect_delay=5.0
 
+{%- if controller.identity.get('version', 2) == 2 %}
+
 [keystone_authtoken]
 signing_dir=/tmp/keystone-signing-cinder
 admin_password={{ controller.identity.password }}
@@ -97,9 +99,28 @@
 auth_protocol=http
 admin_user=cinder
 signing_dirname=/tmp/keystone-signing-cinder
-auth_uri=http://{{ controller.identity.host }}:5000
-auth_url = http://{{ controller.identity.host }}:35357
+auth_uri=http://{{ controller.identity.host }}:{{ controller.identity.port }}
+
+{%- else %}
+
+[keystone_authtoken]
+signing_dir=/tmp/keystone-signing-cinder
+signing_dirname=/tmp/keystone-signing-cinder
+identity_uri = http://{{ controller.identity.host }}:35357/v3
+revocation_cache_time = 10
+auth_section = generic_password
+
+[generic_password]
 auth_plugin = password
+user_domain_id = {{ controller.identity.get('domain', 'default') }}
+project_domain_id = {{ controller.identity.get('domain', 'default') }}
+project_name = {{ controller.identity.tenant }}
+username = {{ controller.identity.user }}
+password = {{ controller.identity.password }}
+auth_uri=http://{{ controller.identity.host }}:5000/v3
+auth_url=http://{{ controller.identity.host }}:35357/v3
+
+{%- endif %}
 
 [database]
 idle_timeout=3600
@@ -384,4 +405,4 @@
 
 {%- endif %}
 
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/cinder/files/liberty/cinder.conf.volume.Debian b/cinder/files/liberty/cinder.conf.volume.Debian
index 7869a8e..da480c1 100644
--- a/cinder/files/liberty/cinder.conf.volume.Debian
+++ b/cinder/files/liberty/cinder.conf.volume.Debian
@@ -97,6 +97,8 @@
 rabbit_ha_queues={{ volume.message_queue.ha_queues }}
 kombu_reconnect_delay=5.0
 
+{%- if volume.identity.get('version', 2) == 2 %}
+
 [keystone_authtoken]
 signing_dir=/tmp/keystone-signing-cinder
 admin_password={{ volume.identity.password }}
@@ -106,9 +108,28 @@
 auth_protocol=http
 admin_user=cinder
 signing_dirname=/tmp/keystone-signing-cinder
-auth_uri=http://{{ volume.identity.host }}:5000
-auth_url = http://{{ volume.identity.host }}:35357
+auth_uri=http://{{ volume.identity.host }}:{{ volume.identity.port }}
+
+{%- else %}
+
+[keystone_authtoken]
+signing_dir=/tmp/keystone-signing-cinder
+signing_dirname=/tmp/keystone-signing-cinder
+identity_uri = http://{{ volume.identity.host }}:35357/v3
+revocation_cache_time = 10
+auth_section = generic_password
+
+[generic_password]
 auth_plugin = password
+user_domain_id = {{ volume.identity.get('domain', 'default') }}
+project_domain_id = {{ volume.identity.get('domain', 'default') }}
+project_name = {{ volume.identity.tenant }}
+username = {{ volume.identity.user }}
+password = {{ volume.identity.password }}
+auth_uri=http://{{ volume.identity.host }}:5000/v3
+auth_url=http://{{ volume.identity.host }}:35357/v3
+
+{%- endif %}
 
 [database]
 idle_timeout=3600
@@ -460,4 +481,4 @@
 
 {%- endif %}
 
-{%- endif %}
\ No newline at end of file
+{%- endif %}