Re: [libvirt-glib] RFC: Empty statistics for user-mode interfaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 01, 2012 at 05:57:24AM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx>
> 
> One of the limitations of user-mode networking of libvirt is that you
> can't get statistics for it (not yet, at least). Instead of erroring-out
> in that case, simply return empty statistics result and spit a debug
> message.
> 
> I will merge this into my 'Remove now redundant 'path' property' patch
> once someone tells me that this makes sense. :)
> ---
>  libvirt-gobject/libvirt-gobject-domain-interface.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-domain-interface.c b/libvirt-gobject/libvirt-gobject-domain-interface.c
> index 0a9bde0..4436466 100644
> --- a/libvirt-gobject/libvirt-gobject-domain-interface.c
> +++ b/libvirt-gobject/libvirt-gobject-domain-interface.c
> @@ -94,7 +94,11 @@ static gchar *gvir_domain_interface_get_path(GVirDomainInterface *self)
>      gchar *path = NULL;
>  
>      config = gvir_domain_device_get_config(GVIR_DOMAIN_DEVICE(self));
> -    path = gvir_config_domain_interface_get_ifname(GVIR_CONFIG_DOMAIN_INTERFACE (config));
> +    if (GVIR_CONFIG_IS_DOMAIN_INTERFACE_USER(self))
> +        /* FIXME: One of the limitations of user-mode networking of libvirt */
> +        g_debug("Statistics gathering for user-mode network not yet supported");
> +    else
> +        path = gvir_config_domain_interface_get_ifname(GVIR_CONFIG_DOMAIN_INTERFACE (config));
>  
>      g_object_unref (config);
>  
> @@ -123,6 +127,10 @@ GVirDomainInterfaceStats *gvir_domain_interface_get_stats(GVirDomainInterface *s
>  
>      handle = gvir_domain_device_get_domain_handle(GVIR_DOMAIN_DEVICE(self));
>      path = gvir_domain_interface_get_path (self);
> +    if (path == NULL) {
> +        ret = g_slice_new0(GVirDomainInterfaceStats);
> +        goto end;
> +    }
>  
>      if (virDomainInterfaceStats(handle, path, &stats, sizeof (stats)) < 0) {
>          gvir_set_error_literal(err, GVIR_DOMAIN_INTERFACE_ERROR,

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]