[virt-tools-list] [virt-manager] [RFC] About showing domain interfaces's ip address in details page
Cole Robinson
crobinso at redhat.com
Wed Aug 8 14:43:11 UTC 2018
On 08/06/2018 08:10 AM, Lin Ma wrote:
> Hi all,
>
> I want to write patches to show ip addresses in virt-manager, I post
> the idea here to get some suggestions and ideas. The below are my
> thoughts.
>
> I'd like to define a function in class vmmDomain in
> virtManager/domain.py. The function name is 'interface_addresses', It
> has one parameter which name is 'source', The range of the
> parameter's value is:
> libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE or
> libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT or
> libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP
>
> In the function, it calls _backend.interfaceAddresses to get domain
> interfaces's ip addresses.
>
Makes sense so far.
Though I wish libvirt had a smarter 'hey just give me the iface address'
flag that tried best effort to cycle through the methods, skipping the
ones it knows aren't relevant
> I'd like to add a button in domain interface page of details page.
> The click handler calls function interface_addresses to get domain
> interfaces's whole ip information dictionary, then parses the result,
> only outputs the ipv4 address which matching the mac.
>
> Is it necessary for showing ipv6 address as well?
>
If it's there, then yeah I think we should show it, as long as its not a
link local address (fe80:...)
>
> About the way to obtaining ip information: * If the type of the
> domain's interface is 'network', The preferred function
> interface_addresses's parameter is source=lease, If it doesn't return
> information by some reasons, say static ip settings in domain, Then
> we will fallback to call interface_addresses with source=agent, if
> the result is still negative, then fallback to source=arp.
>
> * If the type of domain's interface is not 'network', - If the domain
> doesn't have org.qemu.guest_agent.0 channel, we will try source=arp
> only, And add a GtkImage with tooltip text to suggest users to add a
> org.qemu.guest_agent.0 channel.
I wouldn't bother with the image+tooltip. Most VMs if created correctly
should have the guest agent connected, trying to describe how to set it
up is non-trivial especially if its a windows VM or the agent isn't
installed in the VM. If it's an actual pain point in practice we can
revisit this but let's wait for real user complaints
- if it has org.qemu.guest_agent.0
> channel but the channel's state isn't connected, we will try
> source=arp only, And add a GtkImage with tooltip text to remind
> users to install qemu guest agent package inside domain. _ if it has
> org.qemu.guest_agent.0 channel and the channel's state is connected
> (see commit 4484f47), We will try source=agent only.
>
> Probably I missed some thing, Any suggestions will be much
> appreciated.
>
Sounds pretty good to me. The issue I've always had with thinking about
exposing the IP address is how to do it in a performant way, since we
can't poll it for it all the time. Requiring the user to manually press
a 'refresh' style button is a good way to side step the problem for now,
and we can make it smarter later if desired.
There was also a bit of discussion and some patches in the past, though
they have a different focus. At least it's something to look at:
https://www.redhat.com/archives/virt-tools-list/2018-March/msg00008.html
Thanks,
Cole
More information about the virt-tools-list
mailing list