[vfio-users] Preventing host from going into sleep

Nicolas Roy-Renaud nicolas.roy-renaud.1 at ens.etsmtl.ca
Wed Jun 22 05:01:24 UTC 2016


I've had my fair share of lockups because I forgot to turn off my VM 
before putting my host to sleep, and I've started looking into some sort 
of lock to prevent that kind of mistake. Normally, I'd use something 
like `systemd-inhibit 
<https://www.freedesktop.org/software/systemd/man/systemd-inhibit.html>` 
to do that, except the calls libvirt makes to its hook scripts are 
self-contained while sysd-inhibit is completely synchroneous (you use it 
just like `time`). I've looked into using the underlying dbus calls 
instead, and it appears that since Inhibit() 
<https://www.freedesktop.org/wiki/Software/systemd/inhibit/> returns a 
file descriptor which expires as soon as its owner is closed, I can't 
just lock it before the VM starts and close it when it stops.

By the looks of it, I can't write a wrapper script for qemu-system 
either since libvirt doesn't launch it with the same capabilities as a 
regular user, and the dbus calls coming from sysd-inhibit fail.

I can't seem to find a simple solution to that issue, which is a pretty 
big deal considering it's not something that libvirt supports on its own 
(unless I've missed something). What would you all reccomend?

- Nicolas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/vfio-users/attachments/20160622/7e4783d2/attachment.htm>


More information about the vfio-users mailing list