[libvirt] [PATCHv7 0/4] Introduce API to query IP addresses for given domain

Nehal J Wani nehaljw.kkd1 at gmail.com
Wed Dec 17 00:16:19 UTC 2014

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:
A patch was submitted, using structs:
Another patch was submitted, using XML:

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:

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 virsh CLI 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)

* Enable support for DHCP lease file parsing method

* Inclusion of flags, readonly check for guest agent connection
* Correction of memory leaks, other small nits.
* https://www.redhat.com/archives/libvir-list/2013-September/msg00350.html

* 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

* Various style nits, indentation errors, memory leaks fixed.
* https://www.redhat.com/archives/libvir-list/2013-August/msg01265.html

* Upper bounds to number of interfaces and addresses per interface
* 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

* Logical errors, memory leaks and few other errors fixed.
* https://www.redhat.com/archives/libvir-list/2013-August/msg00631.html

* http://www.redhat.com/archives/libvir-list/2013-July/msg01553.html

Nehal J Wani (4):
  domifaddr: Implement the public APIs
  domifaddr: Implement the remote protocol
  domifaddr: Implement the API for qemu
  domifaddr: Add virsh support

 daemon/remote.c                  |  134 +++++++++++++++++++++++++
 include/libvirt/libvirt-domain.h |   27 +++++
 src/driver-hypervisor.h          |    5 +
 src/libvirt-domain.c             |  129 ++++++++++++++++++++++++
 src/libvirt_public.syms          |    2 +
 src/qemu/qemu_agent.c            |  202 ++++++++++++++++++++++++++++++++++++++
 src/qemu/qemu_agent.h            |    4 +
 src/qemu/qemu_driver.c           |  153 +++++++++++++++++++++++++++++
 src/remote/remote_driver.c       |  100 +++++++++++++++++++
 src/remote/remote_protocol.x     |   42 +++++++-
 src/remote_protocol-structs      |   24 +++++
 tests/qemuagenttest.c            |  188 +++++++++++++++++++++++++++++++++++
 tools/virsh-domain-monitor.c     |  141 ++++++++++++++++++++++++++
 tools/virsh.pod                  |   16 +++
 14 files changed, 1166 insertions(+), 1 deletion(-)


More information about the libvir-list mailing list