After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 744004 - Show IP of guest
Show IP of guest
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: properties
3.15.x
Other Linux
: Normal normal
: 3.22
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-02-04 18:08 UTC by Zeeshan Ali
Modified: 2016-03-31 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
util-app: Add get_system_virt_connection() (2.69 KB, patch)
2015-07-04 18:29 UTC, Zeeshan Ali
committed Details | Review
Requite libvirt-glib >= 0.2.2 (797 bytes, patch)
2015-07-04 18:29 UTC, Zeeshan Ali
committed Details | Review
util-app: Fetch networking info too (986 bytes, patch)
2015-07-04 18:29 UTC, Zeeshan Ali
committed Details | Review
machine: Add virtual update_info() (2.82 KB, patch)
2015-07-04 18:29 UTC, Zeeshan Ali
committed Details | Review
machine: Async constructor (1.90 KB, patch)
2015-07-04 18:29 UTC, Zeeshan Ali
none Details | Review
libvirt-machine: Add get_ip_address() (3.29 KB, patch)
2015-07-04 18:29 UTC, Zeeshan Ali
none Details | Review
libvirt-machine: IP as running machines' info (1.03 KB, patch)
2015-07-04 18:29 UTC, Zeeshan Ali
none Details | Review
libvirt-machine-props: Prefix for display props (1.21 KB, patch)
2015-07-04 18:29 UTC, Zeeshan Ali
none Details | Review
libvirt-machine-props: Show IP on 'General' page (1.04 KB, patch)
2015-07-04 18:30 UTC, Zeeshan Ali
none Details | Review
libvirt-machine: Async constructor (1.96 KB, patch)
2015-07-04 18:32 UTC, Zeeshan Ali
committed Details | Review
libvirt-machine: Add get_ip_address() (3.29 KB, patch)
2015-07-04 18:32 UTC, Zeeshan Ali
committed Details | Review
libvirt-machine: IP as running machines' info (1.03 KB, patch)
2015-07-04 18:32 UTC, Zeeshan Ali
rejected Details | Review
libvirt-machine-props: Prefix for display props (1.21 KB, patch)
2015-07-04 18:32 UTC, Zeeshan Ali
committed Details | Review
libvirt-machine-props: Show IP on 'General' page (1.04 KB, patch)
2015-07-04 18:32 UTC, Zeeshan Ali
committed Details | Review
remote-machine: Server of URL as 'info' (1.74 KB, patch)
2015-07-04 19:05 UTC, Zeeshan Ali
committed Details | Review
i-props-provider: String props should be selectable (1015 bytes, patch)
2015-07-07 15:44 UTC, Zeeshan Ali
committed Details | Review

Description Zeeshan Ali 2015-02-04 18:08:44 UTC
Would be useful to show IP of the guest in properties view.
Comment 1 Fabiano Fidêncio 2015-02-16 19:10:41 UTC
(In reply to Zeeshan Ali (Khattak) from comment #0)

Depends on: http://www.redhat.com/archives/libvir-list/2014-December/msg00866.html
Comment 2 Zeeshan Ali 2015-02-17 17:06:26 UTC
(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.
Comment 3 Fabiano Fidêncio 2015-02-17 21:30:53 UTC
(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?
Comment 4 Zeeshan Ali 2015-02-17 22:12:40 UTC
(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).
Comment 5 Zeeshan Ali 2015-02-17 22:17:01 UTC
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.
Comment 6 Fabiano Fidêncio 2015-02-17 22:31:53 UTC
(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)"? :-)
Comment 7 Zeeshan Ali 2015-05-22 11:28:57 UTC
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?
Comment 8 Alberto Ruiz 2015-06-20 14:54:16 UTC
(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.
Comment 9 Zeeshan Ali 2015-07-04 18:29:11 UTC
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.
Comment 10 Zeeshan Ali 2015-07-04 18:29:18 UTC
Created attachment 306816 [details] [review]
Requite libvirt-glib >= 0.2.2

We'll need the new networking API in the following patches.
Comment 11 Zeeshan Ali 2015-07-04 18:29:24 UTC
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.
Comment 12 Zeeshan Ali 2015-07-04 18:29:29 UTC
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.
Comment 13 Zeeshan Ali 2015-07-04 18:29:35 UTC
Created attachment 306819 [details] [review]
machine: Async constructor

In the following patch, we'll need to make async calls.
Comment 14 Zeeshan Ali 2015-07-04 18:29:41 UTC
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.
Comment 15 Zeeshan Ali 2015-07-04 18:29:49 UTC
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).
Comment 16 Zeeshan Ali 2015-07-04 18:29:55 UTC
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.
Comment 17 Zeeshan Ali 2015-07-04 18:30:02 UTC
Created attachment 306823 [details] [review]
libvirt-machine-props: Show IP on 'General' page
Comment 18 Zeeshan Ali 2015-07-04 18:32:10 UTC
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.
Comment 19 Zeeshan Ali 2015-07-04 18:32:22 UTC
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.
Comment 20 Zeeshan Ali 2015-07-04 18:32:30 UTC
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).
Comment 21 Zeeshan Ali 2015-07-04 18:32:37 UTC
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.
Comment 22 Zeeshan Ali 2015-07-04 18:32:46 UTC
Created attachment 306828 [details] [review]
libvirt-machine-props: Show IP on 'General' page
Comment 23 Zeeshan Ali 2015-07-04 18:38:39 UTC
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.
Comment 24 Zeeshan Ali 2015-07-04 19:05:04 UTC
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 25 Zeeshan Ali 2015-07-07 15:35:16 UTC
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.
Comment 26 Zeeshan Ali 2015-07-07 15:44:50 UTC
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.
Comment 27 Zeeshan Ali 2015-07-07 16:44:12 UTC
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'
Comment 28 Zeeshan Ali 2015-08-18 17:59:56 UTC
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.