My objective is also to run headless virtual machines through libvirt library.
I am using an Ubuntu 10.04 distro and libvirt 0.9.2.

Before asking you guys about it, I searched on the web and found this:

Hi,

thanks for your hint.

I read the lines in the documentation, but unfortunately editing the xml
within virsh lead to the errors.

The Solution to a headless domain was to edit the XML file from bash and
then

#virsh: define <domainname.xml>

to reload the new values for the graphics type of the machine.

Obvioulsy something went wrong when editing "live"....

Regards,
Christian

Am 24.06.2010 18:27, schrieb Jean-Baptiste Rouault:
> Hi,
>
> Something like this should work, as can be seen in the
> documentation here : http://libvirt.org/formatdomain.html#elementsGraphics
>
> <drivers>
> <graphics type='rdp' autoport='yes' />
> </drivers>
>
> Regards,
>
> Jean-Baptiste
>
>
>> Hello,
>>
>> I'm trying to use the VirtualBox/vbox driver together with libvirt 0.8.1
>> on a Ubuntu Lucid Machine, VirtualBox Release 3.1.
>>
>> The goal is to run the virtual machines headless and to connect using RDP.
>>
>> When starting a virtual domain using 'virsh start <domainname>' the GUI
>> of VirtualBox will pop up and I see no option to prevent this. If X is
>> not running, the virsh command will terminate with 'unknown failure'.
>>
>> I've found some hints on inclusion of the headless statement in the
>> 'graphics' part of the XML definition file, but when I tree to adopt
>> this, the editing of the file will crash.
>>
>> Has anyone achieved to manage VBox machines with libvirt on a headless
>> server ?
>>
>> Thanks in advance for some hints or experiences with this issue,
>> Christian
>>

Unfortunately this isn't working for me.
Following is my XML configuration:

<domain type='vbox'>
  <name>THEDOMAIN</name>
  <uuid>33f6e188-1479-46f4-9d90-4d5a2d3a30f2</uuid>
  <memory>393216</memory>
  <currentMemory>393216</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='i686'>hvm</type>
    <boot dev='hd'/>
    <boot dev='cdrom'/>
  </os>
  <features>
    <acpi/>
  </features>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>destroy</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <source file='/local/vbox-shared.vdi' />
      <target dev='hda' bus='ide'/>
    </disk>
    <disk type='file' device='cdrom'>
      <source file='/local/ubuntu-11.04-desktop-i386.iso' />
      <target dev='hdc' bus='ide'/>
    </disk>
    <interface type='user'>
      <mac address='08:00:27:9a:d0:63'/>
      <model type='Am79C973'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <graphics type='rdp' autoport='yes' />
    <video>
      <model type='vbox' vram='12' heads='1'>
        <acceleration accel3d='no' accel2d='no'/>
      </model>
    </video>
  </devices>
</domain>

When I run command

virsh start THEDOMAIN

it is popping up the following error message:

OpenRemoteSession/LaunchVMProcess failed, domain can't be started

As it wasn't working I also tried other options, but unfortunately, using all other graphic type options (except for 'spice', which I didn't try) the GUI is launched.

I don't think I'll be needing a RDP connection, neither anything similar to that, except if these are necessary to basic management of the vm through virsh (start, stop, reboot, create and revert snapshots).
Isn't there one simple way to run a virtual machine domain headless without vnc, spice or rdp servers?
If not, which could be going wrong in my xml configuration?

To help understanding of my desired behavior, what I need is to do through virsh what can be done using

VBoxManage startvm THEDOMAIN --headless

or

VBoxHeadless startvm THEDOMAIN,

because will use other hypervisors in the future, so it is a critical thing to me.

Thanks in advance for the help,

Guilherme Santos