Merge "Add logrotate meta configuration for Cinder"
diff --git a/cinder/meta/logrotate.yml b/cinder/meta/logrotate.yml
new file mode 100644
index 0000000..29869e9
--- /dev/null
+++ b/cinder/meta/logrotate.yml
@@ -0,0 +1,25 @@
+## Default: Weekly rotation with 4 rotations kept
+{%- from "cinder/map.jinja" import controller, volume with context %}
+
+{%- if controller.get('enabled', False) %}
+  {%- set log_interval = controller.get('logrotate', {}).get('interval', 'weekly') %}
+  {%- set log_rotation = controller.get('logrotate', {}).get('rotate', 4) %}
+{%- elif volume.get('enabled', False) %}
+  {%- set log_interval = volume.get('logrotate', {}).get('interval', 'weekly') %}
+  {%- set log_rotation = volume.get('logrotate', {}).get('rotate', 4) %}
+{%- endif %}
+
+{%- if controller.get('enabled', False) or volume.get('enabled', False) %}
+job:
+  cinder-common:
+    - files:
+        - /var/log/cinder/*.log
+      options:
+        - {{ log_interval }}
+        - rotate: {{ log_rotation }}
+        - missingok
+        - compress
+        - delaycompress
+        - copytruncate
+        - notifempty
+{%- endif %}