On Mon, Jan 26, 2015 at 12:08 AM, Nehal J Wani <nehaljw.kkd1@gmail.com> wrote:
This feature has been requested for a very long time. Since qemu guest
agent and leaseshelper give 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 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)

v8:
* qemuDomainInterfaceAddresses: redo logic related to flags
* Make sure that NIC(s) on guest is/are using libvirt virtual network
  before querying leaseshelper
* domifaddr: change --network option from VSH_OT_DATA to VSH_OT_STRING

v7:
* Enable support for DHCP lease file parsing method
* http://www.redhat.com/archives/libvir-list/2014-December/msg00866.html

v6:
* 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

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 (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          |   6 ++
 src/qemu/qemu_agent.c            | 202 +++++++++++++++++++++++++++++++++++++++
 src/qemu/qemu_agent.h            |   4 +
 src/qemu/qemu_driver.c           | 173 +++++++++++++++++++++++++++++++++
 src/remote/remote_driver.c       | 100 +++++++++++++++++++
 src/remote/remote_protocol.x     |  36 ++++++-
 src/remote_protocol-structs      |  24 +++++
 tests/qemuagenttest.c            | 188 ++++++++++++++++++++++++++++++++++++
 tools/virsh-domain-monitor.c     | 141 +++++++++++++++++++++++++++
 tools/virsh.pod                  |  16 ++++
 14 files changed, 1184 insertions(+), 1 deletion(-)

--
2.1.0


Ping! :)

--
Nehal J Wani