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
(cherry picked from commit a3c0edba56)
This commit is contained in:
Dmitriy Rabotyagov 2022-02-10 14:23:44 +02:00
parent 961f471f9a
commit bd8c799a72
4 changed files with 14 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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