Hello Stéphane,

On 2021-11-04 19:35, Stéphane Charette wrote:

    [...] 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.


The irony here (to me anyway) is that the XML file should be very easy to read and parse by machine.  Other than having a database, file formats like XML and JSON are meant to be used that way.

Yes, XML is machine parseable.

However, the XML files containing the VirtualBox VM registry and the VM configuration have by now evolved for about 17 years. Showing all kinds of human imperfection, i.e. various forms of misdesign which survived more or less long. The current XML parser code used in VirtualBox is supposed to understand config files back to VirtualBox 2.0 (covering 13 years).

If one wants to extract only very specific information (more or less just VM names and groups) then it is probably little effort, but a complete parser is much work (and due to our policy of upgrading the XML representation to a newer version only if a new feature is actually used one simply can't ignore the past).

VM groups were introduced with VirtualBox 4.2, and if one didn't actively use them then the attribute may not be there.

If Bernard decides to go for XML parsing it could be actually much less effort than picking the few needed bits of information from the output of VBoxManage. At the same time efficient and a good chance to be future proof since the attributes needed are in very stable areas of the XML. Of course there are details to take care of (like finding VirtualBox.xml for VirtualBox installs which existed for a long time, before it moved to the .config/VirtualBox directory and how to interpret relative paths for machine config files (relevant if someone kept his VM organization from the old days when we didn't have per-VM subdirectories).

Klaus

Stéphane

--
<https://urldefense.com/v3/__https://about.me/stephane.charette?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=edit_panel&utm_content=thumb__;!!ACWV5N9M2RV99hQ!cYeC1vEy0fSyFXVLMHZJc4T_R-y1OeEwmzeM_D8ZcCeuguT8YtgcxYDaMERoJlQb_hNn$>
Stéphane Charette
about.me/stephane.charette <https://urldefense.com/v3/__https://about.me/stephane.charette?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=edit_panel&utm_content=thumb__;!!ACWV5N9M2RV99hQ!cYeC1vEy0fSyFXVLMHZJc4T_R-y1OeEwmzeM_D8ZcCeuguT8YtgcxYDaMERoJlQb_hNn$>
_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to