On Fri, Jun 19, 2009 at 06:16:20PM +0100, Daniel P. Berrange wrote:
On Fri, Jun 19, 2009 at 07:05:23PM +0200, Daniel Veillard wrote:
> > Of course, you could actually have a hybrid of 7/8, where some vlans
> > where bridged, and others direct endpoints. That's trivally handled
> > there of course.
>
> Hum, since an XML can only have one single root, I suggest to put a
> wrapper around multiple definitions and if you call it <interfaces>
> that looks a bit like my own proposal but more recursive.
Sorry, I didn't explain this bit enough. In the last 4 cases where
there are multiple <inteface> end-points, each of those example docs
would correspond to a separate virInterfacePtr object. so there is
no need for a <intefaces> wrapper around them all. eg in
example 8, you would do
There is no need to define all 3 at once, since it is fine for 'bond'
to exist at any time before vlan1/vlan2 come along. In fact it is critical,
since you will likely add/remove vlans on the fly at any time
A top level <interfaces> would not prevent from calling the API
multiple times. But the cleanup I suggested of separating declarations
of interfaces from their reuse in other blocks would make the XML
regular, as in you know that <interface> at level 0 or 1 would be a
definition, and the other ones would be links (which are defined in
XML as ID/IDREF mechanism)
http://www.w3.org/TR/REC-xml/#id
http://www.w3.org/TR/REC-xml/#idref
that could be trivially validated either directly by the RelaxNG in
case of complete dumps.
The user may be interested in getting full dumps of its network setup
and not N pieces so I think the format makes sense at the API level too.
An user could make a full dump of its networking setup and validate in
one pass or check for more subtle construct problems.
Sorry if this is a bit different from what you had in mind, it doesn't
prevent your scenario, allows IMHO to clarify the XML format quite a bit
and provides a format and API which can be useful to users.
I will note that in general it's way easier to manipulate complete XML
document than a set of fractional pieces, things like APIs and
processing can be greatly simplified one concrete example being that you
can just pipe one document though a file descriptor, but piping a series
of document usually gets nasty.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/