Ability to set lock_path

PROD-34037

Change-Id: Ia1f0bb8a8937e85062fcb2236ef0cb7af158ca58
diff --git a/README.rst b/README.rst
index d1702ac..549b68d 100644
--- a/README.rst
+++ b/README.rst
@@ -30,6 +30,8 @@
         workers: 8
         report_interval: 60
         dhcp_domain: novalocal
+        concurrency:
+          lock_path: '/var/lib/nova/tmp'
         consoleauth:
           token_ttl: 600
         bind:
@@ -294,6 +296,8 @@
         resume_guests_state_on_host_boot: False
         preallocate_images: space  # Default is 'none'
         my_ip: 10.1.0.16
+        concurrency:
+          lock_path: '/var/lib/nova/tmp'
         bind:
           vnc_address: 172.20.0.100
           vnc_port: 6080
diff --git a/metadata/service/compute/cluster.yml b/metadata/service/compute/cluster.yml
index 2f081d5..b9bdfd3 100644
--- a/metadata/service/compute/cluster.yml
+++ b/metadata/service/compute/cluster.yml
@@ -14,6 +14,8 @@
       enabled: true
       heal_instance_info_cache_interval: 60
       vncproxy_url: http://${_param:cluster_vip_address}:6080
+      concurrency:
+        lock_path: '/var/lib/nova/tmp'
       bind:
         vnc_address: ${_param:cluster_local_address}
         vnc_port: 6080
diff --git a/metadata/service/compute/ironic.yml b/metadata/service/compute/ironic.yml
index e606370..0612e9f 100644
--- a/metadata/service/compute/ironic.yml
+++ b/metadata/service/compute/ironic.yml
@@ -17,6 +17,8 @@
       force_config_drive: True
       config_drive_format: 'iso9660'
       reserved_host_memory_mb: 0
+      concurrency:
+        lock_path: '/var/lib/nova/tmp'
       database:
         engine: mysql
         host: ${_param:cluster_vip_address}
diff --git a/metadata/service/control/cluster.yml b/metadata/service/control/cluster.yml
index bb4f432..232c7d5 100644
--- a/metadata/service/control/cluster.yml
+++ b/metadata/service/control/cluster.yml
@@ -23,6 +23,8 @@
       ram_allocation_ratio: 1.5
       disk_allocation_ratio: 1.0
       workers: 8
+      concurrency:
+        lock_path: '/var/lib/nova/tmp'
       bind:
         private_address: ${_param:cluster_local_address}
         public_address: ${_param:cluster_vip_address}
diff --git a/metadata/service/control/single.yml b/metadata/service/control/single.yml
index 5178b35..27c2527 100644
--- a/metadata/service/control/single.yml
+++ b/metadata/service/control/single.yml
@@ -23,6 +23,8 @@
       ram_allocation_ratio: 1.5
       disk_allocation_ratio: 1.0
       workers: 1
+      concurrency:
+        lock_path: '/var/lib/nova/tmp'
       bind:
         private_address: ${_param:single_address}
         public_address: ${_param:single_address}
diff --git a/nova/compute.sls b/nova/compute.sls
index a8e60d8..02b045b 100644
--- a/nova/compute.sls
+++ b/nova/compute.sls
@@ -22,6 +22,20 @@
   - require_in:
      - service: nova_compute_services
 
+{%- if compute.get('concurrency', {}).lock_path is defined %}
+nova_compute_lock_path_{{ compute.concurrency.lock_path }}:
+  file.directory:
+  - name: {{ compute.concurrency.lock_path }}
+  - user: nova
+  - group: nova
+  - mode: 750
+  - makedirs: True
+  - require:
+    - pkg: nova_compute_packages
+  - require_in:
+    - service: nova_compute_services
+{%- endif %}
+
 {%- if compute.vm_swappiness is defined %}
 vm.swappiness:
   sysctl.present:
diff --git a/nova/controller.sls b/nova/controller.sls
index bf758bb..f905a6b 100644
--- a/nova/controller.sls
+++ b/nova/controller.sls
@@ -62,6 +62,20 @@
       - user: user_nova
 {%- endif %}
 
+{%- if controller.get('concurrency', {}).lock_path is defined %}
+nova_controller_lock_path_{{ controller.concurrency.lock_path }}:
+  file.directory:
+  - name: {{ controller.concurrency.lock_path }}
+  - user: nova
+  - group: nova
+  - mode: 750
+  - makedirs: True
+  - require:
+    - pkg: nova_controller_packages
+  - require_in:
+    - service: nova_controller_services
+{%- endif %}
+
 # Only for Queens. Communication between noVNC proxy service and QEMU
 {%- if controller.version not in ['mitaka', 'newton', 'ocata', 'pike'] %}
 {%- if controller.novncproxy.vencrypt.tls.get('enabled', False) %}
