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

Re: [libvirt] [PATCH libvirt-glib 3/6] Add GVirDomainDisk



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

Attachment: pgpmMTzrVB7BH.pgp
Description: PGP signature


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