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, -- 1.7.7.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list