[libvirt] [PATCH 0/7] Introduce API for dumping domain IP addresses

Dave Allan dallan at redhat.com
Fri Jun 8 13:26:35 UTC 2012


On Fri, Jun 08, 2012 at 10:04:31AM +0200, Michal Privoznik wrote:
> This feature has been requested for a very long time. However,
> we had to wait for guest agent to obtain reliable results as
> user might create totally different structure of interfaces than
> seen from outside (e.g. bonding, virtual interfaces, etc.).
> That's the main reason why sniffing for domain traffic can
> return bogus results. Fortunately, qemu guest agent implement
> requested part for a while so nothing holds us back anymore.
> 
> To make matters worse, guest OS can assign whatever name to
> an interface and changing MAC inside guest isn't propagated
> to the host which in the end see original one.
> 
> Therefore, finding correlation between interface within guest
> and the host side end is left as exercise for mgmt applications.
> 
> This API is called virDomainInterfacesAddresses (okay, maybe
> too many plurals) and returns a dynamically allocated array
> of virDomainInterface struct. The great disadvantage once
> this gets released, it's written in stone and we cannot change
> or add an item into it. Therefore we might add a padding into
> it - something like reserved for future use. On the other hand,
> everything important is already there - what else we will want
> to add? :)

How about returning an XML document instead of a struct?  We've been
burned by structs in the past...

> There are basically two approaches:
> 1) two APIs: one for list interfaces names, the other for querying
>    addresses on singe interface
> 
> 2) one API that returns everything
> 
> I've chosen the latter as it's race free (query for interface that
> has gone meanwhile).
> 
> Michal Privoznik (7):
>   Introduce virDomainInterfacesAddresses API
>   virsh: Expose virDomainInterfacesAddresses
>   qemu_agent: Implement 'guest-network-get-interfaces' command handling
>   qemu: Implement virDomainInterfacesAddresses
>   remote: Implement virDomainInterfacesAddresses
>   python: Expose virDomainInterfacesAddresses
>   python: create example for dumping domain IP addresses
> 
>  daemon/remote.c                 |  122 ++++++++++++++++++++++++++++++
>  examples/python/Makefile.am     |    2 +-
>  examples/python/README          |    1 +
>  examples/python/domipaddrs.py   |   50 ++++++++++++
>  include/libvirt/libvirt.h.in    |   32 ++++++++
>  python/generator.py             |    1 +
>  python/libvirt-override-api.xml |    6 ++
>  python/libvirt-override.c       |  116 ++++++++++++++++++++++++++++
>  src/driver.h                    |    6 ++
>  src/libvirt.c                   |  101 +++++++++++++++++++++++++
>  src/libvirt_public.syms         |    5 +
>  src/qemu/qemu_agent.c           |  158 +++++++++++++++++++++++++++++++++++++++
>  src/qemu/qemu_agent.h           |    4 +
>  src/qemu/qemu_driver.c          |   76 +++++++++++++++++++
>  src/remote/remote_driver.c      |   95 +++++++++++++++++++++++
>  src/remote/remote_protocol.x    |   25 ++++++-
>  tools/virsh.c                   |   92 +++++++++++++++++++++++
>  tools/virsh.pod                 |   10 +++
>  18 files changed, 900 insertions(+), 2 deletions(-)
>  create mode 100644 examples/python/domipaddrs.py
> 
> -- 
> 1.7.8.5
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list