Tuesday, November 17, 2009
Sunday, November 1, 2009
Headless Sun xVM VirtualBox guests via SMF
I finally had some extra time this weekend to sit down and finish an SMF manifest to support headless VirtualBox guests. Overall, I am quite pleased with the result:
The source for the service manifest and method script is available here. These files should be copied to /var/svc/manifest/application/virtualbox/ and /lib/svc/method/, respectively.
I have also created an IPS package for OpenSolaris users; if you are interested in installing the package, you will need to add my private IPS repository first:
% pfexec pkg set-authority -O http://arf.ubound.org/pkg/ arf.ubound.orgOnce the repository has been added, you can then install the
virtualbox-headless package:% pfexec pkg install virtualbox-headlessOnce the files are in place, you may need to import the manifest manually; since there are no default instances,
svc:/system/manifest-import:default has a tendency to skip the manifest during a bulk import (this issue seems to affect the IPS package as well):% pfexec svccfg import /var/svc/manifest/application/virtualbox/virtualbox-headless.xmlOnce you have imported the manifest, it is time to add each guest you wish to manage. I have written the manifest such that a guest is identified by the name of the instance itself. For example, if I wanted to add a guest named
qnx641, I would issue the following:% pfexec svccfg -s virtualbox/headless add qnx641You may then enable the instance via
svcadm(1M):% pfexec svcadm enable virtualbox/headless:qnx641Two properties are provided to control the start and stop behavior of each instance:
- The
vbox/start_typeproperty corresponds to the--typeargument passed toVBoxManage startvm; by default, it is set toheadless. Possible values are:gui,sdl,vrdp, andheadless, however only the last two really make any sense when used with SMF. - The
vbox/stop_methodproperty corresponds to the argument passed toVBoxManage controlvmwhich is responsible for stopping the instance; by default it is set tosavestate. Possible values are:pause,resume,reset,poweroff,savestate,acpipowerbutton, andacpisleepbutton
% pfexec svccfg -s virtualbox/headless:qnx641Since this is a "wait" model service, it does not properly support a user shutting down the guest outside of
svc:/application/virtualbox/headless:qnx641> addpg vbox application
svc:/application/virtualbox/headless:qnx641> setprop vbox/stop_method = astring: "poweroff"
^D
svcadm(1M) invocations; the service will continue to report its status as online. In this case, a simple disable or restart will resolve the problem.Enjoy!
Labels:
OpenSolaris
Subscribe to:
Posts (Atom)

