Using libvirt 1.2.18 (-1 Arch) and QEMU git-master (2.4.0.r40384.2d69736).
pm-utils 1.4.1-6. acpid 2.0.23-4
Installed using Q35 chipset.
I can perform virsh # shutdown <vmname>, and watching the client VM console
see a graceful shutdown.
On host:
=====
# systemctl reboot
{{{ client VM console immediately blanks out - I do NOT see a graceful
shutdown }}}
libvirt-guests.sh: Running guests on default URI: <vmname>
libvirt-guests.sh: Shuitting down guests on default URI...
libvirt-guests.sh: Starting shutdown on guest: <vmname>
libvirt-guests.sh: Waiting for 1 guests to shut down, 300 seconds left
A stop job is running for Suspend Active Libvirt Guests...
libvirt-guests.sh: Waiting for 1 guests to shut down
=====
In about 85 seconds, it moves past this, but guest was not suspended or
gracefully shutdown. Guest's "last" shows a crash. And, watching on the
VM console, the minute systemctl restart runs on the host, the VM console
disconnects.
=====
# systemctl status libvirt-guests
● libvirt-guests.service - Suspend Active Libvirt Guests
Loaded: loaded (/usr/lib/systemd/system/libvirt-guests.service; enabled;
vendor preset: disabled)
Active: active (exited) since Mon 2015-08-10 20:27:57 EDT; 6s ago
Docs: man:libvirtd(8)
http://libvirt.org
Process: 751 ExecStart=/usr/lib/libvirt/libvirt-guests.sh start
(code=exited, status=0/SUCCESS)
Main PID: 751 (code=exited, status=0/SUCCESS)
=====
$ cat /etc/conf.d/libvirt-guests
BYPASS_CACHE=0
CONNECT_RETRIES=10
ON_BOOT=start
ON_SHUTDOWN=shutdown
PARALLEL_SHUTDOWN=4
RETRIES_SLEEP=1
SHUTDOWN_TIMEOUT=300
START_DELAY=0
URIS=default
=====
A virsh # shutdown <vmname> or an in-guest systemctl poweroff takes a few
seconds (3-5?)
=====
{{{ libvirt-guests.service is: }}}
[Unit]
Description=Suspend Active Libvirt Guests
After=network.target libvirtd.service time-sync.target
Documentation=man:libvirtd(8)
Documentation=http://libvirt.org
[Service]
EnvironmentFile=-/etc/conf.d/libvirt-guests
# Hack just call traditional service until we factor
# out the code
ExecStart=/usr/lib/libvirt/libvirt-guests.sh start
ExecStop=/usr/lib/libvirt/libvirt-guests.sh stop
Type=oneshot
RemainAfterExit=yes
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
=====
Strangely, manually running "/usr/lib/libvirt/libvirt-guests.sh stop" lets
me see a graceful shutdown on the VM console and shows (executing in a few
seconds):
Running guests on default URI: <vmname>
Shutting down guests on default URI...
Starting shutdown on guest: <vmname>
Waiting for 1 guests to shut down, 300 seconds left
Shutdown of guest <vmname> complete.
=====