Hi
Is it possible to graceful (ACPI) shutdown or suspend virtual machines when I reboot or shutdown OpenMediaVault?
Hi
Is it possible to graceful (ACPI) shutdown or suspend virtual machines when I reboot or shutdown OpenMediaVault?
See pic.. you could create a script that would shutdown any machines before shutdown if you do not want to do manually.
Virtualbox's init script saves the state of each vm on shutdown. I suppose you could change this to acpi shutdown.
/etc/init.d/vboxinit
stop()
{
# vms are saved, instead of stopped.
MACHINES=$($su_command "VBoxManage list runningvms | awk '{ print \$NF }' | sed -e 's/[{}]//g'")
for UUID in $MACHINES; do
VMNAME=$($su_command "VBoxManage showvminfo $UUID | sed -n '0,/^Name:/s/^Name:[ \t]*//p'")
echo "$0: saving machine ${VMNAME} state ..."
$su_command "VBoxManage controlvm $UUID savestate" >>/var/log/vb.log
done
}
Hello,
I also want shut down my VM when the server shuts down. Unfortunately there's no vboxinit under /etc/init.d
There's a script called "virtualbox".
How can I shut down of my VM before the server shuts down (via script)?
Unfortunately under root there is no VM visually. You have to change to user "vbox". See here
For version OMV 2.1/2.2.14:
1)
check file /etc/defaults/virtualbox :
-----text in file: -----------------------------
# Defaults for VirtualBox.
# Sourced by vboxweb-service on startup
VBOXWEB_USER=vbox
VBOXWEB_HOST=127.0.0.1
----------------------------------------------------
2)
in file etc/init.d/vboxinit check 2 fragments,
edit (# Required-Stop: $all)
,all system services will continue work some time after shutdown/reboot, until vboxinit script run)
add delay 60 seconds ($su_command "sleep 60s")
and change command from savestate to acpipowerbutton in script,
--fragment1: -----------------------------------
### BEGIN INIT INFO
# Provides: vboxinit
# Required-Start: vboxdrv $local_fs
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Controls VirtualBox sessions
### END INIT INFO
---fragment2:-------------------------------------
stop()
{
# vms are saved, instead of stopped.
MACHINES=$($su_command "VBoxManage list runningvms | awk '{ print \$NF }' | sed -e 's/[{}]//g'")
for UUID in $MACHINES; do
VMNAME=$($su_command "VBoxManage showvminfo $UUID | sed -n '0,/^Name:/s/^Name:[ \t]*//p'")
echo "$0: stopping machine ${VMNAME} ..."
$su_command "VBoxManage controlvm $UUID acpipowerbutton" >>/var/log/vb.log
$su_command "sleep 60s"
done
}
----------------------------------------------------
3)
check "run premission" for etc/init.d/vboxinit
4)
run command from shell:
sudo update-rc.d vboxinit defaults
5) reboot system , start VM , check host reboot\shutdown,
shutdown test for Windows Guest VM:
put test.cmd in "computer" shutdown scenaries in gpedit.msc:
------------
ping 127.0.0.1 -n 10
ping 127.0.0.1 -n 3 > c:\log.txt
---------
(for result need minimum 13 seconds)
check c:\log.txt file and creation data of file.
check "windows Reliability Monitor" 10-15 min after host reboot , non graceful windows shutdown-s show warnings in "Reliability Monitor graph".
-----------------------------------------------------
-----------------------------------
for version OMV-4 no solution
(in default settings "savestate" mode, work only for quick and small VM-s, delay in scripts not work)
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!