diff --git a/nova/files/pike/nova-compute.conf.Debian b/nova/files/pike/nova-compute.conf.Debian
index fcc52ab..d4683ca 100644
--- a/nova/files/pike/nova-compute.conf.Debian
+++ b/nova/files/pike/nova-compute.conf.Debian
@@ -7595,7 +7595,7 @@
 # environment, use the Python tempfile.gettempdir function to find a suitable
 # location. If external locks are used, a lock path must be set. (string value)
 # Deprecated group/name - [DEFAULT]/lock_path
-lock_path = /var/lib/nova/tmp
+lock_path = {{ compute.get('concurrency', {}).get('lock_path', '/var/lib/nova/tmp') }}
 
 
 [oslo_messaging_amqp]
diff --git a/nova/files/pike/nova-controller.conf.Debian b/nova/files/pike/nova-controller.conf.Debian
index ddd9db2..eb4ef50 100644
--- a/nova/files/pike/nova-controller.conf.Debian
+++ b/nova/files/pike/nova-controller.conf.Debian
@@ -7563,7 +7563,7 @@
 # environment, use the Python tempfile.gettempdir function to find a suitable
 # location. If external locks are used, a lock path must be set. (string value)
 # Deprecated group/name - [DEFAULT]/lock_path
-lock_path=/var/lib/nova/tmp
+lock_path = {{ controller.get('concurrency', {}).get('lock_path', '/var/lib/nova/tmp') }}
 
 
 [oslo_messaging_amqp]
diff --git a/nova/files/queens/nova-compute.conf.Debian b/nova/files/queens/nova-compute.conf.Debian
index a3a7700..024263b 100644
--- a/nova/files/queens/nova-compute.conf.Debian
+++ b/nova/files/queens/nova-compute.conf.Debian
@@ -10873,6 +10873,12 @@
 {%- set _data = compute %}
 {%- include "oslo_templates/files/queens/oslo/_middleware.conf" %}
 
+[oslo_concurrency]
+{%- if compute.concurrency is defined %}
+{%- set _data = compute.concurrency %}
+{%- include "oslo_templates/files/queens/oslo/_concurrency.conf" %}
+{%- endif %}
+
 [keystone_authtoken]
 {%- set _data = compute.identity %}
 {%- if 'cacert_file' not in _data.keys() %}{% do _data.update({'cacert_file': compute.cacert_file}) %}{% endif %}
diff --git a/nova/files/queens/nova-controller.conf.Debian b/nova/files/queens/nova-controller.conf.Debian
index d9dcf76..24c1404 100644
--- a/nova/files/queens/nova-controller.conf.Debian
+++ b/nova/files/queens/nova-controller.conf.Debian
@@ -10606,6 +10606,12 @@
 {%- set _data = controller %}
 {%- include "oslo_templates/files/queens/oslo/_middleware.conf" %}
 
+[oslo_concurrency]
+{%- if controller.concurrency is defined %}
+{%- set _data = controller.concurrency %}
+{%- include "oslo_templates/files/queens/oslo/_concurrency.conf" %}
+{%- endif %}
+
 [keystone_authtoken]
 {%- set _data = controller.identity %}
 {%- if 'cacert_file' not in _data.keys() %}{% do _data.update({'cacert_file': controller.cacert_file}) %}{% endif %}
diff --git a/nova/upgrade/render_config.sls b/nova/upgrade/render_config.sls
index d963b42..068829b 100644
--- a/nova/upgrade/render_config.sls
+++ b/nova/upgrade/render_config.sls
@@ -23,6 +23,16 @@
   - source: salt://nova/files/{{ _data.version }}/api-paste.ini.{{ grains.os_family }}
   - template: jinja
 
+{%- if _data.get('concurrency', {}).lock_path is defined %}
+nova_upgrade_{{ type }}_lock_path_{{ _data.concurrency.lock_path }}:
+  file.directory:
+  - name: {{ _data.concurrency.lock_path }}
+  - user: nova
+  - group: nova
+  - mode: 750
+  - makedirs: True
+{%- endif %}
+
 {%- if controller.get('enabled', False) %}
 
   {% for service_name in controller.services %}