[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 0/7] Introduce API for dumping domain IP addresses

On 06/08/2012 04:04 PM, Michal Privoznik wrote:
This feature has been requested for a very long time. However,
I'm very glad to see this patch :-)
we had to wait for guest agent to obtain reliable results as
Yeah, it's a good way to get guest IP by GA, the disadvantage is we have to depend on GA installation the guest, sometimes, it probably is a trouble thing, for example, I use virt-v2v to convert a existing ESX VM into libvirt then the ESX VM impossible had GA installation ago, if I want to automate to finish all of stuff, but I don't know VM IP address, so I can't automatically install GA in the converted VM, it may be a special case for you.

However, 'tcpdump' or 'nmap' can do the same thing without GA installation in the guest, maybe, we may have optional solution for how to get guest IP, of course, it's just my idea.
user might create totally different structure of interfaces than
seen from outside (e.g. bonding, virtual interfaces, etc.).
That's the main reason why sniffing for domain traffic can
return bogus results. Fortunately, qemu guest agent implement
requested part for a while so nothing holds us back anymore.

To make matters worse, guest OS can assign whatever name to
an interface and changing MAC inside guest isn't propagated
to the host which in the end see original one.

Therefore, finding correlation between interface within guest
and the host side end is left as exercise for mgmt applications.

This API is called virDomainInterfacesAddresses (okay, maybe
too many plurals) and returns a dynamically allocated array
of virDomainInterface struct. The great disadvantage once
this gets released, it's written in stone and we cannot change
or add an item into it. Therefore we might add a padding into
it - something like reserved for future use. On the other hand,
everything important is already there - what else we will want
to add? :)

There are basically two approaches:
1) two APIs: one for list interfaces names, the other for querying
    addresses on singe interface

2) one API that returns everything

I've chosen the latter as it's race free (query for interface that
has gone meanwhile).

Michal Privoznik (7):
   Introduce virDomainInterfacesAddresses API
   virsh: Expose virDomainInterfacesAddresses
   qemu_agent: Implement 'guest-network-get-interfaces' command handling
   qemu: Implement virDomainInterfacesAddresses
   remote: Implement virDomainInterfacesAddresses
   python: Expose virDomainInterfacesAddresses
   python: create example for dumping domain IP addresses

  daemon/remote.c                 |  122 ++++++++++++++++++++++++++++++
  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 |    6 ++
  python/libvirt-override.c       |  116 ++++++++++++++++++++++++++++
  src/driver.h                    |    6 ++
  src/libvirt.c                   |  101 +++++++++++++++++++++++++
  src/libvirt_public.syms         |    5 +
  src/qemu/qemu_agent.c           |  158 +++++++++++++++++++++++++++++++++++++++
  src/qemu/qemu_agent.h           |    4 +
  src/qemu/qemu_driver.c          |   76 +++++++++++++++++++
  src/remote/remote_driver.c      |   95 +++++++++++++++++++++++
  src/remote/remote_protocol.x    |   25 ++++++-
  tools/virsh.c                   |   92 +++++++++++++++++++++++
  tools/virsh.pod                 |   10 +++
  18 files changed, 900 insertions(+), 2 deletions(-)
  create mode 100644 examples/python/domipaddrs.py

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]