diff options
5 files changed, 70 insertions, 2 deletions
diff --git a/ansible/roles/nova-cell/tasks/version-check.yml b/ansible/roles/nova-cell/tasks/version-check.yml index 549cb3334..d217f88ba 100644 --- a/ansible/roles/nova-cell/tasks/version-check.yml +++ b/ansible/roles/nova-cell/tasks/version-check.yml @@ -75,3 +75,47 @@ success_msg: > Libvirt version check successful: target {{ new_version }} >= current {{ current_version }}. when: libvirt_version_current_results is not skipped + +- name: Check nova_libvirt image provides the libvirt start script + when: enable_nova_libvirt_container | bool and (groups[service.group] | length) > 0 + vars: + service_name: "nova-libvirt" + service: "{{ nova_cell_services[service_name] }}" + tags: nova-libvirt-script-check + block: + - name: Look for kolla_nova_libvirt_start in the nova_libvirt image + become: true + kolla_container: + action: "start_container" + command: "ls /usr/local/bin/kolla_nova_libvirt_start" + common_options: "{{ docker_common_options }}" + container_engine: "{{ kolla_container_engine }}" + detach: false + environment: + KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + image: "{{ service.image }}" + name: "nova_libvirt_script_check" + restart_policy: oneshot + remove_on_exit: true + register: nova_libvirt_script_check + failed_when: false + check_mode: false + run_once: true + delegate_to: "{{ groups[service.group] | first }}" + + - name: Assert the nova_libvirt image is recent enough + run_once: true + delegate_to: "{{ groups[service.group] | first }}" + ansible.builtin.assert: + that: + - "'/usr/local/bin/kolla_nova_libvirt_start' in (nova_libvirt_script_check.stdout | default(''))" + fail_msg: > + The nova_libvirt image '{{ service.image }}' does not contain + /usr/local/bin/kolla_nova_libvirt_start, which this version of + Kolla-Ansible needs to launch libvirtd alongside virtlogd. This + almost always means the container image has not been updated to + match the upgraded Kolla-Ansible code. Pull or build a current + nova-libvirt image before deploying. If you intend to keep using + an older image, skip the tag 'nova-libvirt-script-check'. + success_msg: > + nova_libvirt image provides kolla_nova_libvirt_start. diff --git a/ansible/roles/nova-cell/templates/nova-libvirt.json.j2 b/ansible/roles/nova-cell/templates/nova-libvirt.json.j2 index f64098707..5a6ece358 100644 --- a/ansible/roles/nova-cell/templates/nova-libvirt.json.j2 +++ b/ansible/roles/nova-cell/templates/nova-libvirt.json.j2 @@ -1,5 +1,5 @@ { - "command": "/usr/sbin/libvirtd --listen", + "command": "/usr/local/bin/kolla_nova_libvirt_start", "config_files": [ { "source": "{{ container_config_directory }}/libvirtd.conf", diff --git a/ansible/roles/nova-cell/templates/qemu.conf.j2 b/ansible/roles/nova-cell/templates/qemu.conf.j2 index 03b56479a..1a828ecb5 100644 --- a/ansible/roles/nova-cell/templates/qemu.conf.j2 +++ b/ansible/roles/nova-cell/templates/qemu.conf.j2 @@ -1,4 +1,4 @@ -stdio_handler = "file" +stdio_handler = "logd" user = "nova" group = "nova" diff --git a/releasenotes/notes/nova-libvirt-script-precheck-7c9f2a1b3d4e5f60.yaml b/releasenotes/notes/nova-libvirt-script-precheck-7c9f2a1b3d4e5f60.yaml new file mode 100644 index 000000000..2bd6235b4 --- /dev/null +++ b/releasenotes/notes/nova-libvirt-script-precheck-7c9f2a1b3d4e5f60.yaml @@ -0,0 +1,11 @@ +--- +upgrade: + - | + A deploy-time check now verifies that the ``nova_libvirt`` image contains + the ``/usr/local/bin/kolla_nova_libvirt_start`` helper before deploying. + This helper launches ``libvirtd`` alongside ``virtlogd`` and is required + by current Kolla-Ansible. If you upgrade Kolla-Ansible but continue to + use an older ``nova_libvirt`` image that predates the helper, the deploy + now fails fast with an explanatory message instead of leaving the + container unable to start. Pull or build a matching ``nova_libvirt`` + image, or skip the ``nova-libvirt-script-check`` tag to bypass the check. diff --git a/releasenotes/notes/nova-libvirt-virtlogd-0b77f24764dcecfc.yaml b/releasenotes/notes/nova-libvirt-virtlogd-0b77f24764dcecfc.yaml new file mode 100644 index 000000000..94b92e5fc --- /dev/null +++ b/releasenotes/notes/nova-libvirt-virtlogd-0b77f24764dcecfc.yaml @@ -0,0 +1,13 @@ +--- +features: + - | + The ``nova_libvirt`` container now runs ``virtlogd`` as a sidecar + alongside ``libvirtd``, and ``qemu.conf`` is configured with + ``stdio_handler = "logd"`` so that libvirt routes instance console + chardevs through ``virtlogd``. This allows guest console logs to be + rotated according to ``/etc/libvirt/virtlogd.conf`` (by default 2MB + per file with 3 backups), instead of growing without bound as they + did when ``stdio_handler`` was set to ``"file"``. + + Note that existing instances must be hard rebooted to pick up the + new console handler, as the chardev mode is fixed at qemu launch. |
