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.redhat.com/archives/libvir-list/2012-February/msg00437.html
A patch was submitted, using structs:
https://www.redhat.com/archives/libvir-list/2012-June/msg00220.html
Another patch was submitted, using XML:
https://www.redhat.com/archives/libvir-list/2012-June/msg00904.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:
https://www.redhat.com/archives/libvir-list/2013-July/msg00084.html
The idea of extensibility was rejected and rendered out of scope of
libvirt. Hence, we were back to structs.
This API is called virDomainInterfaceAddresses 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)
v6:
* Inclusion of flags, readonly check for guest agent connection
* Correction of memory leaks, other small nits.
v5:
* s/virDomainInterfacesAddresses/virDomainInterfaceAddresses.
* Case for IP aliasing handled using virHashTable.
* New test cases added, involving multiple and 0 IP addresse(s)
per interface.
* IP prefix changed from int to unsigned int.
* Changes to practice libvirt habits.
*
https://www.redhat.com/archives/libvir-list/2013-September/msg00003.html
v4:
* Various style nits, indentation errors, memory leaks fixed.
*
https://www.redhat.com/archives/libvir-list/2013-August/msg01265.html
v3:
* Upper bounds to number of interfaces and addresses per interface
introduced.
* Change from array of structs to array of pointers
* ifaces_count moved from function argument to return value
* Changes in variable names
* Test cases added for qemuAgentGetInterfaces.
*
https://www.redhat.com/archives/libvir-list/2013-August/msg01215.html
v2:
* Logical errors, memory leaks and few other errors fixed.
*
https://www.redhat.com/archives/libvir-list/2013-August/msg00631.html
v1:
*
http://www.redhat.com/archives/libvir-list/2013-July/msg01553.html
Nehal J Wani (5):
domifaddr: Implement the public APIs
domifaddr: Implement the remote protocol
domifaddr: Implement the API for qemu
domifaddr: Add virsh support
domifaddr: Expose python binding
daemon/remote.c | 130 ++++++++++++++++++++++++++
examples/python/Makefile.am | 2 +-
examples/python/README | 1 +
examples/python/domipaddrs.py | 56 +++++++++++
include/libvirt/libvirt.h.in | 38 ++++++++
python/generator.py | 3 +
python/libvirt-override-api.xml | 8 +-
python/libvirt-override.c | 102 ++++++++++++++++++++
src/driver.h | 6 ++
src/libvirt.c | 135 +++++++++++++++++++++++++++
src/libvirt_public.syms | 6 ++
src/qemu/qemu_agent.c | 201 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_agent.h | 3 +
src/qemu/qemu_driver.c | 76 +++++++++++++++
src/remote/remote_driver.c | 99 ++++++++++++++++++++
src/remote/remote_protocol.x | 40 +++++++-
src/remote_protocol-structs | 24 +++++
tests/qemuagenttest.c | 188 +++++++++++++++++++++++++++++++++++++
tools/virsh-domain-monitor.c | 131 ++++++++++++++++++++++++++
tools/virsh.pod | 18 ++++
20 files changed, 1264 insertions(+), 3 deletions(-)
create mode 100755 examples/python/domipaddrs.py
--
1.7.11.7