<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>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<br><br>Installed using Q35 chipset.<br>
<br></div><div>I can perform virsh # shutdown <vmname>, and watching the client VM console see a graceful shutdown.<br>
</div><div><br>On host:<br>=====<br></div><div># systemctl reboot<br></div><div>{{{ client VM console immediately blanks out - I do NOT see a graceful shutdown }}}<br>libvirt-guests.sh: Running guests on default URI: <vmname><br>libvirt-guests.sh: Shuitting down guests on default URI...<br>libvirt-guests.sh: Starting shutdown on guest: <vmname><br>libvirt-guests.sh: Waiting for 1 guests to shut down, 300 seconds left<br>A stop job is running for Suspend Active Libvirt Guests... libvirt-guests.sh: Waiting for 1 guests to shut down<br>=====<br>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.<br></div><div>=====<br></div># systemctl status libvirt-guests<br></div><div>● libvirt-guests.service - Suspend Active Libvirt Guests<br>   Loaded: loaded (/usr/lib/systemd/system/libvirt-guests.service; enabled; vendor preset: disabled)<br>   Active: active (exited) since Mon 2015-08-10 20:27:57 EDT; 6s ago<br>     Docs: man:libvirtd(8)<br>           <a href="http://libvirt.org">http://libvirt.org</a><br>  Process: 751 ExecStart=/usr/lib/libvirt/libvirt-guests.sh start (code=exited, status=0/SUCCESS)<br> Main PID: 751 (code=exited, status=0/SUCCESS)<br>=====<br></div></div></div></div></div></div>$ cat /etc/conf.d/libvirt-guests<br>BYPASS_CACHE=0<br>CONNECT_RETRIES=10<br>ON_BOOT=start<br>ON_SHUTDOWN=shutdown<br>PARALLEL_SHUTDOWN=4<br>RETRIES_SLEEP=1<br>SHUTDOWN_TIMEOUT=300<br>START_DELAY=0<br>URIS=default<br>=====<br></div>A virsh # shutdown <vmname> or an in-guest systemctl poweroff takes a few seconds (3-5?)<br>=====<br></div>{{{ libvirt-guests.service is: }}}<br>[Unit]<br>Description=Suspend Active Libvirt Guests<br>After=network.target libvirtd.service time-sync.target<br>Documentation=man:libvirtd(8)<br>Documentation=<a href="http://libvirt.org">http://libvirt.org</a><br><br>[Service]<br>EnvironmentFile=-/etc/conf.d/libvirt-guests<br># Hack just call traditional service until we factor<br># out the code<br>ExecStart=/usr/lib/libvirt/libvirt-guests.sh start<br>ExecStop=/usr/lib/libvirt/libvirt-guests.sh stop<br>Type=oneshot<br>RemainAfterExit=yes<br>StandardOutput=journal+console<br><br>[Install]<br>WantedBy=multi-user.target<br>=====<br></div>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):<br><br>Running guests on default URI: <vmname><br>Shutting down guests on default URI...<br>Starting shutdown on guest: <vmname><br>Waiting for 1 guests to shut down, 300 seconds left<br>Shutdown of guest <vmname> complete.<br>=====<br><br></div>