I know this is a slightly older thread but I thought I'd share what I've done.
The power button on my rig will power the system on as normal. I'd imagine holding it once on will force a power off but I don't really want to test this - worst case, I can just pull power. If I want to shutdown the server, I use the web gui.
Once unRaid is botoed, the power button will toggle my Windows VM on or off. In Windows power management, I've set it so the power button puts the machine to sleep - this makes it start up faster.
First create a script in User Scripts. I called mine vmStartStop and it toggles a VM called Windows 10.
#! /bin/bash
# if domain is running, shut down
if virsh list | grep "Windows 10 .*running" ; then
virsh shutdown "Windows 10"
# resume domain if it's paused
elif virsh list | grep "Windows 10 .*paused" ; then
virsh resume "Windows 10"
elif virsh list | grep "Windows 10 .*pmsuspended" ; then
virsh dompmwakeup "Windows 10"
# otherwise start domain
else
virsh start "Windows 10"
fi
Than edit /etc/acpi/acpi_handler.sh as per the post above. Change the power line to point at your user script (the path is at the top of the edit script page). Don't forget the . at the start of the line:
power) . /boot/config/plugins/user.scripts/scripts/vmStartStop/script
Hope this helps someone.