Merge "Unhardcode nova database connection parameters" into release/2019.2.0
diff --git a/metadata/service/compute/cluster.yml b/metadata/service/compute/cluster.yml
index 9e6e485..8934022 100644
--- a/metadata/service/compute/cluster.yml
+++ b/metadata/service/compute/cluster.yml
@@ -64,6 +64,13 @@
         port: 9696
       cache:
         engine: memcached
+        # NOTE (dukov) Do not change this unless you 100% sure what you are doing
+        expiration_time: 600
+        backend_argument:
+          # NOTE (dukov) WARNING! This parameter depends on expiration_time.
+          # Value of 'memcached_expire_time' must be bigger than 'expiration_time'
+          memcached_expire_time:
+            value: 660
         members:
         - host: ${_param:cluster_node01_address}
           port: 11211
diff --git a/metadata/service/compute/kvm.yml b/metadata/service/compute/kvm.yml
index 0a1925b..4174b56 100644
--- a/metadata/service/compute/kvm.yml
+++ b/metadata/service/compute/kvm.yml
@@ -61,6 +61,13 @@
         port: 9696
       cache:
         engine: memcached
+        # NOTE (dukov) Do not change this unless you 100% sure what you are doing
+        expiration_time: 600
+        backend_argument:
+          # NOTE (dukov) WARNING! This parameter depends on expiration_time.
+          # Value of 'memcached_expire_time' must be bigger than 'expiration_time'
+          memcached_expire_time:
+            value: 660
         members:
         - host: ${_param:cluster_node01_address}
           port: 11211
diff --git a/metadata/service/control/cluster.yml b/metadata/service/control/cluster.yml
index 2e17d93..fa271ff 100644
--- a/metadata/service/control/cluster.yml
+++ b/metadata/service/control/cluster.yml
@@ -73,6 +73,13 @@
         password: metadataPass
       cache:
         engine: memcached
+        # NOTE (dukov) Do not change this unless you 100% sure what you are doing
+        expiration_time: 600
+        backend_argument:
+          # NOTE (dukov) WARNING! This parameter depends on expiration_time.
+          # Value of 'memcached_expire_time' must be bigger than 'expiration_time'
+          memcached_expire_time:
+            value: 660
         members:
         - host: ${_param:cluster_node01_address}
           port: 11211
diff --git a/metadata/service/control/single.yml b/metadata/service/control/single.yml
index c525974..5030462 100644
--- a/metadata/service/control/single.yml
+++ b/metadata/service/control/single.yml
@@ -74,6 +74,13 @@
         password: ${_param:metadata_password}
       cache:
         engine: memcached
+        # NOTE (dukov) Do not change this unless you 100% sure what you are doing
+        expiration_time: 600
+        backend_argument:
+          # NOTE (dukov) WARNING! This parameter depends on expiration_time.
+          # Value of 'memcached_expire_time' must be bigger than 'expiration_time'
+          memcached_expire_time:
+            value: 660
         members:
         - host: ${_param:single_address}
           port: 11211
diff --git a/nova/controller.sls b/nova/controller.sls
index 2b0a669..013f40d 100644
--- a/nova/controller.sls
+++ b/nova/controller.sls
@@ -428,8 +428,9 @@
     - sls: nova.db.offline_sync
 
 nova_controller_map_instances:
-  novang.map_instances:
+  novav21.instances_mapped_to_cell:
   - name: 'cell1'
+  - timeout: {{ controller.get('mapped_instances_interval', 60) }}
   {%- if grains.get('noservices') %}
   - onlyif: /bin/false
   {%- endif %}
diff --git a/nova/files/queens/nova-compute.conf.Debian b/nova/files/queens/nova-compute.conf.Debian
index 1298a84..4b85864 100644
--- a/nova/files/queens/nova-compute.conf.Debian
+++ b/nova/files/queens/nova-compute.conf.Debian
@@ -3735,97 +3735,11 @@
 
 [cache]
 
-#
-# From nova.conf
-#
 {%- if compute.cache is defined %}
