block: use Error mechanism instead of -errno for block_job_set_speed()

There are at least two different errors that can occur in
block_job_set_speed(): the job might not support setting speeds or the
value might be invalid.

Use the Error mechanism to report the error where it occurs.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2012-04-25 16:51:01 +01:00 committed by Luiz Capitulino
parent fd7f8c6537
commit 9e6636c72d
5 changed files with 18 additions and 15 deletions

View file

@ -1145,9 +1145,7 @@ void qmp_block_job_set_speed(const char *device, int64_t value, Error **errp)
return;
}
if (block_job_set_speed(job, value) < 0) {
error_set(errp, QERR_NOT_SUPPORTED);
}
block_job_set_speed(job, value, errp);
}
void qmp_block_job_cancel(const char *device, Error **errp)