On 03/03/2018 05:03 PM, Cole Robinson
wrote:
On 03/02/2018 01:27 AM, Dylan Stephano-Shachter wrote:I have added a feature to show a VM's first IP address next to the VM state (Running, etc.). This feature can be toggled in the preferences menu and is disabled by default. It uses the qemu-guest agent to query the IP address. Dylan Stephano-Shachter (2): show the first ip address of running vms add preferences option to enable 'show first ip'Thanks for the patches. Interesting idea. We are definitely overdue for exposing VM IP address somewhere in the UI It's kind of difficult to get the implementation right though. We try really hard to avoid repeated libvirt API calls in the code, because often we connect to libvirt over slow remote connections and too many API calls make the app sluggish. Ideally what we would do is cache this type of info at domain startup time, or first access, similarish to how we handle vmmDomain.get_domain_capabilities or vmmDomain.managedsave_supported. But this case is different since it's runtime state that can change, maybe the VM network goes down, or more likely we try to request info before the domain is fully up and network has been initialized. So I dunno, do we need a way to let the user request refreshing this info? I'd need to play with it. I think UI wise a simpler place to start to hash out some of these issues is to add an IP Address field to the VM details page for each particular network device. Possibly adding a small refresh button next to that field for the user to request fetching latest data. Those pages have less performance constraints than the manager window. I can help work out the details for this too if you come up with a first pass As for implementing this in the manager, one suggestion is that rather than extending Preferences, map the gsettings field to Manager->View->IP Address, following how the Graph options work. It could even add a new IP Address column, not sure offhand if that's better though Thanks, Cole I had to leave this be for a while as I was very busy but I would like to revisit it. I like your idea of a refresh button as the api call certainly can get expensive. In terms of putting it in the VM details page, I don't really think that makes sense. The main point of this is you don't have to open anything. If you are going to open the VM details and find the IP info, you might as well just open the VM and type ifconfig. I'll take a look at the graph code and see what I can come up with. I like the idea of a new column. I'd also like to show all the addresses if possible. I'm a bit of a noob when it comes to anything with a gui but I should be able to get something going.
Not sure if you can still test this, but I attached a script to dump the interfaces object. If you could run it with "./get-interfaces.py <vm-name>" that would be super helpful. |
#!/usr/bin/python3 import libvirt from pprint import pprint import sys def main(): vm_name = sys.argv[1] conn = libvirt.open('qemu:///system') dom = conn.lookupByName(vm_name) pprint(dom.interfaceAddresses(source=1)) if __name__ == '__main__': main()
_______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list