Re: RFC: Implement virDomainGetIPAddress()

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

 



[snip]
> I'm not entirely convinced was want to have this in our APIs, since the
> arp probing is not really a reliable basis for reporting guest IP details.
> In the near future there will be guest agents for QEMU which can report
> this information reliably and I think they're a better bet for any app
> which would want this information.
>
> Regards,
> Daniel

Hi Daniel,
I've been thinking about this a little more and maybe it would be nice
to implement some communication between libvirt and the agent as well.
This way the libvirt-based tools would be having track of the guest's IP
address and the API like  virDomainGetIPAddress() could be still a
useful name for this functionality. However the guest will be optional
AFAIK so that maybe some option to get the IP address using one of the
other methods (like arp, leases file or capturing packets) could still
be useful for the case the QEMU Guest Agent won't be running in the
guest. Like mentioned, those methods are not 100% reliable but adding at
least the option to support them would be a nice thing to have. This
could be passed to the function using the flags argument with default to
qemu guest agent. For instance, it could be using one or more of the
following constants:

#define VIR_DOMAIN_GUEST_AGENT                        0x10
#define VIR_DOMAIN_GET_IP_PCAP                           0x20
#define VIR_DOMAIN_GET_IP_DHCP_LEASES_FILE    0x40
#define VIR_DOMAIN_GET_IP_ARP                            0x80
#define VIR_DOMAIN_GET_IP_TRYALL                       
VIR_DOMAIN_GUEST_AGENT | VIR_DOMAIN_GET_IP_PCAP |
VIR_DOMAIN_GET_IP_DHCP_LEASES_FILE | VIR_DOMAIN_GET_IP_ARP

This could be run in the same order like mentioned here if specified all
of them (VIR_DOMAIN_GET_IP_TRYALL), i.e. to test first for agent
communication channel to ask for IP (this would be really nice), then
try to get the packets captured on domain boot (this is being remembered
somewhere IMHO), look to the DHCP leases file if DHCP is enabled and we
still don't have the IP address and try to look for the ARP record once
if all of above failed. If this last one fails too then we can return
some error value.

I find the option to expose the guest's IP address to libvirt very
useful since we would be this having information accessible from any
application/module that's using libvirt. The idea came to my mind when I
was thinking of guest management using php-virt-control. I don't want to
implement the whole VNC stack (although it would be a great experience
for me - no doubt about it ;-) ) to the libvirt-php however the user
won't be able to manage the guest at all if he/she doesn't know the IP
address for SSH connection. Of course, there's a workaround to connect
to VNC on a specified port and use VNC for this however what if remote
access to guest's VNC windows will be disabled ? This is the reason why
I think the option to get guest's IP address directly from libvirt would
be a very nice thing to have ;-)

Thanks,
Michal

> --
> |: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org              -o-             http://virt-manager.org :|
> |: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
> |: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

-- 
Michal Novotny <minovotn@xxxxxxxxxx>, RHCE, Red Hat
Virtualization | libvirt-php bindings | php-virt-control.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]