From 1d55c377b811193e013cc50185edb869a3772bbf Mon Sep 17 00:00:00 2001 From: Steve Lewis Date: Tue, 6 Sep 2016 11:00:28 -0700 Subject: [PATCH] Filter Gnocchi traffic optionally When using Swift storage for Gnocchi we want to add a filter to the Ceilometer middleware for Swift to exclude reporting traffic caused by Gnocchi storing data into Swift to avoid feedback-loops. This is typically done by isolating the Gnocchi in a dedicated Project in Keystone. The best place to filter this traffic is in the middleware as opposed to filtering in the Ceilometer Collector. Related-To: I67b5bff394ad35cf95d10ba32d602954799d7348 Change-Id: If20248494d4e6c127db4ffdf77ae43482f64fe58 --- defaults/main.yml | 3 ++- tasks/swift_service_setup.yml | 28 ++++++++++++++++++++++++++++ templates/proxy-server.conf.j2 | 3 +++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 1a09afe2..600e0573 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,8 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Enable/Disable Ceilometer +# Enable/Disable Telemetry projects swift_ceilometer_enabled: False +swift_gnocchi_enabled: False ## Verbosity Options debug: False diff --git a/tasks/swift_service_setup.yml b/tasks/swift_service_setup.yml index 9ab581cf..ec9f53df 100644 --- a/tasks/swift_service_setup.yml +++ b/tasks/swift_service_setup.yml @@ -168,3 +168,31 @@ until: add_service|success retries: 5 delay: 10 + +# KNOWN ISSUE(stevelle) Never fail. Swift playbook runs before Gnocchi in a +# standard deploy. The project for Gnocchi will not have been created yet. +# There is a known issue in project / user / role lifecycles that causes a +# circular service dependency here. The Swift playbook must be run a second +# time, after the Gnocchi playbook runs, when it uses Swift storage as a +# workaround. +- name: Get Gnocchi project id + keystone: + command: get_project + tenant_name: "{{ gnocchi_service_project_name }}" + endpoint: "{{ keystone_service_adminurl }}" + login_user: "{{ keystone_admin_user_name }}" + login_password: "{{ keystone_auth_admin_password }}" + login_project_name: "{{ keystone_admin_tenant_name }}" + insecure: "{{ keystone_service_adminuri_insecure }}" + register: get_gnocchi_project + failed_when: False + when: + - swift_gnocchi_enabled | bool + - swift_gnocchi_service_project_id is not defined + +- name: Store Gnocchi project id + set_fact: + swift_gnocchi_service_project_id: "{{ keystone_facts.id }}" + when: + - swift_gnocchi_enabled | bool + - get_gnocchi_project | success diff --git a/templates/proxy-server.conf.j2 b/templates/proxy-server.conf.j2 index 747581dc..00cabcce 100644 --- a/templates/proxy-server.conf.j2 +++ b/templates/proxy-server.conf.j2 @@ -189,5 +189,8 @@ control_exchange = swift driver = messagingv2 url = rabbit://{% for host in swift_rabbitmq_telemetry_servers.split(',') %}{{ swift_rabbitmq_telemetry_userid }}:{{ swift_rabbitmq_telemetry_password }}@{{ host }}:{{ swift_rabbitmq_telemetry_port }}{% if not loop.last %},{% else %}/{{ swift_rabbitmq_telemetry_vhost }}{% endif %}{% endfor %} topic = notifications +{% if swift_gnocchi_service_project_id is defined %} +ignore_projects = "{{ swift_gnocchi_service_project_id }}"" +{% endif %} log_level = WARN {% endif %}