This feature has been requested for a very long time. Since qemu guest
agent gives us reliable results, now the wait is over.
The RFC was first proposed by Michal Privoznik:
http://www.mail-archive.com/libvir-list@redhat.com/msg51857.html
A patch was submitted, using structs:
http://www.mail-archive.com/libvir-list@redhat.com/msg57141.html
Another patch was submitted, using XML:
http://www.mail-archive.com/libvir-list@redhat.com/msg57829.html
Neither of the patches were accepted, probably due to lack of extensibility
and usability. Hence, we thought of using virTypedParameters for reporting
list of interfaces along with their MAC address and IP addresses. The RFC
can be found here:
http://www.mail-archive.com/libvir-list@redhat.com/msg79793.html
The idea of extensibility was rejected and rendered out of scope of
libvirt. Hence, we were back to structs.
This API is called virDomainInterfacesAddresses which returns a dynamically
allocated array of virDomainInterface struct. The great disadvantage is
once this gets released, it's written in stone and we cannot change
or add an item into it.
The API supports two methods:
* Return information (list of all associated interfaces with MAC address
and IP addresses) of all of the domain interfaces by default (if
no interface name is provided)
* Return information for the specified interface (if an interface name
is provided)
The API queries qemu guest agent to obtain ip addresses and MAC address
of each interface the given domain is associated with. In the future,
support for more flags will be added to support for DHCP and snooping methods
nehaljwani (5):
domifaddr: Implement the public API
domifaddr: Implement the remote protocol
domifaddr: Implement the API for qemu
domifaddr: Add virsh support
domifaddr: Expose python binding
daemon/remote.c | 123 ++++++++++++++++++++++++++++++++
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 | 8 ++-
python/libvirt-override.c | 117 +++++++++++++++++++++++++++++++
src/driver.h | 7 ++
src/libvirt.c | 99 ++++++++++++++++++++++++++
src/libvirt_public.syms | 5 ++
src/qemu/qemu_agent.c | 150 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_agent.h | 4 ++
src/qemu/qemu_driver.c | 57 +++++++++++++++
src/remote/remote_driver.c | 93 +++++++++++++++++++++++++
src/remote/remote_protocol.x | 32 ++++++++-
src/remote_protocol-structs | 24 +++++++
tools/virsh-domain-monitor.c | 103 +++++++++++++++++++++++++++
tools/virsh.pod | 10 +++
19 files changed, 914 insertions(+), 4 deletions(-)
create mode 100755 examples/python/domipaddrs.py
--
1.7.11.7