[PATCH 18/21] tests: vmx: Make paths in test files conform with the XML schema

Martin Kletzander mkletzan at redhat.com
Thu Oct 8 08:57:52 UTC 2020

On Thu, Oct 08, 2020 at 10:26:43AM +0200, Peter Krempa wrote:
>On Thu, Oct 08, 2020 at 10:17:22 +0200, Pino Toscano wrote:
>> On Thursday, 8 October 2020 09:55:32 CEST Peter Krempa wrote:
>> > The vmx tests use fake paths for files which in some cases didn't start
>> > with a /. Since libvirt's schema mandates full paths and the
>> > representation used in the tests is only internal to the tests we'll add
>> > a leading / to the paths to conform to the schema.
>> >
>> > Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>> > ---
>> > diff --git a/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
>> > index 7cb6413941..97fa300c18 100644
>> > --- a/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
>> > +++ b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
>> > @@ -16,7 +16,7 @@
>> >    <on_crash>destroy</on_crash>
>> >    <devices>
>> >      <disk type='file' device='disk'>
>> > -      <source file='[datastore] directory/FEDORA11.VMDK'/>
>> > +      <source file='/[datastore] directory/FEDORA11.VMDK'/>
>> The real XMLs of VMware guests have disks paths like
>> '[datastore] path/to/file.vmx'. The proposed change will make these
>> XMLs unusable as real XMLs, and some of them were actually real XMLs.
>> Even if these files are just tests, I don't think this is correct to
>> make them different than real XMLs.
>> If the schema does not support file='[datastore] path/to/file.vmx',
>> IMHO that's the schema itself what needs to be fixed, not example/test
>> XMLs...
>Okay that's extremely weird then. I must say I looked into the real
>parser since for some reason we have a separate implementation in the
>tests (also weird) but didn't notice that this was done also for real
>The real question then is. Why didn't anybody complain yet?!? The schema
>mandating a leading slash is there amost forever so vmware XMLs must
>have been invalid for all that time.

My guess is because CreateXML is not used and for read access it cannot fail
because the XML is generated in libvirt and "sent" to the client/caller.

It could have probably been something like:

   <source datastore="ds1" file="/directory/file.ext"/>

but it's too late (and worthless IMNSHO) to do that now.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201008/d969f477/attachment-0001.sig>

More information about the libvir-list mailing list