Fix race-condition when libvirt starts unwillingly

libvirtd.socket does monitor libvirtd.service and trigger service restart
when it spot that service is down.

However in order to enable tcp and tls sockets, we need libvirt
to be stopped.

Currently race condition can happen, when we stop libvirt, but it's
started by socket before we enable tls one.

To overcome this we stop socket along with service.

Change-Id: Iacc093311036fb8d6559a0e32252579303a639ba
This commit is contained in:
Dmitriy Rabotyagov 2022-02-10 14:23:44 +02:00
parent 7589b7b66b
commit a3c0edba56
5 changed files with 17 additions and 6 deletions

View File

@ -15,12 +15,14 @@
- name: Stop libvirt-bin - name: Stop libvirt-bin
service: service:
name: "{{ libvirt_service_name }}" name: "{{ item }}"
enabled: yes enabled: yes
state: "stopped" state: "stopped"
listen: listen:
- Restart libvirt-bin - Restart libvirt-bin
- "cert installed" - "cert installed"
with_items:
- "{{ libvirt_service_name }}"
when: when:
- "'nova_compute' in group_names" - "'nova_compute' in group_names"
- nova_virt_type != 'ironic' - nova_virt_type != 'ironic'
@ -43,9 +45,11 @@
- name: Start libvirt-bin - name: Start libvirt-bin
service: service:
name: "{{ libvirt_service_name }}" name: "{{ item }}"
enabled: yes enabled: yes
state: "started" state: "started"
with_items:
- "{{ libvirt_service_name }}"
listen: listen:
- Restart libvirt-bin - Restart libvirt-bin
- "cert installed" - "cert installed"

View File

@ -15,8 +15,9 @@
- name: Make sure libvirt is started - name: Make sure libvirt is started
service: service:
name: "{{ libvirt_service_name }}" name: "{{ item }}"
state: "started" state: "started"
with_items: "{{ libvirt_service_name }}"
- name: Check the state of the default qemu save directory - name: Check the state of the default qemu save directory
stat: stat:

View File

@ -17,7 +17,9 @@
cache_timeout: 600 cache_timeout: 600
libvirt_group: libvirt libvirt_group: libvirt
libvirt_service_name: libvirtd libvirt_service_name:
- libvirtd.socket
- libvirtd.service
# Common apt packages # Common apt packages
nova_distro_packages: nova_distro_packages:

View File

@ -16,7 +16,9 @@
nova_qemu_user: qemu nova_qemu_user: qemu
nova_qemu_group: qemu nova_qemu_group: qemu
libvirt_group: libvirt libvirt_group: libvirt
libvirt_service_name: libvirtd libvirt_service_name:
- libvirtd.socket
- libvirtd.service
# Common yum packages # Common yum packages
nova_distro_packages: nova_distro_packages:

View File

@ -16,7 +16,9 @@
nova_qemu_user: qemu nova_qemu_user: qemu
nova_qemu_group: qemu nova_qemu_group: qemu
libvirt_group: libvirt libvirt_group: libvirt
libvirt_service_name: libvirtd libvirt_service_name:
- libvirtd.socket
- libvirtd.service
# Common yum packages # Common yum packages
nova_distro_packages: nova_distro_packages: