[libvirt] [PATCH] virsh: Improve editing

Eric Blake eblake at redhat.com
Mon May 16 20:59:28 UTC 2011


On 05/16/2011 01:12 AM, Daniel Veillard wrote:
> 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.

There's also the idea of doing a round trip parse -> dumpxml -> compare;
but that also has problems where dumpxml sometimes rearranges elements
or populates backwards-compatibility additions that were not present in
the original.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110516/2a828e57/attachment-0001.sig>


More information about the libvir-list mailing list