diff options
| author | Michael Still <mikal@stillhq.com> | 2026-06-12 07:12:09 +1000 |
|---|---|---|
| committer | Michael Still <mikal@stillhq.com> | 2026-06-12 07:12:09 +1000 |
| commit | 97d1352f225509bcb5e3e25013e9bfe1f3c995f0 (patch) | |
| tree | 61df48b373316ad9e69cd362ba92ddd9cd1d8061 /docker/nova | |
| parent | 7477b2244ee525ffd6effeb4229608991c639fc8 (diff) | |
| download | kolla-97d1352f225509bcb5e3e25013e9bfe1f3c995f0.tar.gz kolla-97d1352f225509bcb5e3e25013e9bfe1f3c995f0.zip | |
Install and start virtlogd in nova-libvirt.
Due to implementation choices in qemu and libvirt, standard log
rotate does not work on these console files, and instead the usual
approach is to have libvirt's virtlogd rotate the contents of the
console log file when it gets a bit big. OpenStack Compute knows
how to read data from more than one rotated console log file if
required to service a REST API request.
OpenStack Kolla and Kolla-Ansible deploy OpenStack components in
docker or podman containers. An error in the startup configuration
for the nova_libvirt container results in the libvirt virtlogd
daemon not being run, which results in this console log rotation
not occurring.
This opens up the risk of a disk usage denial of service attack
on a hypervisor. The console log is stored on the same filesystem
as ephemeral disks, and OpenStack Nova will take a hypervisor out
of service if disk space becomes constrained. There is some
protection from the instance console not being able to write data
particularly quickly, but it is definitely still possible to fill
the hypervisor file system -- especially if multiple instances are used.
This misconfiguration appears to exist in all versions of
Kolla / Kolla-Ansible as best as I can tell.
Partial-Bug: 2155214
Change-Id: Ib62191e3022e5bcff781c12f662c9800fb210eb9
Signed-off-by: Michael Still <mikal@stillhq.com>
Diffstat (limited to 'docker/nova')
| -rw-r--r-- | docker/nova/nova-libvirt/Dockerfile.j2 | 5 | ||||
| -rw-r--r-- | docker/nova/nova-libvirt/kolla_nova_libvirt_start.sh | 12 |
2 files changed, 16 insertions, 1 deletions
diff --git a/docker/nova/nova-libvirt/Dockerfile.j2 b/docker/nova/nova-libvirt/Dockerfile.j2 index 88e4a52d6..b866917ea 100644 --- a/docker/nova/nova-libvirt/Dockerfile.j2 +++ b/docker/nova/nova-libvirt/Dockerfile.j2 @@ -20,6 +20,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build 'libguestfs', 'libvirt-client', 'libvirt-daemon', + 'libvirt-daemon-log', 'libvirt-daemon-config-nwfilter', 'libvirt-daemon-driver-nwfilter', 'libvirt-daemon-driver-nodedev', @@ -75,6 +76,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% if base_distro in ['debian'] %} {% set nova_libvirt_packages = nova_libvirt_packages + [ + 'libvirt-daemon-log', 'usermode' ] %} {% endif %} @@ -89,7 +91,8 @@ RUN rm -f /etc/libvirt/qemu/networks/default.xml /etc/libvirt/qemu/networks/auto {% endif %} COPY extend_start.sh /usr/local/bin/kolla_extend_start -RUN chmod 644 /usr/local/bin/kolla_extend_start +COPY kolla_nova_libvirt_start.sh /usr/local/bin/kolla_nova_libvirt_start +RUN chmod 644 /usr/local/bin/kolla_extend_start && chmod 744 /usr/local/bin/kolla_nova_libvirt_start {{ macros.kolla_patch_sources() }} diff --git a/docker/nova/nova-libvirt/kolla_nova_libvirt_start.sh b/docker/nova/nova-libvirt/kolla_nova_libvirt_start.sh new file mode 100644 index 000000000..f06a63d9e --- /dev/null +++ b/docker/nova/nova-libvirt/kolla_nova_libvirt_start.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -euo pipefail + +# NOTE(mikal): Start virtlogd as a sidecar. We need this for +# nova instance console logs to rotate. Otherwise they will +# consume unbounded amounts of disk. +# +# No exec here: libvirtd will be the "main" process. +/usr/sbin/virtlogd & + +# Now hand over PID 1's direct child role to libvirtd. +exec /usr/sbin/libvirtd --listen |
