Ability to set lock_path

PROD-34037

Change-Id: I9589d06dff5634afe08402576ecf27573310ee7b
diff --git a/README.rst b/README.rst
index 7991408..5871722 100644
--- a/README.rst
+++ b/README.rst
@@ -13,6 +13,8 @@
 
     manila:
       common:
+        concurrency:
+          lock_path: '/var/lock/manila'
         database:
           engine: mysql
           host: 10.20.0.101
@@ -173,8 +175,6 @@
           share_name_template: share-%s
           rootwrap_config: '/etc/manila/rootwrap.conf'
           api_paste_config: '/etc/manila/api-paste.ini'
-        oslo_concurrency:
-          lock_path: '/var/lock/manila'
 
 Don't manage services scheduling while upgrade
 ----------------------------------------------
diff --git a/manila/_common.sls b/manila/_common.sls
index e17f472..9bf2f9d 100644
--- a/manila/_common.sls
+++ b/manila/_common.sls
@@ -24,3 +24,15 @@
     - sls: manila._ssl.rabbitmq
   - require_in:
     - sls: manila.db.offline_sync
+
+{%- if cfg.get('concurrency', {}).lock_path is defined %}
+manila_lock_path_{{ cfg.concurrency.lock_path }}:
+  file.directory:
+  - name: {{ cfg.concurrency.lock_path }}
+  - user: manila
+  - group: manila
+  - mode: 750
+  - makedirs: True
+  - require:
+    - pkg: manila_common.pkgs
+{%- endif %}
diff --git a/manila/client.sls b/manila/client.sls
index 85f9b82..c6b7950 100644
--- a/manila/client.sls
+++ b/manila/client.sls
@@ -6,7 +6,7 @@
     - names: {{ client.pkgs }}
     - install_recommends: False
 
-{%- for identity_name, identity in client.server.iteritems() %}
+{%- for identity_name, identity in client.get('server', {}).iteritems() %}
 {%- if identity.share_type is defined %}
 {%- for share_type_name, share_type in identity.share_type.iteritems() %}
 
diff --git a/manila/files/pike/manila.conf b/manila/files/pike/manila.conf
index edf5387..32240f9 100644
--- a/manila/files/pike/manila.conf
+++ b/manila/files/pike/manila.conf
@@ -95,6 +95,8 @@
 {%- if _message_queue.ssl is defined and 'cacert_file' not in _message_queue.get('ssl', {}).keys() %}{% do _message_queue['ssl'].update({'cacert_file': cfg.cacert_file}) %}{% endif %}
 {% include "manila/files/"+ cfg.version +"/_oslo_messaging_rabbit.conf" %}
 
+[oslo_concurrency]
+lock_path = {{ cfg.get('concurrency', {}).get('lock_path', '/var/lock/manila') }}
 
 [keystone_authtoken]
 {%- set _service_catalog = cfg.get('identity', {}) %}
diff --git a/manila/upgrade/render_config.sls b/manila/upgrade/render_config.sls
index 88daeba..bfedc53 100644
--- a/manila/upgrade/render_config.sls
+++ b/manila/upgrade/render_config.sls
@@ -11,4 +11,14 @@
   - template: jinja
   - mode: 0640
   - group: manila
+
+{%- if cfg.get('concurrency', {}).lock_path is defined %}
+manila_upgrade_lock_path_{{ cfg.concurrency.lock_path }}:
+  file.directory:
+  - name: {{ cfg.concurrency.lock_path }}
+  - user: manila
+  - group: manila
+  - mode: 750
+  - makedirs: True
+{%- endif %}
 {%- endif %}
diff --git a/metadata/service/common/cluster.yml b/metadata/service/common/cluster.yml
index 0f4a72a..9788b2a 100644
--- a/metadata/service/common/cluster.yml
+++ b/metadata/service/common/cluster.yml
@@ -8,6 +8,8 @@
   manila:
     common:
       version: ${_param:openstack_version}
+      concurrency:
+        lock_path: '/var/lock/manila'
       message_queue:
         engine: rabbitmq
         port: 5672
diff --git a/metadata/service/common/single.yml b/metadata/service/common/single.yml
index a329043..3b84df7 100644
--- a/metadata/service/common/single.yml
+++ b/metadata/service/common/single.yml
@@ -8,6 +8,8 @@
   manila:
     common:
       version: ${_param:openstack_version}
+      concurrency:
+        lock_path: '/var/lock/manila'
       message_queue:
         engine: rabbitmq
         port: 5672
diff --git a/tests/pillar/server_cluster.sls b/tests/pillar/server_cluster.sls
index 3905557..ea7a92f 100644
--- a/tests/pillar/server_cluster.sls
+++ b/tests/pillar/server_cluster.sls
@@ -1,4 +1,7 @@
 manila:
+  common:
+    concurrency:
+      lock_path: '/var/lock/manila'
   api:
     region: RegionOne
     enabled: true
@@ -53,8 +56,6 @@
           share_name_template: share-%s
           rootwrap_config: '/etc/manila/rootwrap.conf'
           api_paste_config: '/etc/manila/api-paste.ini'
-        oslo_concurrency:
-          lock_path: '/var/lock/manila'
 apache:
   server:
     enabled: true