On 2024-07-24 19:35, Brett Neumeier wrote:
I'm trying to set up supervision for a QEMU virtual machine on a machine that 
uses s6 and s6-rc for service management.

I currently have my QEMU configured so that it shuts down gracefully when the 
"system_powerdown" monitor command is executed. With s6, though, the only 
idiomatic way that I can get the supervision frameowork to shut down a long-running 
process is to send it a signal. I've verified that I can get QEMU to terminate by sending 
it a SIGINT, SIGTERM, or SIGPWR; but all of those just cause it to terminate, they don't 
send an ACPI shutdown request to the guest operating system.

Is there any way to trigger the same "system_powerdown" mechanism by sending 
QEMU a signal? If not, can anyone suggest a way to add a signal handler that does that?

The method I usually use is to have the "monitor" listen for interactive
human commands on a per machine AF_UNIX socket like
/var/lib/qemu-wrapper/vmfoo/vmfoo.mon, then have my shutdown script does
this (within appropriate robustness conditions and checks):

# echo system_powerdown | socat - unix-connect:$socknam

I suspect Red Hat libvirt does something similar.

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded


Reply via email to