Merge "Add customized libvirt-guests unit file to properly shutdown instances" into stable/queens

This commit is contained in:
Zuul 2019-07-31 09:38:29 +00:00 committed by Gerrit Code Review
commit 0958a9b63d
2 changed files with 57 additions and 0 deletions

View File

@ -372,6 +372,47 @@ outputs:
nfs_vers: {get_attr: [RoleParametersValue, value, nfs_vers]} nfs_vers: {get_attr: [RoleParametersValue, value, nfs_vers]}
mount: name=/var/lib/nova/instances src="{{nfs_share}}" fstype=nfs4 opts="_netdev,bg,{{nfs_options}},vers={{nfs_vers}},nfsvers={{nfs_vers}}" state=mounted mount: name=/var/lib/nova/instances src="{{nfs_share}}" fstype=nfs4 opts="_netdev,bg,{{nfs_options}},vers={{nfs_vers}},nfsvers={{nfs_vers}}" state=mounted
when: nfs_backend_enable|bool when: nfs_backend_enable|bool
- name: is Nova Resume Guests State On Host Boot enabled
set_fact:
resume_guests_state_on_host_boot_enabled: {get_param: NovaResumeGuestsStateOnHostBoot}
- name: install libvirt-guests systemd unit file
when: resume_guests_state_on_host_boot_enabled|bool
block:
- name: libvirt-guests unit to stop nova_api container before shutdown VMs
copy:
dest: /etc/systemd/system/libvirt-guests.service
content: |
[Unit]
Description=Suspend/Resume Running libvirt Guests
Requires=virt-guest-shutdown.target
After=network.target
After=time-sync.target
After=virt-guest-shutdown.target
After=docker.service
After=paunch-container-shutdown.service
After=rhel-push-plugin.service
Documentation=man:libvirtd(8)
Documentation=https://libvirt.org
[Service]
EnvironmentFile=-/etc/sysconfig/libvirt-guests
# Hack just call traditional service until we factor
# out the code
ExecStart=/usr/libexec/libvirt-guests.sh start
ExecStop=/bin/docker stop nova_compute
ExecStop=/usr/libexec/libvirt-guests.sh stop
Type=oneshot
RemainAfterExit=yes
StandardOutput=journal+console
TimeoutStopSec=0
[Install]
WantedBy=multi-user.target
- name: libvirt-guests enable VM shutdown on compute reboot/shutdown
systemd:
name: libvirt-guests
enabled: yes
daemon_reload: yes
upgrade_tasks: upgrade_tasks:
- name: Stop nova-compute service - name: Stop nova-compute service
when: step|int == 1 when: step|int == 1

View File

@ -0,0 +1,16 @@
---
fixes:
- |
Add customized libvirt-guests unit file to properly shutdown instances
If resume_guests_state_on_host_boot is set in nova.conf instances
need to be shutdown using libvirt-guests after nova_compute container
is shut down. Therefore we need a customized libvirt-guests unit file
1) removes the dependency to libvirt (non container) that it don't
get started as a dependency and make the nova_libvirt container to fail.
2) adds a dependency to docker related services that a shutdown of
nova_compute container is possible on system reboot.
3) stops nova_compute container
4) shutdown VMs
This is a missing part of Bug 1778216.