Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 403337 - app-emulation/virtualbox: save machine state when shutting down
Summary: app-emulation/virtualbox: save machine state when shutting down
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Lowest enhancement (vote)
Assignee: Lars Wendler (Polynomial-C)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-13 01:03 UTC by Christoph Junghans
Modified: 2013-11-11 20:52 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
updated init.d script (virtualbox,472 bytes, text/plain)
2013-10-24 16:38 UTC, Christoph Junghans
Details
updated init.d script (virtualbox,855 bytes, text/plain)
2013-11-01 22:55 UTC, Christoph Junghans
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Junghans gentoo-dev 2012-02-13 01:03:17 UTC
I have used the following shutdown function for a while. (If needed I could rewrite it as init.d script.)

$ cat /etc/local.d/virtualbox.stop 
. /etc/init.d/functions.sh

for user in $(/usr/sbin/groupmems -g vboxusers -l); do
  for uuid in $(su - $user -c '/opt/bin/VBoxManage -q list runningvms' | sed -n 's/^.*{\([^}]*\)}$/\1/p'); do
    name=$(su - $user -c "/opt/bin/VBoxManage showvminfo $uuid" | awk '/^Name:/{print $2}')
    ebegin "Save state of vm '$name' of user $user"
    su - $user -c "/opt/bin/VBoxManage controlvm $uuid savestate" &>/dev/null
    eend $?
 done
done
Comment 1 Christoph Junghans gentoo-dev 2013-10-21 22:36:23 UTC
Ping!
Comment 2 Christoph Junghans gentoo-dev 2013-10-24 16:38:13 UTC
Created attachment 361800 [details]
updated init.d script
Comment 3 Lars Wendler (Polynomial-C) gentoo-dev 2013-10-24 18:42:18 UTC
Looks interesting. Once I have some time I gonna test the script...
Comment 4 Christoph Junghans gentoo-dev 2013-11-01 22:55:40 UTC
Created attachment 362412 [details]
updated init.d script

(In reply to Lars Wendler (Polynomial-C) from comment #3)
> Looks interesting. Once I have some time I gonna test the script...
I added a start function, which will start a list of machines.
Comment 5 Lars Wendler (Polynomial-C) gentoo-dev 2013-11-02 13:24:47 UTC
Where does ${VMS_TO_START} come from? I suppose it's set via conf.d file? If yes please provide a sample file.
Comment 6 Christoph Junghans gentoo-dev 2013-11-11 20:52:25 UTC
(In reply to Lars Wendler (Polynomial-C) from comment #5)
> Where does ${VMS_TO_START} come from? I suppose it's set via conf.d file? If
> yes please provide a sample file.
Yeah one needs to create a conf.d file with 
VMS_TO_START="user:machine-uuid user2:machine-uuid2" in it.