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
This commit is contained in:
Cédric Jeanneret 2018-11-06 18:51:43 +01:00
parent 480a2320fd
commit f65664ff56
1 changed files with 9 additions and 1 deletions

View File

@ -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: