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
diff --git a/README.rst b/README.rst
index 27d6dd7..0f6117d 100644
--- a/README.rst
+++ b/README.rst
@@ -1343,6 +1343,29 @@
          username: nova
          password: pswd
 
+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 db98ab3..9f77dc9 100644
--- a/nova/files/ocata/nova-compute.conf.Debian
+++ b/nova/files/ocata/nova-compute.conf.Debian
@@ -11059,3 +11059,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 1b752bf..058174c 100644
--- a/nova/files/ocata/nova-controller.conf.Debian
+++ b/nova/files/ocata/nova-controller.conf.Debian
@@ -11027,3 +11027,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 cacfabb..270510b 100644
--- a/nova/files/pike/nova-compute.conf.Debian
+++ b/nova/files/pike/nova-compute.conf.Debian
@@ -11002,3 +11002,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 5132551..a73630b 100644
--- a/nova/files/pike/nova-controller.conf.Debian
+++ b/nova/files/pike/nova-controller.conf.Debian
@@ -10980,3 +10980,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 fe57510..9bf3ea2 100644
--- a/nova/files/queens/nova-compute.conf.Debian
+++ b/nova/files/queens/nova-compute.conf.Debian
@@ -10857,3 +10857,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 23b22df..402e6ec 100644
--- a/nova/files/queens/nova-controller.conf.Debian
+++ b/nova/files/queens/nova-controller.conf.Debian
@@ -10578,3 +10578,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/nova/files/rocky/nova-compute.conf.Debian b/nova/files/rocky/nova-compute.conf.Debian
index 3ea1db1..6c52ab2 100644
--- a/nova/files/rocky/nova-compute.conf.Debian
+++ b/nova/files/rocky/nova-compute.conf.Debian
@@ -10262,3 +10262,8 @@
 #     will not be deleted when the instance is marked in ERROR state.
 #  (integer value)
 #reachable_timeout = 300
+
+{%- if compute.configmap is defined %}
+{%- set _data = compute.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/nova/files/rocky/nova-controller.conf.Debian b/nova/files/rocky/nova-controller.conf.Debian
index 8eead70..7b7a74c 100644
--- a/nova/files/rocky/nova-controller.conf.Debian
+++ b/nova/files/rocky/nova-controller.conf.Debian
@@ -9975,3 +9975,8 @@
 #     will not be deleted when the instance is marked in ERROR state.
 #  (integer value)
 #reachable_timeout = 300
+
+{%- 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 beccee3..16a9cc2 100644
--- a/tests/pillar/control_cluster.sls
+++ b/tests/pillar/control_cluster.sls
@@ -98,6 +98,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