Peter Krempa f1c9fed2ca virsh: snapshot: Don't validate schema of XML generated by 'virsh snapshot-create-as'
Commit 95f8e3237e5486f487324c6 which introduced XML schema validation
for snapshot XMLs always asserted the validation for the XML generated
by 'virsh snapshot-create-as' on the basis that it's libvirt-generated,
thus valid.

This unfortunately isn't true as users can influence certain bits of the
XML such as the disk image path which must be a full path. Thus if a
user tries to invoke virsh as:

 $ virsh snapshot-create-as upstream --diskspec vda,file=relative.qcow2
 error: XML document failed to validate against schema: Unable to validate doc against /path/to/domainsnapshot.rng
 Extra element disks in interleave
 Element domainsnapshot failed to validate content

They get a rather useless error from the libxml2 RNG validator.

With this fix applied, we get to the XML parser in libvirtd which has a
more reasonable error:

 $ virsh snapshot-create-as upstream --diskspec vda,file=relative.qcow2
 error: XML error: disk snapshot image path 'relative.qcow2' must be absolute

Instead users can force validation of the XML generated by 'virsh
snapshot-create-as' by passing the '--validate' flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-04-16 17:27:39 +02:00
..
2021-01-15 19:08:00 +00:00
2021-01-15 19:08:00 +00:00
2021-04-06 17:00:11 +02:00
2021-03-12 10:52:41 +01:00
2021-04-15 15:42:21 +02:00
2021-01-15 19:08:00 +00:00
2021-01-15 19:08:00 +00:00