-backend = oslo_cache.memcache_pool
-enabled = true
-memcache_servers={%- for member in compute.cache.members %}{{ member.host }}:11211{% if not loop.last %},{% endif %}{%- endfor %}
+{%- set _data = compute.cache %}
+{%- include "oslo_templates/files/queens/oslo/_cache.conf" %}
 {%- endif %}
 
-# Prefix for building the configuration dictionary for the cache
-# region. This should not need to be changed unless there is another
-# dogpile.cache region with the same configuration name. (string
-# value)
-#config_prefix = cache.oslo
-
-# Default TTL, in seconds, for any cached item in the dogpile.cache
-# region. This applies to any cached method that doesn't have an
-# explicit cache expiration time defined for it. (integer value)
-#expiration_time = 600
-
-# Cache backend module. For eventlet-based or environments with
-# hundreds of threaded servers, Memcache with pooling
-# (oslo_cache.memcache_pool) is recommended. For environments with
-# less than 100 threaded servers, Memcached (dogpile.cache.memcached)
-# or Redis (dogpile.cache.redis) is recommended. Test environments
-# with a single instance of the server can use the
-# dogpile.cache.memory backend. (string value)
-# Possible values:
-# oslo_cache.memcache_pool - <No description provided>
-# oslo_cache.dict - <No description provided>
-# oslo_cache.mongo - <No description provided>
-# oslo_cache.etcd3gw - <No description provided>
-# dogpile.cache.memcached - <No description provided>
-# dogpile.cache.pylibmc - <No description provided>
-# dogpile.cache.bmemcached - <No description provided>
-# dogpile.cache.dbm - <No description provided>
-# dogpile.cache.redis - <No description provided>
-# dogpile.cache.memory - <No description provided>
-# dogpile.cache.memory_pickle - <No description provided>
-# dogpile.cache.null - <No description provided>
-#backend = dogpile.cache.null
-
-# Arguments supplied to the backend module. Specify this option once
-# per argument to be passed to the dogpile.cache backend. Example
-# format: "<argname>:<value>". (multi valued)
-#backend_argument =
-
-# Proxy classes to import that will affect the way the dogpile.cache
-# backend functions. See the dogpile.cache documentation on changing-
-# backend-behavior. (list value)
-#proxies =
-
-# Global toggle for caching. (boolean value)
-#enabled = false
-
-# Extra debugging from the cache backend (cache keys,
-# get/set/delete/etc calls). This is only really useful if you need to
-# see the specific cache-backend get/set/delete calls with the
-# keys/values.  Typically this should be left set to false. (boolean
-# value)
-#debug_cache_backend = false
-
-# Memcache servers in the format of "host:port".
-# (dogpile.cache.memcache and oslo_cache.memcache_pool backends only).
-# (list value)
-#memcache_servers = localhost:11211
-
-# Number of seconds memcached server is considered dead before it is
-# tried again. (dogpile.cache.memcache and oslo_cache.memcache_pool
-# backends only). (integer value)
-#memcache_dead_retry = 300
-
-# Timeout in seconds for every call to a server.
-# (dogpile.cache.memcache and oslo_cache.memcache_pool backends only).
-# (integer value)
-#memcache_socket_timeout = 3
-
-# Max total number of open connections to every memcached server.
-# (oslo_cache.memcache_pool backend only). (integer value)
-#memcache_pool_maxsize = 10
-
-# Number of seconds a connection to memcached is held unused in the
-# pool before it is closed. (oslo_cache.memcache_pool backend only).
-# (integer value)
-#memcache_pool_unused_timeout = 60
-
-# Number of seconds that an operation will wait to get a memcache
-# client connection. (integer value)
-#memcache_pool_connection_get_timeout = 10
-
-
 [cells]
 #
 # DEPRECATED: Cells options allow you to use cells v1 functionality in
