From 55bf29ec6c459dc46cefdee69acb8e427763e409 Mon Sep 17 00:00:00 2001
From: Jeffrey Zhang <zhang.lei.fly@gmail.com>
Date: Tue, 11 Dec 2018 16:01:03 +0800
Subject: [PATCH] Add cache configuration for ceilometer project

when using ceilometer+gnocchi, for every notification sample, ceilometer
will update the resource even if is not updated.

We should add [cache] section to make ceilometer cache the resource, and
stop send the useless update request.

Closes-Bug: #1807841
Change-Id: Ic33b4cd5ba8165c20878cab068f38a3948c9d31d
---
 ansible/roles/ceilometer/templates/ceilometer.conf.j2 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ansible/roles/ceilometer/templates/ceilometer.conf.j2 b/ansible/roles/ceilometer/templates/ceilometer.conf.j2
index a57f874883..d63c4d27f8 100644
--- a/ansible/roles/ceilometer/templates/ceilometer.conf.j2
+++ b/ansible/roles/ceilometer/templates/ceilometer.conf.j2
@@ -47,3 +47,8 @@ connection_url = {{ xenserver_connect_protocol }}://{{ xenserver_himn_ip }}
 connection_username = {{ xenserver_username }}
 connection_password = {{ xenserver_password }}
 {% endif %}
+
+[cache]
+backend = oslo_cache.memcache_pool
+enabled = True
+memcache_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}