[vbox-dev] Wish for the future: XML
Klaus.Espenlaub at Sun.COM
Tue Oct 13 07:48:43 PDT 2009
Thanks for the background, it's much clearer now.
Jonas Mellin wrote:
> Klaus Espenlaub wrote:
>> Jonas Mellin wrote:
>>> I would appreciate output in XML format from VBoxManage command since I
>>> am on a university and want to automate installation for my students to
>>> reduce their problems. It is, of course, perfectly possible to parse the
>>> output, BUT it would be simpled in XML. For a starter, the information
>>> commands could be added with an XML option. In the second step, it would
>>> be useful to enable packaging of error messages in XML as well.
>> Sorry, but I don't get the novelty of idea apparently - what you
>> describe as "automate installation" sounds like a reinvention of the
>> OVF export/import feature (which is an XML based file format btw.).
>> Which is already supported by VBoxManage.
> I do not want the disk to be part of the appliance, but added as a
> centralized immutable disk from which the student run difference disks.
> Further, the configuration is dependent on the hardware, which may be
> varying. For example, the number of processor available in each target
> may vary. Obviously, it is possible to have one export for each possible
> configuration, but it is difficult to foresee all possibilities. So, the
> import/export was considered as an option, but it did not work out for
> me. If I misunderstood the possibilities of the export/import, then
> please tell me how to do this.
In this kind of situation VBoxManage is certainly the right tool. OVF
import/export right now is best for transferring a specific
configuration (including the image). We plan to make the handling of
disks more flexible, but from your description that might still be too
>> And for the other bits - VBoxManage is meant for simple configuration
>> and management tasks. As an intermediate level between VBoxManage and
>> fully custom code which uses the VirtualBox API you can use
>> vboxshell.py. If you want to achieve something more complex and/or
>> want to have better control over what's going on, there's the
>> VirtualBox SDK. You can call the (XP)COM API from several languages
>> (C/C++/python), and the webservice (WSDL) API from pretty much any
>> noteworthy language.
> The problem is that I do not know if python is available on the target
> and if they want to install it. The target is mostly Windows XP with
> Ubuntu with RTPREEMPT patched kernel (2.26.....) Of course, I could add
> the necessity to install python, but I want a simple process: "Run this
> program and wait". From my point of view, it is simpler to automate
> using VBoxManage via available script languages than to add automatic
> installation of python in case it is missing. If VBoxManage could output
> information in XML format, it would be simpler to process.
VBoxManage can output information (not all of it, but certainly some
interesting parts) in a machine readable format. See "VBoxManage
showvminfo VMNAME --machinereadable".
We don't guarantee that this option will survive in the long run, as
it's hard to maintain, and makes the code pretty unreadable.
> I looked into the SDK and opted for scripting by using vboxmanage rather
> than developing, for example, a C++ program using the SDK. It was too
> much an effort compared to what I wanted.
Agreed. Your scenario is not about complicated management, you just need
some scripted updating etc.
>> Don't get me wrong, I'm not against improvements, I'm just having a
>> bit of difficulty to get the full understanding of your ideas out of
>> the 6 lines outline. Note that VirtualBox is open source, so you could
>> prototype/contribute your idea.
> I tried to explain it in more detail above. Essentially, if vboxmanage
> could output information in XML format, it would be easier to write
> scripts in other script languages other than python without providing a
> specific interface to each possible language.
Since I had the pleasue to implement the above --machinereadable option
some time ago, I don't really agree. Supporting several output formats
means lots of code duplication. I haven't seen any library which would
allow to deal with vastly different formats in a fashion which is easy
to maintain, but I don't claim expert knowledge in this area.
> I might prototype it, since it is not a major change.
Note that libxml2 is already available in the VirtualBox runtime, so you
don't have to worry much about xml as long as this library suits your needs.
More information about the vbox-dev