[ansible] Use collectd_config for virt and rdt 67/72667/12
authorEmma Foley <efoley@redhat.com>
Thu, 10 Jun 2021 11:04:23 +0000 (12:04 +0100)
committerEmma Foley <efoley@redhat.com>
Thu, 26 Aug 2021 20:05:50 +0000 (21:05 +0100)
Only one of virt and intel_rdt can be enabled at a time, and the
existing checks are based on the existance of a {rdt,virt}.conf file to
determine whether the other plugin is enabled.
This check needed updating, and is now based on whether the other plugin
is in the collectd_plugins value.

Signed-off-by: Emma Foley <efoley@redhat.com>
Change-Id: I175d60111bf133965e1ecbf3764cb12a25356576

docker/ansible/roles/config_files/tasks/rdt.yml
docker/ansible/roles/config_files/tasks/virt.yml
docker/ansible/roles/config_files/templates/rdt.conf.j2 [deleted file]
docker/ansible/roles/config_files/templates/virt.conf.j2 [deleted file]
docker/ansible/roles/config_files/vars/main.yml

index bad67b7..f0a4626 100644 (file)
@@ -1,4 +1,4 @@
-#Copyright 2018 OPNFV and Intel Corporation
+# Copyright 2018-21 Anuket, Intel Corporation and others
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -29,9 +29,8 @@
     - rdt
 
 - name: enable rdt plugin
-  template:
-    src: rdt.conf.j2
-    dest: "{{ config_file_dir }}/rdt.conf"
+  set_fact:
+    collectd_plugins: "{{ collectd_plugins | union(['intel_rdt']) | unique }}"
   when: (rdt_result is succeeded) and (virt_file.stat.exists == False)
   tags:
     - rdt
index 7fb0bb9..75a17a1 100644 (file)
@@ -1,4 +1,4 @@
-#Copyright 2018 OPNFV and Intel Corporation
+# Copyright 2018-21 Anuket, Intel Corporation and others
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
    - virt
 
 - name: (virt) check if rdt  is enabled
-  stat:
-      path: "{{ config_file_dir }}/rdt.conf"
-  register: rdt_file
+  set_fact:
+    rdt_enabled: true
   tags:
-    - virt
+    - rdt
 
 - name: enable virt plugin
-  template:
-    src: virt.conf.j2
-    dest: "{{ config_file_dir }}/virt.conf"
-  when: libvirt_result is succeeded and rdt_file.stat.exists == False
+  set_fact:
+    collectd_plugins: "{{ collectd_plugins | union(['virt']) | unique }}"
+  when: libvirt_result is succeeded and not (rdt_enabled | default(false))
   tags:
    - virt
diff --git a/docker/ansible/roles/config_files/templates/rdt.conf.j2 b/docker/ansible/roles/config_files/templates/rdt.conf.j2
deleted file mode 100644 (file)
index 0e1afcf..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#Copyright 2018 OPNFV and Intel Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-<LoadPlugin intel_rdt>
-  Interval {{ rdt_interval }}
-</LoadPlugin>
-
-<Plugin intel_rdt>
-  Cores ""
-</Plugin>
-
diff --git a/docker/ansible/roles/config_files/templates/virt.conf.j2 b/docker/ansible/roles/config_files/templates/virt.conf.j2
deleted file mode 100644 (file)
index f1ba324..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#Copyright 2018 OPNFV and Intel Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LoadPlugin virt
-
-<Plugin virt>
-# Connection "xen:///"
-  RefreshInterval 60
-# Domain "name"
-# BlockDevice "name:device"
-# BlockDeviceFormat target
-# BlockDeviceFormatBasename false
-# InterfaceDevice "name:device"
-# IgnoreSelected false
-# HostnameFormat name
-# InterfaceFormat name
-# PluginInstanceFormat name
-# Instances 1
-  ExtraStats "cpu_util disk disk_err domain_state fs_info job_stats_background pcpu perf vcpupin"
-</Plugin>
-
index 4e42791..410e24e 100644 (file)
@@ -42,6 +42,9 @@ collectd_plugin_intel_pmu_report_kernel_pmu_events: True
 collectd_plugin_intel_pmu_report_software_events: True
 collectd_plugin_intel_pmu_cores: ["0-4"]
 
+collectd_plugin_intel_rdt_cores: [""]
+collectd_plugin_intel_rdt_interval: "{{ rdt_interval }}"
+
 collectd_plugin_logfile_loglevel: "{{ logfile_log_level }}"
 collectd_plugin_logfile_file: "{{ logfile_dir }}/collectd.log"
 collectd_plugin_logfile_timestamp: True
@@ -49,6 +52,9 @@ collectd_plugin_logfile_timestamp: True
 collectd_plugin_ovs_events_dispatch_values: True
 collectd_plugin_ovs_events_send_notification: True
 
+collectd_plugin_virt_extra_stats: "cpu_util disk disk_err domain_state fs_info job_stats_background pcpu perf vcpupin"
+collectd_plugin_virt_refresh_interval: 60
+
 collectd_plugin_write_kafka_hosts:
   - "{{ kafka_ip_addr }}:{{ kafka_port }}"
 collectd_plugin_write_kafka_topics: '{{ { kafka_topic: { "format": "JSON" }} }}'