[Pkg-virtualbox-devel] lifecycle support for vbox guests (start and stop with host)

Marcus Osdoba marcus.osdoba at googlemail.com
Tue Feb 28 21:59:33 UTC 2012


Hello debian vbox team,

I like to propose my alternative VBox.sh and init.d-scripts [0] based on 
the Debian vbox package (4.0.10~bpo and my suggested 4.0.16~bpo).

I didn't find a proper way to start and stop guests together with the 
host OS. That's why I started developing some sort of lifecycle 
management for vbox guests.

Features:
- init.d configurable via /etc/default/virtualbox
   (insert the unix user which runs the vms)
- init.d start
   starts all machines with special property set to "managed"
- init.d stop
   stops all machines with desired shutdownstrategy
   and finally saves all remaining not stopped before
- all necessary properties are stored in the .vbox file and
   editable with set/getextradata (it's not necessary to
   put the admin passwords of your guest in some extrafile)
- conditional start (e.g. define a ping and start only if a certain
   IP address is not reachable - very simple split brain prevention)
- disable configured machines temporarily
- virtualbox drv script and guest script are split into different files

Examples:
vbox at host:~$ VBoxManage getextradata testvm enumerate
Key: lifecycle/maxWaitRounds, Value: 3
Key: lifecycle/shutdownCmd, Value: /sbin/shutdown
Key: lifecycle/shutdownCmdArguments, Value: -h
Key: lifecycle/shutdownCmdGuestPassword, Value: geheim
Key: lifecycle/shutdownCmdGuestUser, Value: root
Key: lifecycle/shutdownStrategy, Value: staged
Key: lifecycle/startupCondition, Value: $({ ping -i 2 -w 4 192.168.2.2 
 >/dev/null; echo $?; }) = 1
Key: lifecycle/startupMode, Value: managed


Tested with 4.0.10_amd64 from stable backports and my suggested 
4.0.16_amd64 on a real life server.

I like to contribute this to the Debian project. Please let me know, if 
you see any chance to integrate this into the vbox package.

Best regards,
Marcus

[0] https://gitorious.org/debian/virtualbox-initscripts
(please ignore the websrv init.d scripts)



More information about the Pkg-virtualbox-devel mailing list