Add logrotate meta configuration for Nova and libvirt

	- parametrize interval and rotate

PROD: PROD-29848

Change-Id: Icfbf7461618dfdb5360a45fa80a190817022fe5f
(cherry picked from commit f35495f72e2346f2de7964a44b79e28cbdb95316)
diff --git a/nova/meta/logrotate.yml b/nova/meta/logrotate.yml
new file mode 100644
index 0000000..27012bd
--- /dev/null
+++ b/nova/meta/logrotate.yml
@@ -0,0 +1,78 @@
+## Default: Daily rotation with 28 rotations kept
+{%- from "nova/map.jinja" import controller, compute with context %}
+
+{%- if controller.get('enabled', False) %}
+  {%- set log_interval = controller.get('logrotate', {}).get('interval', 'daily') %}
+  {%- set log_rotation = controller.get('logrotate', {}).get('rotate', 28) %}
+{%- elif compute.get('enabled', False) %}
+  {%- set log_interval = compute.get('logrotate', {}).get('interval', 'daily') %}
+  {%- set log_rotation = compute.get('logrotate', {}).get('rotate', 28) %}
+{%- endif %}
+
+{%- if controller.get('enabled', False) or compute.get('enabled', False) %}
+job:
+  nova-common:
+    - files:
+        - /var/log/nova/*.log
+      options:
+        - {{ log_interval }}
+        - rotate: {{ log_rotation }}
+        - missingok
+        - compress
+        - delaycompress
+        - copytruncate
+        - notifempty
+{%- endif %}
+{%- if compute.get('enabled', False) and compute.get('compute_driver', 'libvirt.LibvirtDriver') == 'libvirt.LibvirtDriver' %}
+  libvirtd:
+    - files:
+        - /var/log/libvirt/libvirtd.log
+      options:
+        - {{ compute.get('libvirt', {}).get('logrotate', {}).get('interval', 'weekly') }}
+        - rotate: {{ compute.get('libvirt', {}).get('logrotate', {}).get('rotate', 4) }}
+        - missingok
+        - compress
+        - delaycompress
+        - copytruncate
+        - minsize: 100k
+  libvirtd.libxl:
+    - files:
+        - /var/log/libvirt/libxl/*.log
+      options:
+        - {{ compute.get('libvirt', {}).get('logrotate', {}).get('interval', 'weekly') }}
+        - rotate: {{ compute.get('libvirt', {}).get('logrotate', {}).get('rotate', 4) }}
+        - missingok
+        - compress
+        - delaycompress
+        - copytruncate
+  libvirtd.lxc:
+    - files:
+        - /var/log/libvirt/lxc/*.log
+      options:
+        - {{ compute.get('libvirt', {}).get('logrotate', {}).get('interval', 'weekly') }}
+        - rotate: {{ compute.get('libvirt', {}).get('logrotate', {}).get('rotate', 4) }}
+        - missingok
+        - compress
+        - delaycompress
+        - copytruncate
+  libvirtd.qemu:
+    - files:
+        - /var/log/libvirt/qemu/*.log
+      options:
+        - {{ compute.get('libvirt', {}).get('logrotate', {}).get('interval', 'weekly') }}
+        - rotate: {{ compute.get('libvirt', {}).get('logrotate', {}).get('rotate', 4) }}
+        - missingok
+        - compress
+        - delaycompress
+        - copytruncate
+  libvirtd.uml:
+    - files:
+        - /var/log/libvirt/uml/*.log
+      options:
+        - {{ compute.get('libvirt', {}).get('logrotate', {}).get('interval', 'weekly') }}
+        - rotate: {{ compute.get('libvirt', {}).get('logrotate', {}).get('rotate', 4) }}
+        - missingok
+        - compress
+        - delaycompress
+        - copytruncate
+{%- endif %}