[vbox-dev] VB xml format

Klaus Espenlaub klaus.espenlaub at oracle.com
Thu Nov 4 18:03:11 UTC 2021

Hi Bernard,

On 2021-11-04 09:11, Bernard Giannetti wrote:
> Hi Stéphane, fth0, Klaus,
> Thanks for your responses.  I have done some digging/reading...
> Looking at
> https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp 
> and the functions prefixToString() and optionToString(), I see the 
> characters that define group and machine, but there are some other 
> characters which don't make sense...but that I don't believe affects 
> my situation.  That 'gc' and 'go' both refer to groups, that fixes my 
> immediate issue.
> Longer term, I will ditch parsing the XML configuration file as this 
> is chasing my tail at best!  After some investigation, I believe I can 
> use:
>     VBoxManage list vms --long
> to give me each machine's name, UUID and group.  Hopefully this works 
> as expected as this is preferable to calling the API via a COM wrapper 
> or the web server interface.

My recommendation would be using the Python API bindings since that's 
rather convenient, balancing flexibility with pretty limited impact from 
API changes (that said, the Python API bindings may not be available in 
a certain VirtualBox installation, depending on how annoying the support 
of a specific Linux distro's Python 2/3 migration strategy is).

If you insist using "VBoxManage" (one of the main source of useless 
error reports e.g. from Vagrant fans) then I would at least hope you go 
for an approach which will be a little more reliable ("VBoxManage list 
vms --long" produces human readable output, i.e. it can change 
relatively arbitrarily): go for a two-stage approach. First get the list 
of VM UUIDs with "VBoxManage list vms", and then get the detail 
information you need with "VBoxManage showvminfo uuid 
--machinereadable". The output of the latter should be a lot easier to 
process. It is kind of a list of shell variables (anything with an all 
lowercase name is the associated VBoxManage modifyvm option name, 
anything mixed case has no direct correspondence), with string values 
possibly containing spaces in "".

In principle this could be also offered with "VBoxManage list vms 
--long", but so far no one has thought of this and therefore it wouldn't 
work for existing VirtualBox releases.


> Thanks again for the help,
> Bernard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20211104/cfefed51/attachment.html>

More information about the vbox-dev mailing list