Merge "Manage /etc/default/qemu-kvm file via template" into release/2019.2.0
diff --git a/nova/controller.sls b/nova/controller.sls
index 013f40d..bf758bb 100644
--- a/nova/controller.sls
+++ b/nova/controller.sls
@@ -281,10 +281,10 @@
 {% endfor %}
 {% endif %}
 
-{% if controller.get('policy', {}) and controller.version not in ['liberty', 'mitaka', 'newton'] %}
+{%- if controller.version not in ['liberty', 'mitaka', 'newton'] %}
 {# nova no longer ships with a default policy.json #}
-
-/etc/nova/policy.json:
+{#- Since Queens release `policy.json` is changed to `policy.yaml`. But default option in `oslo_policy` is `policy.json` #}
+/etc/nova/{{ controller.get('oslo_policy', {}).get('policy_file', 'policy.json') }}:
   file.managed:
     - contents: '{}'
     - replace: False
@@ -292,33 +292,32 @@
     - group: nova
     - require:
       - pkg: nova_controller_packages
-
-{% endif %}
+{%- endif %}
 
 {%- for name, rule in controller.get('policy', {}).iteritems() %}
 
 {%- if rule != None %}
 nova_keystone_rule_{{ name }}_present:
   keystone_policy.rule_present:
-  - path: /etc/nova/policy.json
+  - path: /etc/nova/{{ controller.get('oslo_policy', {}).get('policy_file', 'policy.json') }}
   - name: {{ name }}
   - rule: {{ rule }}
   - require:
     - pkg: nova_controller_packages
     {% if controller.version not in ['liberty', 'mitaka', 'newton'] %}
-    - file: /etc/nova/policy.json
+    - file: /etc/nova/{{ controller.get('oslo_policy', {}).get('policy_file', 'policy.json') }}
     {% endif%}
 
 {%- else %}
 
 nova_keystone_rule_{{ name }}_absent:
   keystone_policy.rule_absent:
-  - path: /etc/nova/policy.json
+  - path: /etc/nova/{{ controller.get('oslo_policy', {}).get('policy_file', 'policy.json') }}
   - name: {{ name }}
   - require:
     - pkg: nova_controller_packages
     {% if controller.version not in ['liberty', 'mitaka', 'newton'] %}
-    - file: /etc/nova/policy.json
+    - file: /etc/nova/{{ controller.get('oslo_policy', {}).get('policy_file', 'policy.json') }}
     {% endif%}
 
 {%- endif %}
diff --git a/nova/files/queens/nova-compute.conf.Debian b/nova/files/queens/nova-compute.conf.Debian
index eda3c78..874500d 100644
--- a/nova/files/queens/nova-compute.conf.Debian
+++ b/nova/files/queens/nova-compute.conf.Debian
@@ -10859,8 +10859,8 @@
 {%- endif %}
 
 [oslo_policy]
-{%- if compute.policy is defined %}
-{%- set _data = compute.policy %}
+{%- if compute.oslo_policy is defined %}
+{%- set _data = compute.oslo_policy %}
 {%- include "oslo_templates/files/queens/oslo/_policy.conf" %}
 {%- endif %}
 
diff --git a/nova/files/queens/nova-controller.conf.Debian b/nova/files/queens/nova-controller.conf.Debian
index 0ed6fd3..317b610 100644
--- a/nova/files/queens/nova-controller.conf.Debian
+++ b/nova/files/queens/nova-controller.conf.Debian
@@ -10592,8 +10592,8 @@
 {%- endif %}
 
 [oslo_policy]
-{%- if controller.policy is defined %}
-{%- set _data = controller.policy %}
+{%- if controller.oslo_policy is defined %}
+{%- set _data = controller.oslo_policy %}
 {%- include "oslo_templates/files/queens/oslo/_policy.conf" %}
 {%- endif %}
 
diff --git a/nova/map.jinja b/nova/map.jinja
index cd59c5b..921535e 100644
--- a/nova/map.jinja
+++ b/nova/map.jinja
@@ -43,6 +43,9 @@
         'debug': false,
         'notification': false,
         'cors': {},
+        'oslo_policy': {
+          'policy_file': 'policy.json'
+        },
         'audit': {
           'enabled': false
         },
@@ -79,6 +82,9 @@
         'debug': false,
         'notification': false,
         'cors': {},
+        'oslo_policy': {
+          'policy_file': 'policy.json'
+        },
         'audit': {
           'enabled': false
         },