Merge "Add parametrization default_schedule_zone config option in salt-formula-nova"
diff --git a/README.rst b/README.rst
index 828dd01..81c539d 100644
--- a/README.rst
+++ b/README.rst
@@ -424,6 +424,19 @@
         barbican:
           enabled: true
 
+Nova metadata custom bindings
+
+.. code-block:: yaml
+
+    nova:
+      controller:
+        enabled: true
+        ...
+        metadata:
+          bind:
+            address: 1.2.3.4
+            port: 8776
+
 
 Client role
 -----------
diff --git a/nova/files/ocata/nova-controller.conf.Debian b/nova/files/ocata/nova-controller.conf.Debian
index efabbe6..59c0e5c 100644
--- a/nova/files/ocata/nova-controller.conf.Debian
+++ b/nova/files/ocata/nova-controller.conf.Debian
@@ -2692,7 +2692,7 @@
 # requests.
 #  (string value)
 #metadata_listen=0.0.0.0
-metadata_listen={{ controller.bind.private_address }}
+metadata_listen={{ controller.get('metadata', {}).get('bind', {}).get('address', controller.bind.private_address) }}
 osapi_volume_listen={{ controller.bind.private_address }}
 
 #
@@ -2703,7 +2703,11 @@
 #  (port value)
 # Minimum value: 0
 # Maximum value: 65535
+{%- if controller.get('metadata', {}).get('bind', {}).port is defined %}
+metadata_listen_port={{ controller.metadata.bind.port }}
+{%- else %}
 #metadata_listen_port=8775
+{%- endif %}
 
 #
 # Number of workers for metadata service. If not specified the number of
diff --git a/nova/files/pike/nova-controller.conf.Debian b/nova/files/pike/nova-controller.conf.Debian
index c7d15e7..2a584d7 100644
--- a/nova/files/pike/nova-controller.conf.Debian
+++ b/nova/files/pike/nova-controller.conf.Debian
@@ -2692,7 +2692,7 @@
 # requests.
 #  (string value)
 #metadata_listen=0.0.0.0
-metadata_listen={{ controller.bind.private_address }}
+metadata_listen={{ controller.get('metadata', {}).get('bind', {}).get('address', controller.bind.private_address) }}
 osapi_volume_listen={{ controller.bind.private_address }}
 
 #
@@ -2703,7 +2703,11 @@
 #  (port value)
 # Minimum value: 0
 # Maximum value: 65535
+{%- if controller.get('metadata', {}).get('bind', {}).port is defined %}
+metadata_listen_port={{ controller.metadata.bind.port }}
+{%- else %}
 #metadata_listen_port=8775
+{%- endif %}
 
 #
 # Number of workers for metadata service. If not specified the number of
diff --git a/nova/map.jinja b/nova/map.jinja
index cbae33f..03b509f 100644
--- a/nova/map.jinja
+++ b/nova/map.jinja
@@ -115,7 +115,12 @@
   services:
   - nova-compute
   libvirt_config: libvirtd.conf
+  {# Since Openstack Pike Libvirt 3.6 package is installed, it requires different file name for environment file #}
+  {%- if pillar.nova.compute is defined and pillar.nova.compute.version not in ["juno", "kilo", "liberty", "mitaka", "newton", "ocata"] %}
+  libvirt_bin: "/etc/default/libvirtd"
+  {%- else %}
   libvirt_bin: "/etc/default/libvirt-bin"
+  {%- endif %}
   libvirt_service: libvirt-bin
   bind: compute_bind_defaults
   debug: false