Bug 1370936

Summary: RFE: suspend/resume all virtual machines on host suspend/resume
Product: [Community] Virtualization Tools Reporter: Marc Haber <mh+redhat-bugzilla-2011>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: NEW --- QA Contact:
Severity: low Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: crobinso, libvirt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Marc Haber 2016-08-28 15:53:44 UTC
The script tools/libvirt-guests.sh.in is used in distributions to shut down or suspend domains when the host goes down. This works like a charm.

However, currently, KVM has the issue that the host going to _sleep_ sometimes affects the running domains: It sometimes happens that the domains become unresponsive CPU-hogs. It does help to suspend the KVM domains before the host sleeps. systemd provides a mechanism to do that by means of /lib/systemd/system-sleep/.

libvirt-guests.sh contains most of the code needed to suspend all running domains, but it doesn't expose those mechanisms to the public.

Please consider adding a "suspend" and a "resume" option to libvirt-guests.sh that applies the respective operation to all domains even if the selected shutdown operation is "shutdown".

I am willing to provide a patch if you indicate that you would accept it.

Comment 1 Cole Robinson 2016-09-08 14:17:43 UTC
If qemu VMs consume tons of CPU after host suspend/resume, that's a qemu bug that should be fixed. But the feature request is still reasonable IMO, but it wouldn't be something we enable by default. Maybe make it a qemu.conf or libvirtd.conf option that can tie into systemd's suspend inhibitor? There's a related bug at https://bugzilla.redhat.com/show_bug.cgi?id=826044