diff --git a/nova/files/queens/nova-controller.conf.Debian b/nova/files/queens/nova-controller.conf.Debian
index 0a2758f..621120d 100644
--- a/nova/files/queens/nova-controller.conf.Debian
+++ b/nova/files/queens/nova-controller.conf.Debian
@@ -3733,96 +3733,11 @@
 
 [cache]
 
-#
-# From nova.conf
-#
 {%- if controller.cache is defined %}
-backend = oslo_cache.memcache_pool
-enabled = true
-memcache_servers={%- for member in controller.cache.members %}{{ member.host }}:11211{% if not loop.last %},{% endif %}{%- endfor %}
+{%- set _data = controller.cache %}
+{%- include "oslo_templates/files/queens/oslo/_cache.conf" %}
 {%- endif %}
 
-# Prefix for building the configuration dictionary for the cache
-# region. This should not need to be changed unless there is another
-# dogpile.cache region with the same configuration name. (string
-# value)
-#config_prefix = cache.oslo
-
-# Default TTL, in seconds, for any cached item in the dogpile.cache
-# region. This applies to any cached method that doesn't have an
-# explicit cache expiration time defined for it. (integer value)
-#expiration_time = 600
-
-# Cache backend module. For eventlet-based or environments with
-# hundreds of threaded servers, Memcache with pooling
-# (oslo_cache.memcache_pool) is recommended. For environments with
-# less than 100 threaded servers, Memcached (dogpile.cache.memcached)
-# or Redis (dogpile.cache.redis) is recommended. Test environments
-# with a single instance of the server can use the
-# dogpile.cache.memory backend. (string value)
-# Possible values:
-# oslo_cache.memcache_pool - <No description provided>
-# oslo_cache.dict - <No description provided>
-# oslo_cache.mongo - <No description provided>
-# oslo_cache.etcd3gw - <No description provided>
-# dogpile.cache.memcached - <No description provided>
-# dogpile.cache.pylibmc - <No description provided>
-# dogpile.cache.bmemcached - <No description provided>
-# dogpile.cache.dbm - <No description provided>
-# dogpile.cache.redis - <No description provided>
-# dogpile.cache.memory - <No description provided>
-# dogpile.cache.memory_pickle - <No description provided>
-# dogpile.cache.null - <No description provided>
-#backend = dogpile.cache.null
-
-# Arguments supplied to the backend module. Specify this option once
-# per argument to be passed to the dogpile.cache backend. Example
-# format: "<argname>:<value>". (multi valued)
-#backend_argument =
-
-# Proxy classes to import that will affect the way the dogpile.cache
-# backend functions. See the dogpile.cache documentation on changing-
-# backend-behavior. (list value)
-#proxies =
-
-# Global toggle for caching. (boolean value)
-#enabled = false
-
-# Extra debugging from the cache backend (cache keys,
-# get/set/delete/etc calls). This is only really useful if you need to
-# see the specific cache-backend get/set/delete calls with the
-# keys/values.  Typically this should be left set to false. (boolean
-# value)
-#debug_cache_backend = false
-
-# Memcache servers in the format of "host:port".
-# (dogpile.cache.memcache and oslo_cache.memcache_pool backends only).
-# (list value)
-#memcache_servers = localhost:11211
-
-# Number of seconds memcached server is considered dead before it is
-# tried again. (dogpile.cache.memcache and oslo_cache.memcache_pool
-# backends only). (integer value)
-#memcache_dead_retry = 300
-
-# Timeout in seconds for every call to a server.
-# (dogpile.cache.memcache and oslo_cache.memcache_pool backends only).
-# (integer value)
-#memcache_socket_timeout = 3
-
-# Max total number of open connections to every memcached server.
-# (oslo_cache.memcache_pool backend only). (integer value)
-#memcache_pool_maxsize = 10
-
-# Number of seconds a connection to memcached is held unused in the
-# pool before it is closed. (oslo_cache.memcache_pool backend only).
-# (integer value)
-#memcache_pool_unused_timeout = 60
-
-# Number of seconds that an operation will wait to get a memcache
-# client connection. (integer value)
-#memcache_pool_connection_get_timeout = 10
-
 
 [cells]
 #
diff --git a/tests/pillar/compute_cluster.sls b/tests/pillar/compute_cluster.sls
index e6124f2..6d38a36 100644
--- a/tests/pillar/compute_cluster.sls
+++ b/tests/pillar/compute_cluster.sls
@@ -70,6 +70,10 @@
       password: metadata
     cache:
       engine: memcached
+      expiration_time: 600
+      backend_argument:
+        memcached_expire_time:
+          value: 660
       members:
       - host: 127.0.0.1
         port: 11211
diff --git a/tests/pillar/compute_cluster_vmware.sls b/tests/pillar/compute_cluster_vmware.sls
index 27de501..4e57b01 100644
--- a/tests/pillar/compute_cluster_vmware.sls
+++ b/tests/pillar/compute_cluster_vmware.sls
@@ -63,6 +63,10 @@
       password: metadata
     cache:
       engine: memcached
+      expiration_time: 600
+      backend_argument:
+        memcached_expire_time:
+          value: 660
       members:
       - host: 127.0.0.1
         port: 11211
diff --git a/tests/pillar/compute_cluster_vmware_queens.sls b/tests/pillar/compute_cluster_vmware_queens.sls
index b704198..006dc1a 100644
--- a/tests/pillar/compute_cluster_vmware_queens.sls
+++ b/tests/pillar/compute_cluster_vmware_queens.sls
@@ -56,6 +56,10 @@
       password: metadata
     cache:
       engine: memcached
+      expiration_time: 600
+      backend_argument:
+        memcached_expire_time:
+          value: 660
       members:
       - host: 127.0.0.1
         port: 11211
diff --git a/tests/pillar/compute_single.sls b/tests/pillar/compute_single.sls
index 99e4aff..b8754f6 100644
--- a/tests/pillar/compute_single.sls
+++ b/tests/pillar/compute_single.sls
@@ -60,6 +60,10 @@
       password: password
     cache:
       engine: memcached
+      expiration_time: 600
+      backend_argument:
+        memcached_expire_time:
+          value: 660
       members:
       - host: 127.0.0.1
         port: 11211
diff --git a/tests/pillar/compute_single_config_drive_options.sls b/tests/pillar/compute_single_config_drive_options.sls
index 739f876..b64ea64 100644
--- a/tests/pillar/compute_single_config_drive_options.sls
+++ b/tests/pillar/compute_single_config_drive_options.sls
@@ -55,6 +55,10 @@
       password: password
     cache:
       engine: memcached
+      expiration_time: 600
+      backend_argument:
+        memcached_expire_time:
+          value: 660
       members:
       - host: 127.0.0.1
         port: 11211
diff --git a/tests/pillar/control_single.sls b/tests/pillar/control_single.sls
index 9423b53..f6b51cb 100644
--- a/tests/pillar/control_single.sls
+++ b/tests/pillar/control_single.sls
@@ -84,6 +84,10 @@
       password: password
     cache:
       engine: memcached
+      expiration_time: 600
+      backend_argument:
+        memcached_expire_time:
+          value: 660
       members:
       - host: 127.0.0.1
         port: 11211
diff --git a/tests/pillar/repo_mcp_openstack_queens.sls b/tests/pillar/repo_mcp_openstack_queens.sls
new file mode 100644
index 0000000..65fb320
--- /dev/null
+++ b/tests/pillar/repo_mcp_openstack_queens.sls
@@ -0,0 +1,12 @@
+linux:
+  system:
+    enabled: true
+    repo:
+      mirantis_openstack_repo:
+        source: "deb http://mirror.mirantis.com/nightly/openstack-queens/{{ grains.get('oscodename') }} {{ grains.get('oscodename') }} main"
+        architectures: amd64
+        key_url: "http://mirror.mirantis.com/nightly/openstack-queens/{{ grains.get('oscodename') }}/archive-queens.key"
+        pin:
+        - pin: 'release l=queens'
+          priority: 1050
+          package: '*'