GNOME Bugzilla – Bug 744004
Show IP of guest
Last modified: 2016-03-31 13:22:00 UTC
Would be useful to show IP of the guest in properties view.
(In reply to Zeeshan Ali (Khattak) from comment #0) Depends on: http://www.redhat.com/archives/libvir-list/2014-December/msg00866.html
(In reply to Fabiano Fidêncio from comment #1) > (In reply to Zeeshan Ali (Khattak) from comment #0) > > Depends on: > http://www.redhat.com/archives/libvir-list/2014-December/msg00866.html To fix it in a simple way, yes but we already have api to get the IP.
(In reply to Zeeshan Ali (Khattak) from comment #2) > (In reply to Fabiano Fidêncio from comment #1) > > (In reply to Zeeshan Ali (Khattak) from comment #0) > > > > Depends on: > > http://www.redhat.com/archives/libvir-list/2014-December/msg00866.html > > To fix it in a simple way, yes but we already have api to get the IP. In Boxex itself?
(In reply to Fabiano Fidêncio from comment #3) > (In reply to Zeeshan Ali (Khattak) from comment #2) > > (In reply to Fabiano Fidêncio from comment #1) > > > (In reply to Zeeshan Ali (Khattak) from comment #0) > > > > > > Depends on: > > > http://www.redhat.com/archives/libvir-list/2014-December/msg00866.html > > > > To fix it in a simple way, yes but we already have api to get the IP. > > In Boxex itself? No, in libvirt. Pretty indirect and requires connecting to system libvirt (which shouldn't be a problem since we already connect to that and read-only should be fine).
Feb 04 13:36:02 <zeenix> danpb: hi Feb 04 13:36:18 <zeenix> danpb: has the /var/lib/libvirt/dnsmasq/default.leases file been dropped by latest libvi rt? Feb 04 13:58:16 <danpb> zeenix: i dunno about dropped, but it might have changed location and will be in a different for mat now Feb 04 13:58:28 <danpb> because we took over responbility for leases from dnsmasq Feb 04 13:58:42 <danpb> so that we could wire up our new API for reporting assigned IP addresses Feb 04 14:02:48 <zeenix> ah ok Feb 04 14:02:54 <zeenix> API for that would be cool Feb 04 14:04:12 <zeenix> our tests are currently looking into that file for finding the ip of machine Feb 04 14:23:59 <danpb> zeenix: there's a virNetworkGetDHCPLeases; function your tests can use instead Feb 04 14:36:59 <zeenix> danpb: and there's a virsh command? Feb 04 14:41:21 <zeenix> thats what the tests use Feb 04 17:47:09 <zeenix> danpb: are you sure this api works for virbr0 network? Feb 04 17:47:38 <zeenix> danpb: virsh net-list doesn't list any networks Feb 04 17:47:57 <zeenix> even with --all Feb 04 17:57:58 <danpb> are you using the correct uri eg qemu:///system I didn't get to reply to danpb's last question but that was it, I needed to talk to system libvirt for this.
(In reply to Zeeshan Ali (Khattak) from comment #4) > (In reply to Fabiano Fidêncio from comment #3) > > (In reply to Zeeshan Ali (Khattak) from comment #2) > > > (In reply to Fabiano Fidêncio from comment #1) > > > > (In reply to Zeeshan Ali (Khattak) from comment #0) > > > > > > > > Depends on: > > > > http://www.redhat.com/archives/libvir-list/2014-December/msg00866.html > > > > > > To fix it in a simple way, yes but we already have api to get the IP. > > > > In Boxex itself? > > No, in libvirt. Pretty indirect and requires connecting to system libvirt > (which shouldn't be a problem since we already connect to that and read-only > should be fine). Nice. Do we have a design for this? Or can we just add it close to the "Network" label, as "Network (192.168.122.13)"? :-)
See https://bugzilla.gnome.org/show_bug.cgi?id=730789#c7 for current idea on how this will be implemented. Wondering if the IP should be shown in other contexts too: Overview (under the VM if it's running) and maybe also on the titlebar on guest's display?
(In reply to Zeeshan Ali (Khattak) from comment #7) > See https://bugzilla.gnome.org/show_bug.cgi?id=730789#c7 for current idea on > how this will be implemented. Wondering if the IP should be shown in other > contexts too: Overview (under the VM if it's running) and maybe also on the > titlebar on guest's display? When dealing with swarms of clients for a given service it'd be really nice to be able to check several VM's IPs from the overview.
Created attachment 306815 [details] [review] util-app: Add get_system_virt_connection() This moves creation of system libvirt connection to utils. We'll be starting to re-use the same connection for fetching the IP address of guests in a following patch. This also implies that this connection is never properly unrefed/freed. Keeping in mind that this instance was kept around for lifetime of Boxes already and that libvirt is fully capable of cleaning up after apps, this is not such a bad thing.
Created attachment 306816 [details] [review] Requite libvirt-glib >= 0.2.2 We'll need the new networking API in the following patches.
Created attachment 306817 [details] [review] util-app: Fetch networking info too On creating the libvirt system connection, also fetch info on networks managed by this connection along with domains. This will be needed by the following patches to get the IP address of guest.
Created attachment 306818 [details] [review] machine: Add virtual update_info() In commit b1aaa70, we consolidated the setting of 'info' to some extent by ensuring the this property is only set by LibvirtMachine.update_info(). This patch takes that effort further by making LibvirtMachine.update_info() a virtual method of the base Machine class. This also implies that Machine no longer keep the existing status string and instead of concatenating new strings, it simply overrides it. This is the right thing to do IMO since no critical information is kept in this property and so far we haven't had the need to keep two different pieces of information at the same time in it.
Created attachment 306819 [details] [review] machine: Async constructor In the following patch, we'll need to make async calls.
Created attachment 306820 [details] [review] libvirt-machine: Add get_ip_address() Add a method to fetch IP address of the machine. This is the IP of the running guest and you only get the IP if machine is using 'virbr0' bridge network, managed by system libvirt.
Created attachment 306821 [details] [review] libvirt-machine: IP as running machines' info Set info property of running machines to it's IP address (which translates to 2nd text line in the collection view under the thumbnail).
Created attachment 306822 [details] [review] libvirt-machine-props: Prefix for display props Prefix display props with "Display " to make the context clear for these properties.
Created attachment 306823 [details] [review] libvirt-machine-props: Show IP on 'General' page
Created attachment 306824 [details] [review] libvirt-machine: Async constructor In the following patch, we'll need to make async calls from LibvirtMachine constructor so let's make it async.
Created attachment 306825 [details] [review] libvirt-machine: Add get_ip_address() Add a method to fetch IP address of the machine. This is the IP of the running guest and you only get the IP if machine is using 'virbr0' bridge network, managed by system libvirt.
Created attachment 306826 [details] [review] libvirt-machine: IP as running machines' info Set info property of running machines to it's IP address (which translates to 2nd text line in the collection view under the thumbnail).
Created attachment 306827 [details] [review] libvirt-machine-props: Prefix for display props Prefix display props with "Display " to make the context clear for these properties.
Created attachment 306828 [details] [review] libvirt-machine-props: Show IP on 'General' page
With these patches, we show guest IP for running local libvirt-machines that are using libvirt's NAT/bridge network. Remote (spice & vnc) and Ovirt machines already show URL in the properties view. Showing remote machine's IP in collection view might be a good idea but not for remote VMs (ovirt and libvirt) since the guest IP would likely not be reachable and showing host's IP will likely be confusing.
Created attachment 306832 [details] [review] remote-machine: Server of URL as 'info' Set info property of remote machines to server part (hostname or IP address) of its URL. 'info' property is bound to 2nd text line in the collection view under the thumbnail.
Comment on attachment 306826 [details] [review] libvirt-machine: IP as running machines' info We had a meeting today with jimmac, aday and Kekun and we (designers mainly) decided that we shouldn't show IP in the main view (neither current icon view nor the wip list view) but rather provide a commandline utility to easy fetch IPs or running local VMs instead. Since the use case is mainly people wanting to connect (ssh) to the guest from commandline. For other use cases, they can simply copy&paste from properties.
Created attachment 307017 [details] [review] i-props-provider: String props should be selectable Some of the properties are mainly useful for copy&pasting (e.g if you want to ssh into a local box so you'll likely want to copy&paste it's IP address and you can't do that without being able to select it) so let's make them selectable.
Attachment 306815 [details] pushed as 76613f9 - util-app: Add get_system_virt_connection() Attachment 306816 [details] pushed as 923ede1 - Requite libvirt-glib >= 0.2.2 Attachment 306817 [details] pushed as 01fe2ac - util-app: Fetch networking info too Attachment 306818 [details] pushed as e7397d9 - machine: Add virtual update_info() Attachment 306824 [details] pushed as 56f3228 - libvirt-machine: Async constructor Attachment 306825 [details] pushed as 77694c5 - libvirt-machine: Add get_ip_address() Attachment 306827 [details] pushed as 3963a78 - libvirt-machine-props: Prefix for display props Attachment 306828 [details] pushed as 0b814b2 - libvirt-machine-props: Show IP on 'General' page Attachment 306832 [details] pushed as 01c3d2c - remote-machine: Server of URL as 'info'
Made similar changes for other machines too: commit: a002382fdbc0d1d9e0af5e0c2338e4b80abb4a86 ovirt-machine: "hostname: server" as 'info' Set info property of ovirt machines to "host: server" where server is server part (hostname or IP address) of it's host URL. 'info' property is bound to 2nd text line in the collection view under the thumbnail. commit: 84e4834539e284e0361424310f72da69d5632433 libvirt-machine: Server in 'info' if remote Set info property of remote libvirt machines to "host: server" where server is server part (hostname or IP address) of it's host URL. 'info' property is bound to 2nd text line in the collection view under the thumbnail.