Handle the hardcoded configuration values

This patch allows to customize the hardcoded configuration values,
as well as introduce new configuration options for nova services
by configmap template

Change-Id: I1f81b5dfbe927f9019afb1e236abbc9bd3b0d6de
Related-Prod: PROD-29040
(cherry picked from commit 6af347b16f08da9446ca702bc29b71ee192e1e03)
diff --git a/README.rst b/README.rst
index fc58787..52dc8d3 100644
--- a/README.rst
+++ b/README.rst
@@ -1308,6 +1308,29 @@
        connection_debug: 10
        pool_timeout: 120
 
+Change default resource quotas using configmap template settings
+========
+
+.. code-block:: yaml
+
+    nova:
+      controller:
+        configmap:
+          quota:
+            instances: 10
+            cores: 20
+            ram: 51200
+            metadata_items: 128
+            injected_files: 5
+            injected_file_content_bytes: 10240
+            injected_file_path_length: 255
+            key_pairs: 100
+            server_groups: 10
+            server_group_members: 10
+            reservation_expire: 86400
+            until_refresh: 0
+            max_age: 0
+
 Upgrades
 ========
 
diff --git a/nova/files/ocata/nova-compute.conf.Debian b/nova/files/ocata/nova-compute.conf.Debian
index 95a7cc6..67c8230 100644
--- a/nova/files/ocata/nova-compute.conf.Debian
+++ b/nova/files/ocata/nova-compute.conf.Debian
@@ -11052,3 +11052,8 @@
 # Maximum value: 65535
 # Deprecated group/name - [DEFAULT]/console_xvp_multiplex_port
 #console_xvp_multiplex_port=5900
+
+{%- if compute.configmap is defined %}
+{%- set _data = compute.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/nova/files/ocata/nova-controller.conf.Debian b/nova/files/ocata/nova-controller.conf.Debian
index 6aa1a49..afb8d02 100644
--- a/nova/files/ocata/nova-controller.conf.Debian
+++ b/nova/files/ocata/nova-controller.conf.Debian
@@ -11022,3 +11022,8 @@
 # Maximum value: 65535
 # Deprecated group/name - [DEFAULT]/console_xvp_multiplex_port
 #console_xvp_multiplex_port=5900
+
+{%- if controller.configmap is defined %}
+{%- set _data = controller.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/nova/files/pike/nova-compute.conf.Debian b/nova/files/pike/nova-compute.conf.Debian
index d02d9f3..545065e 100644
--- a/nova/files/pike/nova-compute.conf.Debian
+++ b/nova/files/pike/nova-compute.conf.Debian
@@ -10991,3 +10991,8 @@
 # Maximum value: 65535
 # Deprecated group/name - [DEFAULT]/console_xvp_multiplex_port
 #console_xvp_multiplex_port=5900
+
+{%- if compute.configmap is defined %}
+{%- set _data = compute.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/nova/files/pike/nova-controller.conf.Debian b/nova/files/pike/nova-controller.conf.Debian
index 89c3030..dd40014 100644
--- a/nova/files/pike/nova-controller.conf.Debian
+++ b/nova/files/pike/nova-controller.conf.Debian
@@ -10971,3 +10971,8 @@
 # Maximum value: 65535
 # Deprecated group/name - [DEFAULT]/console_xvp_multiplex_port
 #console_xvp_multiplex_port=5900
+
+{%- if controller.configmap is defined %}
+{%- set _data = controller.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/nova/files/queens/nova-compute.conf.Debian b/nova/files/queens/nova-compute.conf.Debian
index 4b85864..b10f77b 100644
--- a/nova/files/queens/nova-compute.conf.Debian
+++ b/nova/files/queens/nova-compute.conf.Debian
@@ -10843,3 +10843,7 @@
 {%- include "oslo_templates/files/queens/keystonemiddleware/_auth_token.conf" %}
 {%- include "oslo_templates/files/queens/keystoneauth/_type_" + auth_type + ".conf" %}
 
+{%- if compute.configmap is defined %}
+{%- set _data = compute.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/nova/files/queens/nova-controller.conf.Debian b/nova/files/queens/nova-controller.conf.Debian
index 621120d..3ab4b82 100644
--- a/nova/files/queens/nova-controller.conf.Debian
+++ b/nova/files/queens/nova-controller.conf.Debian
@@ -10559,3 +10559,8 @@
 {%- endif %}
 {%- include "oslo_templates/files/queens/keystonemiddleware/_auth_token.conf" %}
 {%- include "oslo_templates/files/queens/keystoneauth/_type_" + auth_type + ".conf" %}
+
+{%- if controller.configmap is defined %}
+{%- set _data = controller.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/tests/pillar/control_cluster.sls b/tests/pillar/control_cluster.sls
index fdfd590..6abc08f 100644
--- a/tests/pillar/control_cluster.sls
+++ b/tests/pillar/control_cluster.sls
@@ -96,6 +96,21 @@
     consoleauth:
       token_ttl: 600
     reclaim_instance_interval: 60
+    configmap:
+      quota:
+        instances: 10
+        cores: 20
+        ram: 51200
+        metadata_items: 128
+        injected_files: 5
+        injected_file_content_bytes: 10240
+        injected_file_path_length: 255
+        key_pairs: 100
+        server_groups: 10
+        server_group_members: 10
+        reservation_expire: 86400
+        until_refresh: 0
+        max_age: 0
 apache:
   server:
     enabled: true