Il 23/04/2012 17:39, Stefan Hajnoczi ha scritto:
> +    /* Only set speed when necessary to avoid NotSupported error */
> +    if (speed != 0) {
> +        Error *local_err = NULL;
> +
> +        block_job_set_speed(job, speed, &local_err);
> +        if (error_is_set(&local_err)) {
> +            bs->job = NULL;
> +            g_free(job);
> +            bdrv_set_in_use(bs, 0);
> +            error_propagate(errp, local_err);
> +            return NULL;
> +        }
> +    }

Similarly, here I would instead modify the QAPI entry point, and add a
call to qmp_block_job_set_speed there.

In patch 2, qmp_block_job_set_speed can parse the return code to
distinguish ENOTSUP from EINVAL.

Paolo

Reply via email to