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

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



On Thu, Mar 01, 2012 at 05:57:24AM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>
> 
> 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 :|


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