Skip to content

Commit

Permalink
blockdev: fix drive-mirror 'granularity' error message
Browse files Browse the repository at this point in the history
Name the 'granularity' parameter and give its expected value range.
Previously the device name was mistakenly reported as the parameter
name.

Note that the error class is unchanged from ERROR_CLASS_GENERIC_ERROR.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>
  • Loading branch information
stefanhaRH committed Aug 29, 2014
1 parent 0b9caf9 commit 3cbbe9f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions blockdev.c
Expand Up @@ -2179,11 +2179,12 @@ void qmp_drive_mirror(const char *device, const char *target,
}

if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {
error_set(errp, QERR_INVALID_PARAMETER, device);
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
"a value in range [512B, 64MB]");
return;
}
if (granularity & (granularity - 1)) {
error_set(errp, QERR_INVALID_PARAMETER, device);
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity", "power of 2");
return;
}

Expand Down

0 comments on commit 3cbbe9f

Please sign in to comment.