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)
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 | 33 +++++++++
python/generator.py | 3 +
python/libvirt-override-api.xml | 8 +-
python/libvirt-override.c | 114 +++++++++++++++++++++++++++++
src/driver.h | 6 ++
src/libvirt.c | 110 ++++++++++++++++++++++++++++
src/libvirt_public.syms | 6 ++
src/qemu/qemu_agent.c | 157 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_agent.h | 3 +
src/qemu/qemu_driver.c | 55 ++++++++++++++
src/remote/remote_driver.c | 87 ++++++++++++++++++++++
src/remote/remote_protocol.x | 41 ++++++++++-
src/remote_protocol-structs | 24 ++++++
tests/qemuagenttest.c | 90 ++++++++++++++++++++++-
tools/virsh-domain-monitor.c | 99 +++++++++++++++++++++++++
tools/virsh.pod | 10 +++
20 files changed, 1018 insertions(+), 4 deletions(-)
create mode 100755 examples/python/domipaddrs.py
--
1.7.11.7