virxml: Avoid double indentation of <metadata/> element
virxml: Avoid double indentation of <metadata/> element

There was a recent change in libxml2 that caused a trouble for
us. To us, <metadata/> in domain or network XMLs are just opaque
value where management application can store whatever data it
finds fit. At XML parser/formatter level, we just make a copy of
the element during parsing and then format it back. For
formatting we use xmlNodeDump() which allows caller to specify
level of indentation. Previously, the indentation was not
applied onto the very first line, but as of v2.9.12-2-g85b1792e
libxml2 is applying indentation also on the first line.

This does not work well with out virBuffer because as soon as we
call virBufferAsprintf() to append <metadata/> element,
virBufferAsprintf() will apply another level of indentation.

Instead of version checking, let's skip any indentation added by
libxml2 before virBufferAsprintf() is called.

Note, the problem is only when telling xmlNodeDump() to use
indentation, i.e. level argument is not zero. Therefore,
virXMLNodeToString() which also calls xmlNodeDump() is safe as it
passes zero.

Tested-by: Bjoern Walk <40545c009452f40d2ae0bbfbd987b332d274d328@linux.ibm.com>
Signed-off-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>
Reviewed-by: Pavel Hrdina <d4772d05997b8abf035041e3b4f4996380ea7e7a@redhat.com>

olafhering/libvirt,nertpinx/libvirt,libvirt/libvirt,libvirt/libvirt,crobinso/libvirt,olafhering/libvirt,nertpinx/libvirt,jfehlig/libvirt,zippy2/libvirt,crobinso/libvirt,nertpinx/libvirt,olafhering/libvirt,jfehlig/libvirt,olafhering/libvirt,nertpinx/libvirt,crobinso/libvirt,jfehlig/libvirt,zippy2/libvirt,libvirt/libvirt,zippy2/libvirt,libvirt/libvirt,zippy2/libvirt,crobinso/libvirt,jfehlig/libvirt,nertpinx/libvirt