
On Fri, May 13, 2011 at 02:42:29PM +0100, Daniel P. Berrange wrote:
There are two common problems with virsh edit & friends
- Invalid XML syntax, causes error report & lost changes - User add unsupported/unknown XML attributes/elements which are silently discarded by libvirt
This patch only fixes the first problem. It would be nice to fix the second two, by running the XML through the RNG schema validator.
Rather than do this in virsh though, I'd add some flags to the virXXXXDefine/Create APIs, eg
VIR_DOMAIN_XML_VALIDATE
virsh can set this flag by default, and if the XML fails validation, it could prompt the user, asking if they want to proceed anyway (in which case recall the same API but without the validate flag set), or re-edit the XML
Hum, yes I agree with the option of validating on define of APIs the only problem is that we tend to have holes in the RNG, but since that would be optional I think that's okay, this would hopefully help finding the mismatches between the RNG and the C parsing code. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/