Fix service dependency on libvirt daemons

Since commit 768b66f885 was merged,
TripleO deploys modular libvirt daemons instead of monolithic one.

When modular libvirt daemons are used, the nova_libvirt container is
no longer used and service dependency should rely on individual daemons
like nova_virtqemud.

This change introduces the new tripleo_nova_libvirt.target systemd unit
so that we can define service dependencies more easily and consisently.

Co-authored-by: Bogdan Dobrelya <bdobreli@redhat.com>
Closes-Bug: #1967021
Change-Id: Id3f9e6320fc8bfc8e59cae2308fe4cb118643a9b
This commit is contained in:
Takashi Kajinami 2022-04-26 16:45:54 +09:00 committed by Bogdan Dobrelya
parent 8cdef50d46
commit d15794339b
3 changed files with 56 additions and 2 deletions

View File

@ -711,6 +711,29 @@ outputs:
- container_cli == 'podman'
- not container_healthcheck_disabled
- step|int == 4
- name: Set up systemd target for libvirt services
when: step|int == 4
block:
- name: Create systemd file
copy:
dest: /etc/systemd/system/tripleo_nova_libvirt.target
mode: '0644'
owner: root
group: root
content: |
[Unit]
Wants=tripleo_nova_libvirt.service
After=tripleo_nova_libvirt.service
become: true
register: libvirt_target_result
- name: Reload systemd
systemd:
name: tripleo_nova_libvirt.target
enabled: true
state: restarted
daemon_reload: true
become: true
when: libvirt_target_result.changed
- if:
- {get_param: EnableInternalTLS}
- - name: Certificate generation

View File

@ -1380,7 +1380,7 @@ outputs:
user: nova
restart: always
depends_on:
- tripleo_nova_libvirt.service
- tripleo_nova_libvirt.target
healthcheck: {get_attr: [ContainersCommon, healthcheck_rpc_port]}
volumes:
list_concat:
@ -1526,7 +1526,7 @@ outputs:
Requires=virt-guest-shutdown.target
After=systemd-machined.service
After=network-online.target
After=tripleo_nova_libvirt.service
After=tripleo_nova_libvirt.target
Before=tripleo_nova_compute.service
Documentation=man:libvirtd(8)
Documentation=https://libvirt.org

View File

@ -885,6 +885,37 @@ outputs:
- {get_param: QemuClientCertificateKeySize}
- {get_param: CertificateKeySize}
ca: ipa
- - name: Set up systemd target for libvirt services
when: step|int == 4
block:
- name: Create systemd file
copy:
dest: /etc/systemd/system/tripleo_nova_libvirt.target
mode: '0644'
owner: root
group: root
content: |
[Unit]
Wants=tripleo_nova_virtsecretd.service
Wants=tripleo_nova_virtnodedevd.service
Wants=tripleo_nova_virtstoraged.service
Wants=tripleo_nova_virtproxyd.service
Wants=tripleo_nova_virtqemud.service
After=tripleo_nova_virtsecretd.service
After=tripleo_nova_virtnodedevd.service
After=tripleo_nova_virtstoraged.service
After=tripleo_nova_virtproxyd.service
After=tripleo_nova_virtqemud.service
become: true
register: libvirt_target_result
- name: Reload systemd
systemd:
name: tripleo_nova_libvirt.target
enabled: true
state: restarted
daemon_reload: true
become: true
when: libvirt_target_result.changed
host_prep_tasks:
list_concat:
- {get_attr: [NovaLibvirtLogging, host_prep_tasks]}