Re: [virt-tools-list] virt-manager: show guest IP
On 02/02/2016 11:16 AM, Matwey V. Kornilov wrote: > 2016-02-01 16:19 GMT+03:00 Michal Privoznik : >> On 30.01.2016 17:10, Matwey V. Kornilov wrote: >>> Hello, >>> >>> Is it possible to configure virt-manager to show guest IP somewhere? >>> >>> I am running qemu with qemu-guest tools and the following command works >>> good: >>> >>> virsh # qemu-agent-command 5 '{"execute":"guest-network-get-interfaces"}' >>> {"return":[{"name":"lo","ip-addresses":[{"ip-address-type":"ipv4","ip-address":"127.0.0.1","prefix":8},{"ip-address-type":"ipv6","ip-address":"::1","prefix":128}],"hardware-address":"00:00:00:00:00:00"},{"name":"eth0","ip-addresses":[{"ip-address-type":"ipv4","ip-address":"192.168.185.188","prefix":24},{"ip-address-type":"ipv6","ip-address":"fe80::5054:ff:fecc:cfc3","prefix":64}],"hardware-address":"52:54:00:cc:cf:c3"}]} >>> >>> But I would like to see this information in virt-manager GUI like in >>> some proprietary hypervisor clients. >> >> Currently, there is no such option. Patches are welcome :) >> > > Where is the best place in UI to put networking info in your opinion? > To start, the interface device details in the VM details window, the same place things like mac address and device model are reported. >> But as a libvirt developer, I'd like to advertise 'virsh domifaddr' >> command which does basically the same as you are doing in your example >> but has one possible data source more. > > Am I right that domifaddr uses same mechanism to fetch the data (when > qemu:/// is used)? Yes, it has an option to check the guest agent IIRC. Thanks, Cole ___ virt-tools-list mailing list virt-tools-list@redhat.com https://www.redhat.com/mailman/listinfo/virt-tools-list
Re: [virt-tools-list] virt-manager: show guest IP
On 02.02.2016 17:16, Matwey V. Kornilov wrote: > 2016-02-01 16:19 GMT+03:00 Michal Privoznik : >> On 30.01.2016 17:10, Matwey V. Kornilov wrote: >>> Hello, >>> >>> Is it possible to configure virt-manager to show guest IP somewhere? >>> >>> I am running qemu with qemu-guest tools and the following command works >>> good: >>> >>> virsh # qemu-agent-command 5 '{"execute":"guest-network-get-interfaces"}' >>> {"return":[{"name":"lo","ip-addresses":[{"ip-address-type":"ipv4","ip-address":"127.0.0.1","prefix":8},{"ip-address-type":"ipv6","ip-address":"::1","prefix":128}],"hardware-address":"00:00:00:00:00:00"},{"name":"eth0","ip-addresses":[{"ip-address-type":"ipv4","ip-address":"192.168.185.188","prefix":24},{"ip-address-type":"ipv6","ip-address":"fe80::5054:ff:fecc:cfc3","prefix":64}],"hardware-address":"52:54:00:cc:cf:c3"}]} >>> >>> But I would like to see this information in virt-manager GUI like in >>> some proprietary hypervisor clients. >> >> Currently, there is no such option. Patches are welcome :) >> > > Where is the best place in UI to put networking info in your opinion? > >> But as a libvirt developer, I'd like to advertise 'virsh domifaddr' >> command which does basically the same as you are doing in your example >> but has one possible data source more. > > Am I right that domifaddr uses same mechanism to fetch the data (when > qemu:/// is used)? Yes and no. There are two modes right now in which domifaddr can operate. The first one is asking guest agent (*) the second one is asking dnsmasq (well, consulting a database that is updated on each dhcp transaction, but no need to get too technical in here). * - the problem with guest agent is that guest can rename it's interfaces as it likes. Not only that, it can create other interface structure as seen from the outside, e.g. join two devices into a bonding, or create a virtual interface over "physical" one. Therefore it can be hard to find matching between an interface as seen from the guest and interface as seen from the host. Michal ___ virt-tools-list mailing list virt-tools-list@redhat.com https://www.redhat.com/mailman/listinfo/virt-tools-list
Re: [virt-tools-list] virt-manager: show guest IP
2016-02-01 16:19 GMT+03:00 Michal Privoznik : > On 30.01.2016 17:10, Matwey V. Kornilov wrote: >> Hello, >> >> Is it possible to configure virt-manager to show guest IP somewhere? >> >> I am running qemu with qemu-guest tools and the following command works >> good: >> >> virsh # qemu-agent-command 5 '{"execute":"guest-network-get-interfaces"}' >> {"return":[{"name":"lo","ip-addresses":[{"ip-address-type":"ipv4","ip-address":"127.0.0.1","prefix":8},{"ip-address-type":"ipv6","ip-address":"::1","prefix":128}],"hardware-address":"00:00:00:00:00:00"},{"name":"eth0","ip-addresses":[{"ip-address-type":"ipv4","ip-address":"192.168.185.188","prefix":24},{"ip-address-type":"ipv6","ip-address":"fe80::5054:ff:fecc:cfc3","prefix":64}],"hardware-address":"52:54:00:cc:cf:c3"}]} >> >> But I would like to see this information in virt-manager GUI like in >> some proprietary hypervisor clients. > > Currently, there is no such option. Patches are welcome :) > Where is the best place in UI to put networking info in your opinion? > But as a libvirt developer, I'd like to advertise 'virsh domifaddr' > command which does basically the same as you are doing in your example > but has one possible data source more. Am I right that domifaddr uses same mechanism to fetch the data (when qemu:/// is used)? > > Happy hacking! > > Michal -- With best regards, Matwey V. Kornilov http://blog.matwey.name xmpp://0x2...@jabber.ru ___ virt-tools-list mailing list virt-tools-list@redhat.com https://www.redhat.com/mailman/listinfo/virt-tools-list
Re: [virt-tools-list] [PATCH virt-viewer] display: Set value of desktop width and height property directly
On 02/02/2016 10:59 AM, Pavel Grunt wrote: > Hi, > > On Tue, 2016-02-02 at 09:47 -0200, Eduardo Lima (Etrunko) wrote: >> On 01/27/2016 03:33 PM, Pavel Grunt wrote: >>> Avoid calling gtk_widget_queue_resize() and emitting >>> the "display-desktop-resize" signal. >> >> Just curious about why this change is necessary? I mean, isn't this >> signal necessary somewhere else? I see it is handled in >> VirtViewerWindow. >> > these properties are only used > by virt_viewer_display_spice_set_desktop() which will emit the signal > and call the function. I want to prevent multiple calls > to virt_viewer_display_queue_resize() when changing both properties. > >> If so, please provide some more details in the commit message. > > what about: > > display: Set value of desktop width and height property directly > > Avoid calling gtk_widget_queue_resize() and emiting > the "display-desktop-resize" signal. > The only user of the properties is > virt_viewer_display_spice_set_desktop() > which will call the function and emit the signal after setting both > "desktop-width" and "desktop-height" properties. > Yes, much better, thanks. :) -- Eduardo de Barros Lima (Etrunko) Software Engineer - RedHat etru...@redhat.com ___ virt-tools-list mailing list virt-tools-list@redhat.com https://www.redhat.com/mailman/listinfo/virt-tools-list
Re: [virt-tools-list] [PATCH virt-viewer] display: Set value of desktop width and height property directly
Hi, On Tue, 2016-02-02 at 09:47 -0200, Eduardo Lima (Etrunko) wrote: > On 01/27/2016 03:33 PM, Pavel Grunt wrote: > > Avoid calling gtk_widget_queue_resize() and emitting > > the "display-desktop-resize" signal. > > Just curious about why this change is necessary? I mean, isn't this > signal necessary somewhere else? I see it is handled in > VirtViewerWindow. > these properties are only used by virt_viewer_display_spice_set_desktop() which will emit the signal and call the function. I want to prevent multiple calls to virt_viewer_display_queue_resize() when changing both properties. > If so, please provide some more details in the commit message. what about: display: Set value of desktop width and height property directly Avoid calling gtk_widget_queue_resize() and emiting the "display-desktop-resize" signal. The only user of the properties is virt_viewer_display_spice_set_desktop() which will call the function and emit the signal after setting both "desktop-width" and "desktop-height" properties. Pavel > > > --- > > src/virt-viewer-display.c | 8 ++-- > > 1 file changed, 2 insertions(+), 6 deletions(-) > > > > diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c > > index d1b088e..af1fe01 100644 > > --- a/src/virt-viewer-display.c > > +++ b/src/virt-viewer-display.c > > @@ -301,14 +301,10 @@ virt_viewer_display_set_property(GObject > > *object, > > > > switch (prop_id) { > > case PROP_DESKTOP_WIDTH: > > -virt_viewer_display_set_desktop_size(display, > > - g_value_get_int(value > > ), > > - priv->desktopHeight); > > +priv->desktopWidth = g_value_get_int(value); > > break; > > case PROP_DESKTOP_HEIGHT: > > -virt_viewer_display_set_desktop_size(display, > > - priv->desktopWidth, > > - g_value_get_int(value > > )); > > +priv->desktopHeight = g_value_get_int(value); > > break; > > case PROP_NTH_DISPLAY: > > priv->nth_display = g_value_get_int(value); > > > > ___ virt-tools-list mailing list virt-tools-list@redhat.com https://www.redhat.com/mailman/listinfo/virt-tools-list
Re: [virt-tools-list] [PATCH virt-viewer 2/2] display: Move variable definitions to block where are used
On Tue, 2016-02-02 at 09:38 -0200, Eduardo Lima (Etrunko) wrote: > On 01/27/2016 03:03 PM, Pavel Grunt wrote: > > --- > > src/virt-viewer-display.c | 18 +++--- > > 1 file changed, 7 insertions(+), 11 deletions(-) > > > > diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c > > index 72ec56a..d1b088e 100644 > > --- a/src/virt-viewer-display.c > > +++ b/src/virt-viewer-display.c > > @@ -501,11 +501,6 @@ virt_viewer_display_size_allocate(GtkWidget > > *widget, > > GtkBin *bin = GTK_BIN(widget); > > VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(widget); > > VirtViewerDisplayPrivate *priv = display->priv; > > -GtkAllocation child_allocation; > > -gint width, height; > > -gint border_width; > > -double desktopAspect; > > -double actualAspect; > > GtkWidget *child = gtk_bin_get_child(bin); > > > > g_debug("Allocated %dx%d", allocation->width, allocation- > > >height); > > @@ -519,14 +514,15 @@ virt_viewer_display_size_allocate(GtkWidget > > *widget, > > return; > > #endif > > > > -desktopAspect = (double)priv->desktopWidth / (double)priv- > > >desktopHeight; > > - > > if (child && gtk_widget_get_visible(child)) { > > -border_width = > > gtk_container_get_border_width(GTK_CONTAINER(display)); > > +GtkAllocation child_allocation; > > +gint border_width = > > gtk_container_get_border_width(GTK_CONTAINER(display)); > > + > > +gint width = MAX(1, allocation->width - 2 * > > border_width); > > +gint height = MAX(1, allocation->height - 2 * > > border_width); > > > > -width = MAX(1, allocation->width - 2 * border_width); > > -height = MAX(1, allocation->height - 2 * border_width); > > -actualAspect = (double)width / (double)height; > > +double desktopAspect = (double) priv->desktopWidth / > > (double) priv->desktopHeight; > > +double actualAspect = (double) width / (double) height; > > > > if (actualAspect > desktopAspect) { > > child_allocation.width = round(height * > > desktopAspect); > > > > > Looks good, but what do you think about removing this huge if block > and > maybe merging this "child" check together with the one on the > beginning > of the function, something like: > > if (priv->desktopWidth == 0 || > priv->desktopHeight == 0 || > !child || !gtk_widget_get_visible(child)) > sure, works for me. I will post updated patch. Pavel > > ___ virt-tools-list mailing list virt-tools-list@redhat.com https://www.redhat.com/mailman/listinfo/virt-tools-list
Re: [virt-tools-list] [PATCH virt-viewer 2/2] display: Move variable definitions to block where are used
On 01/27/2016 03:03 PM, Pavel Grunt wrote: > --- > src/virt-viewer-display.c | 18 +++--- > 1 file changed, 7 insertions(+), 11 deletions(-) > > diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c > index 72ec56a..d1b088e 100644 > --- a/src/virt-viewer-display.c > +++ b/src/virt-viewer-display.c > @@ -501,11 +501,6 @@ virt_viewer_display_size_allocate(GtkWidget *widget, > GtkBin *bin = GTK_BIN(widget); > VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(widget); > VirtViewerDisplayPrivate *priv = display->priv; > -GtkAllocation child_allocation; > -gint width, height; > -gint border_width; > -double desktopAspect; > -double actualAspect; > GtkWidget *child = gtk_bin_get_child(bin); > > g_debug("Allocated %dx%d", allocation->width, allocation->height); > @@ -519,14 +514,15 @@ virt_viewer_display_size_allocate(GtkWidget *widget, > return; > #endif > > -desktopAspect = (double)priv->desktopWidth / (double)priv->desktopHeight; > - > if (child && gtk_widget_get_visible(child)) { > -border_width = > gtk_container_get_border_width(GTK_CONTAINER(display)); > +GtkAllocation child_allocation; > +gint border_width = > gtk_container_get_border_width(GTK_CONTAINER(display)); > + > +gint width = MAX(1, allocation->width - 2 * border_width); > +gint height = MAX(1, allocation->height - 2 * border_width); > > -width = MAX(1, allocation->width - 2 * border_width); > -height = MAX(1, allocation->height - 2 * border_width); > -actualAspect = (double)width / (double)height; > +double desktopAspect = (double) priv->desktopWidth / (double) > priv->desktopHeight; > +double actualAspect = (double) width / (double) height; > > if (actualAspect > desktopAspect) { > child_allocation.width = round(height * desktopAspect); > Looks good, but what do you think about removing this huge if block and maybe merging this "child" check together with the one on the beginning of the function, something like: if (priv->desktopWidth == 0 || priv->desktopHeight == 0 || !child || !gtk_widget_get_visible(child)) -- Eduardo de Barros Lima (Etrunko) Software Engineer - RedHat etru...@redhat.com ___ virt-tools-list mailing list virt-tools-list@redhat.com https://www.redhat.com/mailman/listinfo/virt-tools-list
Re: [virt-tools-list] [PATCH virt-viewer] display: Set value of desktop width and height property directly
On 01/27/2016 03:33 PM, Pavel Grunt wrote: > Avoid calling gtk_widget_queue_resize() and emitting > the "display-desktop-resize" signal. Just curious about why this change is necessary? I mean, isn't this signal necessary somewhere else? I see it is handled in VirtViewerWindow. If so, please provide some more details in the commit message. > --- > src/virt-viewer-display.c | 8 ++-- > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c > index d1b088e..af1fe01 100644 > --- a/src/virt-viewer-display.c > +++ b/src/virt-viewer-display.c > @@ -301,14 +301,10 @@ virt_viewer_display_set_property(GObject *object, > > switch (prop_id) { > case PROP_DESKTOP_WIDTH: > -virt_viewer_display_set_desktop_size(display, > - g_value_get_int(value), > - priv->desktopHeight); > +priv->desktopWidth = g_value_get_int(value); > break; > case PROP_DESKTOP_HEIGHT: > -virt_viewer_display_set_desktop_size(display, > - priv->desktopWidth, > - g_value_get_int(value)); > +priv->desktopHeight = g_value_get_int(value); > break; > case PROP_NTH_DISPLAY: > priv->nth_display = g_value_get_int(value); > -- Eduardo de Barros Lima (Etrunko) Software Engineer - RedHat etru...@redhat.com ___ virt-tools-list mailing list virt-tools-list@redhat.com https://www.redhat.com/mailman/listinfo/virt-tools-list
Re: [virt-tools-list] [PATCH virt-viewer 1/2] display: Remove unnecessary VIRT_VIEWER_DISPLAY cast
On 01/27/2016 03:03 PM, Pavel Grunt wrote: > --- > src/virt-viewer-display.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c > index a16181f..72ec56a 100644 > --- a/src/virt-viewer-display.c > +++ b/src/virt-viewer-display.c > @@ -545,7 +545,7 @@ virt_viewer_display_size_allocate(GtkWidget *widget, > > #if !GTK_CHECK_VERSION(3, 0, 0) > end: > -virt_viewer_display_make_resizable(VIRT_VIEWER_DISPLAY(widget)); > +virt_viewer_display_make_resizable(display); > #endif > } > > @@ -819,7 +819,7 @@ void > virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay* self, > > g_return_if_fail(preferred != NULL); > > -if (!virt_viewer_display_get_enabled(VIRT_VIEWER_DISPLAY(self))) { > +if (!virt_viewer_display_get_enabled(self)) { > preferred->width = 0; > preferred->height = 0; > preferred->x = 0; > @@ -832,10 +832,10 @@ void > virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay* self, > topx = MAX(topx, 0); > topy = MAX(topy, 0); > > -if (virt_viewer_display_get_fullscreen(VIRT_VIEWER_DISPLAY(self))) { > +if (virt_viewer_display_get_fullscreen(self)) { > GdkRectangle physical_monitor; > GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(self)); > -int n = virt_viewer_display_get_monitor(VIRT_VIEWER_DISPLAY(self)); > +int n = virt_viewer_display_get_monitor(self); > if (n == -1) > n = gdk_screen_get_monitor_at_window(screen, > > gtk_widget_get_window(GTK_WIDGET(self))); > @@ -850,8 +850,8 @@ void > virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay* self, > preferred->y = topy; > } > > -if (virt_viewer_display_get_zoom(VIRT_VIEWER_DISPLAY(self))) { > -guint zoom = > virt_viewer_display_get_zoom_level(VIRT_VIEWER_DISPLAY(self)); > +if (virt_viewer_display_get_zoom(self)) { > +guint zoom = virt_viewer_display_get_zoom_level(self); > > preferred->width = round(preferred->width * NORMAL_ZOOM_LEVEL / > (double) zoom); > preferred->height = round(preferred->height * NORMAL_ZOOM_LEVEL / > (double) zoom); > Acked-by: Eduardo Lima (Etrunko) -- Eduardo de Barros Lima (Etrunko) Software Engineer - RedHat etru...@redhat.com ___ virt-tools-list mailing list virt-tools-list@redhat.com https://www.redhat.com/mailman/listinfo/virt-tools-list