On Mon 16 May 2022, 14:32 Michal Prívozník, <mprivozn@redhat.com> wrote:
On 5/16/22 14:52, Darragh Bailey wrote:

> So perhaps this is less a bug with the loader/nvram XML element handling
> and more a documentation bug and a possible enhancement that possibly
> the virDomainDefineXMLFlags could consider accepting a flag to verify the
> returned domain XML is equivalent as a general fix for those applications
> that would find this useful?

Yes to the first part, but no the second. Comparing XMLs is not as easy
as you would think. For instance:

<domain id='1' type='kvm'>
  <uuid>123456</uuid>
  <name>myGuest</name>
</domain>

<domain type='kvm' id='1'>
  <name>myGuest</uuid>
  <uuid>123456</uuid>
</domain>

The former is just an example of possible user input, the latter is how
libvirt would format it. Obviously, these XMLs are equivalent, but not
stcmp() equal.

I'm familiar with the fun of checking for equivalence, I was hoping that as libvirt was working with XML it might already be using a library that could handle this. A quick look at libxml2 suggests it's been left up to the consumer to implement.

So each project that becomes aware of this behaviour will have to find a library to do the comparison or implement it directly themselves.
--
Darragh Bailey