Merge "Add safe shutdown systemd jobs to tools"

This commit is contained in:
Zuul 2018-07-23 03:15:54 +00:00 committed by Gerrit Code Review
commit 7c8b0e704e
3 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,19 @@
[Unit]
Description=Manage libvirt guests in kolla safely
After=docker.service
After=systemd-machined.service
After=virt-guest-shutdown.target
Requires=docker.service
Requires=virt-guest-shutdown.target
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=yes
TimeoutStopSec=610
ExecStart=-/usr/bin/docker exec nova_libvirt /bin/rm -f /var/lib/libvirt/libvirt-guests
ExecStart=-/usr/bin/docker start nova_compute
ExecStop=/usr/bin/docker stop nova_compute
ExecStop=/usr/bin/docker exec nova_libvirt /bin/sh -x /usr/libexec/libvirt-guests.sh shutdown

View File

@ -0,0 +1,24 @@
# This playbook modifies the system shutdown sequence to ensure that
# nova-compute is shutdown safely, including guests, when used in
# conjunction with systemd-machined and libvirt.
---
- name: Set up compute libvirts to shutdown guests safely
hosts: compute
become: true
vars:
systemd_artifacts:
- kolla-libvirt-guests.service
- virt-guest-shutdown.target
tasks:
- name: Install systemd artifacts
copy:
src: "{{ item }}"
dest: "/usr/lib/systemd/system/{{ item }}"
with_items: "{{ systemd_artifacts }}"
- name: Enable/start systemd artifacts
systemd:
enabled: yes
state: started
name: "{{ item }}"
with_items: "{{ systemd_artifacts }}"

View File

@ -0,0 +1,5 @@
[Unit]
Description=Coordination target for machined controlled guests
[Install]
WantedBy=multi-user.target