[libvirt] [PATCH libvirt-glib 3/6] Add GVirDomainDisk
Christophe Fergeau
cfergeau at redhat.com
Mon Nov 14 17:08:38 UTC 2011
On Mon, Nov 14, 2011 at 01:50:04PM +0100, Marc-André Lureau wrote:
> +/**
> + * gvir_domain_disk_get_stats:
> + * @self: the domain disk
> + * @err: an error
> + *
> + * This function returns network disk stats. Individual fields
> + * within the stats structure may be returned as -1, which indicates
> + * that the hypervisor does not support that particular statistic.
> + *
> + * Returns: (transfer full): the stats or %NULL in case of error
> + **/
> +GVirDomainDiskStats *gvir_domain_disk_get_stats(GVirDomainDisk *self, GError **err)
> +{
> + GVirDomainDiskStats *ret = NULL;
> + virDomainBlockStatsStruct stats;
> + GVirDomainDiskPrivate *priv;
> + virDomainPtr handle;
> +
> + g_return_val_if_fail(GVIR_IS_DOMAIN_DISK(self), NULL);
> +
> + priv = self->priv;
> + handle = gvir_domain_device_get_domain_handle(GVIR_DOMAIN_DEVICE(self));
> +
> + if (virDomainBlockStats(handle, priv->path, &stats, sizeof (stats)) < 0) {
Maybe we want to check if handle == NULL before calling into libvirt?
I checked that libvirt will return an error in this case.
(same question in patch 2/3)
(not an important issue, my ACK series still stand whatever you decide to
do about this)
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111114/9c392b2a/attachment-0001.sig>
More information about the libvir-list
mailing list