AW: rc.d script for running multiple VirtualBox VMs from /etc/rc.conf

Bernhard Froehlich decke at bluelife.at
Mon Apr 18 14:29:34 UTC 2011


On Wed, 13 Apr 2011 05:28:44 -0700, Tobias Oberstein wrote:
> Hi Bernhard,
> 
>> > I wanted to configure multiple VirtualBox VMs to startup automatically
>> > at boot time and generally be a nice citizen to the FreeBSD way of
>> > starting up stuff.
>> >
>> > Using that rc.d script (see attached) you can configure starting up
>> > multiple VirtualBox VMs from /etc/rc.conf:
>>
>> Sorry it's probably my fault because you're the 3rd one who has written such
>> a script but we already have one for 4.0.
> 
> Ah, ok;)
> 
>>
>> http://svn.bluelife.at/index.cgi/blueports/view/emulators/virtualbox-ose-
>> devel/files/vboxheadless.in
>>
>> It is a bit less complicated and can also manage multiple VMs but it does not
>> have separated flags per VM.
> 
> Mine is more complicated, yes .. but it's more or less a direct
> adaption of the script for apache22.
> 
> Also, I definitely need flags per VM, since we run each VM
> 
> i) under a dedicated user
> ii) on a separate ZFS filesystem
> iii) with specific VNC port/password
> 
> i+iii requires flags per VM.
> 
> iii) is for obvious reasons .. need to connect to each VM on a distinct port.
> 
> i) is for a) security and b) management of VMs by different "VM
> admins" which don't have to be root or have a user which would manage
> all VMs.
> 
> ==
> 
> I there interest to consolidate our scripts?

I've merged the features together and got the following:

# vboxheadless_enable (bool):         Set to "NO" by default.
#                                     Set it to "YES" to enable
vboxheadless.
# vboxheadless_machines (str):        Space separated list of machines
# vboxheadless_user (str):            Default user account to run with
# vboxheadless_<machine>_name (str):  VBox machine name or UUID
# vboxheadless_<machine>_user (str):  User account to run with
# vboxheadless_<machine>_flags (str): Custom flags for VBoxHeadless

simple example:

vboxheadless_enable="YES"
vboxheadless_machines="FreeBSD Ubuntu1 Machine3"


complex example:
vboxheadless_enable="YES"
vboxheadless_machines="vm1 vm2 Machine3"
vboxheadless_user="vboxuser"

vboxheadless_vm1_name="FreeBSD"
vboxheadless_vm1_user="user1"

vboxheadless_vm2_name="Ubuntu1"
vboxheadless_vm2_user="user2"
vboxheadless_vm2_flags="--vnc --vncport 4711 --vncpass <here>"


I could not test it yet but will do that in the evening and commit the
new script to blueports.

-- 
Bernhard Fröhlich
http://www.bluelife.at/


More information about the freebsd-emulation mailing list