[libvirt] [libvirt-glib 28/37] Add GVirConfigInterfaceNetwork

Christophe Fergeau cfergeau at redhat.com
Tue Nov 15 18:14:57 UTC 2011


On Fri, Nov 11, 2011 at 08:27:48PM +0100, Marc-André Lureau wrote:
> On Thu, Nov 10, 2011 at 9:34 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> > Make GVirConfigInterface an abstract base class, and move the
> > actual code in subclasses. This will make handling of the various
> > types of network interfaces more understandable and more logical
> > with respect to the corresponding XML.
> 
> I am not really convince about this approach, it breaks a bit the
> mapping between objects and node. I will let someone else with more
> familiarity with the XML to discuss this patch. Otherwise it works as
> expected.

The various network interfaces XML descriptions have so many peculiarities
that I think it's the only sane way to handle this.
The documentation is at http://libvirt.org/formatdomain.html#elementsNICS ,
and as I read it it's really
"if the interface type is XXX, you can have a <target> node with this format,
a <mac> node, a <virtualport> node, if it's YYY then the <target> node as
this different format, and there is this <script> node that can be used,
and with type ZZZ you only have a <source> node"
If we try to handle all of this in a single class, it will be really easy
to generate non-sensical configs, and with no obvious way from the API to
guess what makes sense or not. Having separate classes make it much easier
to show which operations are useful/meaningful on what type of interface.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111115/3eef42c8/attachment-0001.sig>


More information about the libvir-list mailing list