[libvirt] [PATCH 5/8] Getting Block IO Throttle support to remote driver

Adam Litke agl at us.ibm.com
Thu Oct 27 21:16:03 UTC 2011


On Thu, Oct 27, 2011 at 05:20:07PM +0800, Lei HH Li wrote:
> +static int
> +remoteDispatchDomainGetBlockIoThrottle(virNetServerPtr server ATTRIBUTE_UNUSED,
> +                                       virNetServerClientPtr client ATTRIBUTE_UNUSED,
> +                                       virNetMessageHeaderPtr hdr ATTRIBUTE_UNUSED,
> +                                       virNetMessageErrorPtr rerr,
> +                                       remote_domain_get_block_io_throttle_args *args,
> +                                       remote_domain_get_block_io_throttle_ret *ret)
> +{
> +    virDomainPtr dom = NULL;
> +    virDomainBlockIoThrottleInfo reply;
> +    int rv = -1;
> +    struct daemonClientPrivate *priv =
> +        virNetServerClientGetPrivateData(client);
> +
> +    if (!priv->conn) {
> +        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
> +        goto cleanup;
> +    }
> +
> +    if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
> +        goto cleanup;
> +
> +    rv = virDomainGetBlockIoThrottle(dom, args->disk, &reply, args->flags);
> +
> +    if (rv < 0)
> +        goto cleanup;

If not found, I would explicitly set found to 0.  Not strictly necessary I know,
but I would rather not have correctness of the API depend on the ret structure
being zeroed out somewhere else.

-- 
Adam Litke <agl at us.ibm.com>
IBM Linux Technology Center




More information about the libvir-list mailing list