Skip to content

Commit

Permalink
ansible: Restart services after Vdsm certificate update
Browse files Browse the repository at this point in the history
After updating Vdsm certificates, the corresponding services are not
restarted.  Or, actually, they are, but only as a part of
ovirt-host-deploy-vnc-certificates role if those certificates happened
to be updated as well (they usually do), which is not entirely
sufficient.  And ovirt-imageio is not restarted at all.

Let’s make sure the services are always restarted after Vdsm
certificates update.  It’s sufficient to restart libvirtd (it restarts
vdsmd etc. too) and ovirt-imageio (vdsmd wants it started but doesn’t
ensure its restart).

We check for both ‘enabled’ status and ‘running’ states.  Some
services may be stopped before updates, so checking for ‘running’
wouldn’t be sufficient.  And ovirt-imageio may be running but not
enabled, which is probably a bug but it doesn’t harm to check for
both.

This change also means that some services may be restarted more than
once during a certificate update.  Fixing this would need introducing
inter-role service handling, which would be too complicated at the
moment.  Multiple restarts should be usually harmless because this is
normally done in the maintenance mode.

Bug-Url: https://bugzilla.redhat.com/2079901
  • Loading branch information
mz-pdm committed May 4, 2022
1 parent 2a4af1f commit 399e818
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@
dest: "{{ ovirt_vdsm_trust_store }}/{{ ovirt_qemu_client_key_file }}"
state: link

- name: Populate service facts
service_facts:

- name: Restart services
service:
name: "{{ item }}"
state: restarted
loop:
- libvirtd.service
- ovirt-imageio.service
when: "ansible_facts.services.get(item, {}).get('status') == 'enabled' or ansible_facts.services.get(item, {}).get('state') == 'running'""
always:
- name: Remove temp file
file:
Expand Down

0 comments on commit 399e818

Please sign in to comment.