[libvirt] [Fwd: first cut public API for physical host interface configuration]

Daniel P. Berrange berrange at redhat.com
Mon Mar 30 11:40:31 UTC 2009


On Fri, Mar 27, 2009 at 12:58:44PM -0400, Laine Stump wrote:
> To summarize (correct anything I've gotten wrong):
> 
> 1) Supporting transient interfaces would be nice, but would require too 
> much re-implementation of ifup-type scripts in our code (and for every 
> platorm), so it is out of scope. danpb thinks at least being able to 
> query transient interfaces (those that exist, but have no ifcfg-* file) 
> would be nice. (Since libnetcf currently does everything by reading the 
> ifcfg-* files and converting them into XML, that would require some work).

Well you'll need to be able to query  live interfaces anyway, because
you'll need to be able to report IPv4 addresses assigned by DHCP and
report IPv6 addresses that auto-configure themselves. So given that you
have to do this, the ability to present info on existing transient
interfaces should more or less come for free.

> 2) Just querying by name isn't good enough, but using UUID creates extra 
> complexity. The problem can also solved by querying with MAC address. 
> I'll add in the appropriate functions.
> 
> 3) For consistency, virInterfaceStart() should be renamed to 
> virInterfaceCreate(), and virInterfaceStop() to either 
> virInterfaceDestroy() or virInterfaceDelete() (I still like Startp/Stop, 
> since htey imply that the objects can be re-used, but The idea of a less 
> polluted namespace has its advantages). So which

To 'Destroy', since 'Delete' is really what 'Undefine' is providing.

> 4) virInterfaceDefineXML(), virInterfaceCreate(), and 
> virInterfaceHumiliateAndEmasculate() (pending a concensus on name) 
> should have a "flags" argument added, currently unused, but to allow for 
> future expansion without needing to obsolete the API.

Yep,

> 5) For bonus points, danpb suggests adding:
> 
>   int virInterfaceStats (virInterfacePtr interface,
>                          virInterfaceStatsPtr stats,
>                          size_t size);
> 
> Useful idea, but I'll save the bonus points for later - right now I'm 
> just trying to avoid getting kicked off the island! (seriously, though, 
> that is outside the current scope of libnetcf. Depending on what stats 
> you wanted, it could be implemented on linux by just sifting through 
> /proc/net/dev. Are you just looking for the same stats that are 
> delivered by virDomainInterfaceStats (except for the physical host)?

Yes, you should be able to re-use the interface impl of virDomainInterfaceStats()
that already exists, just passing in the appropriate ethXXX device name. All
the hard logic thre is already done 

> +virInterfacePtr         virInterfaceLookupByMAC   (virConnectPtr conn,
> +                                                   const unsigned char *mac);

> +int                     virInterfaceGetMAC        (virInterfacePtr interface,
> +                                                   unsigned char *mac);


For these two, we should probably also have an equivalent String method

  virInterfacePtr         virInterfaceLookupByMACString(virConnectPtr conn,
                                                        const char *mac);

  int                     virInterfaceGetMACString  (virInterfacePtr interface,
                                                     char *mac);


In the same was as we have UUID and UUIDString, because some apps may
prefer to pass/fetch the raw unsigned bytes of the MAC addr, while
others may have the MAC in human readable format

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list