[virt-tools-list] [virt-manager] [RFC] About showing domain interfaces's ip address in details page

Lin Ma lma at suse.com
Mon Aug 6 12:10:15 UTC 2018


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.

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?


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.
   - 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.

Thanks,
Lin




More information about the virt-tools-list mailing list