Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
resource-agents.8843
0036-VirtualDomain-Properly-migrate-VMs-on-node...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0036-VirtualDomain-Properly-migrate-VMs-on-node-shutdown-.patch of Package resource-agents.8843
From ed39a4496fc502a9e7f8d802a95abc89c9c87186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@suse.com> Date: Wed, 10 Jan 2018 23:10:06 +0100 Subject: [PATCH 32/33] VirtualDomain: Properly migrate VMs on node shutdown (bsc#1074014) There are three actors in sum controlling the VMs: - pacemaker/VirtualDomain RA - issuing cluster resource operations, - libvirtd - executing the given commands, - systemd and systemd-machined - manages scope units of running VMs. During shutdown both libvirtd and systemd-machined termination runs concurrently with pacemaker so it cannot properly communicate with libvirtd and terminate the machines (e.g. stopped scope unit would turn the VM off instead of migration that's usually intended in a HA cluster). We add ordering dependency both on libvirtd.service and virt-guest-shutdown.target so that pacemaker is terminated *before* the other mechanisms would stop the VMs. Thus it can invoke appropriate resource action on the running VM. In order the ordering against virt-guest-shutdown.target to work its stop job must be in the shutdown transaction thus we start the target when activating a VM. The target is ordering-only, it doesn't activate any other units. Ref: #1087 --- heartbeat/VirtualDomain | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain index 0420c571..5521290d 100755 --- a/heartbeat/VirtualDomain +++ b/heartbeat/VirtualDomain @@ -463,6 +463,14 @@ VirtualDomain_start() { return $OCF_SUCCESS fi + # systemd drop-in to stop domain before libvirtd terminates services + # during shutdown/reboot + if systemd_is_running ; then + systemd_drop_in "99-VirtualDomain-libvirt" "After" "libvirtd.service" + systemd_drop_in "99-VirtualDomain-machines" "Wants" "virt-guest-shutdown.target" + systemctl start virt-guest-shutdown.target + fi + snapshotimage="$OCF_RESKEY_snapshot/${DOMAIN_NAME}.state" if [ -n "$OCF_RESKEY_snapshot" -a -f "$snapshotimage" ]; then virsh restore $snapshotimage @@ -736,6 +744,14 @@ VirtualDomain_migrate_to() { } VirtualDomain_migrate_from() { + # systemd drop-in to stop domain before libvirtd terminates services + # during shutdown/reboot + if systemd_is_running ; then + systemd_drop_in "99-VirtualDomain-libvirt" "After" "libvirtd.service" + systemd_drop_in "99-VirtualDomain-machines" "Wants" "virt-guest-shutdown.target" + systemctl start virt-guest-shutdown.target + fi + while ! VirtualDomain_monitor; do sleep 1 done -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor