From f65664ff56de26b6e98ffcf09001427e5a8bdaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Jeanneret?= <cjeanner@redhat.com> Date: Tue, 6 Nov 2018 18:51:43 +0100 Subject: [PATCH] Ensure directories managed by libvirt-daemon exist The /var/run/libvirt directory is managed by libvirt-daemon. As this service is now running within a container, the directory might not exists on a fresh install. This patch also takes care of the fact the /var/run directory is cleaned upon reboot, and uses systemd-tmpfiles in order to ensure the directory creation during the boot process. We also take care of missing log directories, also managed by the libvirt-daemon package. Change-Id: I6f8dc49ff556215a25e8bb23ae8da63ce607d70c Closes-Bug: #1801977 --- docker/services/nova-libvirt.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker/services/nova-libvirt.yaml b/docker/services/nova-libvirt.yaml index cd4a1dc71b..10aee6a3e8 100644 --- a/docker/services/nova-libvirt.yaml +++ b/docker/services/nova-libvirt.yaml @@ -311,7 +311,7 @@ outputs: - /run:/run - /sys/fs/cgroup:/sys/fs/cgroup - /var/lib/nova:/var/lib/nova:shared,z - - /var/run/libvirt:/var/run/libvirt + - /var/run/libvirt:/var/run/libvirt:shared,z - /var/lib/libvirt:/var/lib/libvirt - /etc/libvirt/qemu:/etc/libvirt/qemu:ro - /var/log/libvirt/qemu:/var/log/libvirt/qemu @@ -427,6 +427,9 @@ outputs: - { 'path': /var/lib/libvirt, 'setype': svirt_sandbox_file_t } - { 'path': /var/lib/nova, 'setype': svirt_sandbox_file_t } - { 'path': /var/log/containers/libvirt, 'setype': svirt_sandbox_file_t } + - { 'path': /var/run/libvirt, 'setype': virt_var_run_t } + - { 'path': /var/log/libvirt, 'setype': svirt_sandbox_file_t } + - { 'path': /var/log/libvirt/qemu, 'setype': svirt_sandbox_file_t } # qemu user on host will be cretaed by libvirt package install, ensure # the qemu user created with same uid/gid as like libvirt package. # These specific values are required since ovs is running on host. @@ -471,6 +474,11 @@ outputs: - libvirtd.service - virtlogd.socket when: libvirt_installed.rc == 0 + - name: ensure /var/run/libvirt is present upon reboot + copy: + dest: /etc/tmpfiles.d/var-run-libvirt.conf + content: | + d /var/run/libvirt 0755 root root - - metadata_settings: get_attr: [NovaLibvirtBase, role_data, metadata_settings] upgrade_tasks: