
On 21.06.2012 15:55, 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 virDomainGetInterfacesAddresses (okay, maybe too many plurals) and returns a XML document containing all interesting data.
diff to v1: -switch from struct to XML doc
Michal Privoznik (5): Introduce virDomainGetInterfacesAddresses API virsh: Expose virDomainGetInterfacesAddresses qemu_agent: Implement 'guest-network-get-interfaces' command handling qemu: Implement virDomainInterfacesAddresses python: create example for dumping domain IP addresses
docs/schemas/interfaces.rng | 57 +++++++++++++++++ examples/python/Makefile.am | 2 +- examples/python/README | 1 + examples/python/domipaddrs.py | 62 +++++++++++++++++++ include/libvirt/libvirt.h.in | 2 + src/driver.h | 4 + src/libvirt.c | 49 +++++++++++++++ src/libvirt_public.syms | 1 + src/qemu/qemu_agent.c | 135 +++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_agent.h | 2 + src/qemu/qemu_driver.c | 68 +++++++++++++++++++++ src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 12 +++- src/remote_protocol-structs | 8 +++ tools/virsh.c | 41 ++++++++++++ tools/virsh.pod | 9 +++ 16 files changed, 452 insertions(+), 2 deletions(-) create mode 100644 docs/schemas/interfaces.rng create mode 100644 examples/python/domipaddrs.py
Ping? So do we have a consensus on this? The first version expose guest IP via public struct, while this one returns an XML doc. Which one should we prefer?