Merge "Added volume usage collection, when cinder_ceilometer_enabled"

This commit is contained in:
Zuul 2018-10-08 16:26:56 +00:00 committed by Gerrit Code Review
commit 50f45e87a2
2 changed files with 26 additions and 0 deletions

View File

@ -58,6 +58,10 @@ cinder_barbican_enabled: False
# Enable/Disable Ceilometer
cinder_ceilometer_enabled: False
# Time period for which to generate volume usages. The options are hour, day,
# month, or year. (string value)
cinder_volume_usage_audit: hour
cinder_storage_availability_zone: nova
cinder_default_availability_zone: "{{ cinder_storage_availability_zone }}"

View File

@ -72,6 +72,28 @@
tags:
- cinder-config
- name: Run the systemd service role
include_role:
name: systemd_service
private: true
vars:
systemd_service_enabled: "{{ ((cinder_services['cinder-volume']['group'] in group_names) and (cinder_ceilometer_enabled | bool)) | ternary(true, false) }}"
systemd_service_restart_changed: false
systemd_user_name: "{{ cinder_system_user_name }}"
systemd_group_name: "{{ cinder_system_group_name }}"
systemd_services:
- service_name: "cinder-volume-usage-audit"
execstarts:
- '/bin/bash -c "{{ cinder_bin }}/cinder-volume-usage-audit --start_time \"$$(date\s+%%Y-%%m-%%d\\\s%%H:00:00\s-d\s-1{{ cinder_volume_usage_audit }})\" --end_time \"$$(date\s+%%Y-%%m-%%d\\\s%%H:00:00)\" --send_actions"'
timer:
state: "{{ ((cinder_services['cinder-volume']['group'] in group_names) and (cinder_ceilometer_enabled | bool)) | ternary('started', 'stopped') }}"
options:
OnBootSec: 30min
OnCalendar: "{{ (cinder_volume_usage_audit == 'day') | ternary('daily', cinder_volume_usage_audit+'ly') }}"
Persistent: true
tags:
- cinder-config
- import_tasks: mq_setup.yml
when:
- "cinder_services['cinder-api']['group'] in group_names"