On 09/18/2013 09:43 AM, Daniel P. Berrange wrote:
>
> In fact, I'd love to have 'virsh edit' and friends take advantage of
> normalization. Right now, if you run 'virsh edit' and type in something
> that libvirt doesn't recognize, it gets silently discarded; but if we
> add normalization into the mix and do a strcmp of the xml before the
> user's edits and after the normalization of the edits, we can more
> easily warn the user that not all their edits can be honored, and give
> them a chance to try again.
That's a job for RNG schema validation IMHO. Round-tripping XML and
doing a strcmp is really poor-mans schema validation.
Okay, but then see my comment on 3/8 that we should have one of the
'flags' values be supported for additionally requesting programmatic RNG
validation as part of the normalization efforts. Seen in that light,
'virsh edit' should not do a strcmp of the round trip, but should
instead use the 'RNG_VALIDATE' flag - and can then alert the user to any
situation where the domain is invalid because of unknown elements.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org