[1/1] parallels: fix default options parsing
diff mbox

Message ID 1490002022-22653-1-git-send-email-den@openvz.org
State New
Headers show

Commit Message

Denis V. Lunev March 20, 2017, 9:27 a.m. UTC
From: Edgar Kaziahmedov <edos@virtuozzo.mipt.ru>

parallels block driver is completely broken since commit
    commit 75cdcd1553e74b5edc58aed23e3b2da8dabb1876
    Author: Markus Armbruster <armbru@redhat.com>
    Date:   Tue Feb 21 21:14:08 2017 +0100
    option: Fix checking of sizes for overflow and trailing crap
Right now even simple
    qemu-io -c "read 512 64k" 1.hds
ends up with
    Unexpected error in parse_option_size() at util/qemu-option.c:188:
    Parameter 'prealloc-size' expects a non-negative number below 2^64
    Aborted (core dumped)
The cure is simple - we should use 'M' as a suffix in default option value
instead of 'MiB'.

Signed-off-by: Edgar Kaziahmedov <edos@virtuozzo.mipt.ru>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Markus Armbruster <armbru@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/parallels.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Markus Armbruster March 20, 2017, 1:55 p.m. UTC | #1
"Denis V. Lunev" <den@openvz.org> writes:

> From: Edgar Kaziahmedov <edos@virtuozzo.mipt.ru>
>
> parallels block driver is completely broken since commit
>     commit 75cdcd1553e74b5edc58aed23e3b2da8dabb1876
>     Author: Markus Armbruster <armbru@redhat.com>
>     Date:   Tue Feb 21 21:14:08 2017 +0100
>     option: Fix checking of sizes for overflow and trailing crap
> Right now even simple
>     qemu-io -c "read 512 64k" 1.hds
> ends up with
>     Unexpected error in parse_option_size() at util/qemu-option.c:188:
>     Parameter 'prealloc-size' expects a non-negative number below 2^64
>     Aborted (core dumped)
> The cure is simple - we should use 'M' as a suffix in default option value
> instead of 'MiB'.
>
> Signed-off-by: Edgar Kaziahmedov <edos@virtuozzo.mipt.ru>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Markus Armbruster <armbru@redhat.com>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  block/parallels.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/parallels.c b/block/parallels.c
> index 19935e2..6bf9375 100644
> --- a/block/parallels.c
> +++ b/block/parallels.c
> @@ -114,7 +114,7 @@ static QemuOptsList parallels_runtime_opts = {
>              .name = PARALLELS_OPT_PREALLOC_SIZE,
>              .type = QEMU_OPT_SIZE,
>              .help = "Preallocation size on image expansion",
> -            .def_value_str = "128MiB",
> +            .def_value_str = "128M",
>          },
>          {
>              .name = PARALLELS_OPT_PREALLOC_MODE,

Sorry for breaking this.  git-grep def_value_str doesn't find more.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Stefan Hajnoczi March 20, 2017, 2:34 p.m. UTC | #2
On Mon, Mar 20, 2017 at 12:27:02PM +0300, Denis V. Lunev wrote:
> From: Edgar Kaziahmedov <edos@virtuozzo.mipt.ru>
> 
> parallels block driver is completely broken since commit
>     commit 75cdcd1553e74b5edc58aed23e3b2da8dabb1876
>     Author: Markus Armbruster <armbru@redhat.com>
>     Date:   Tue Feb 21 21:14:08 2017 +0100
>     option: Fix checking of sizes for overflow and trailing crap
> Right now even simple
>     qemu-io -c "read 512 64k" 1.hds
> ends up with
>     Unexpected error in parse_option_size() at util/qemu-option.c:188:
>     Parameter 'prealloc-size' expects a non-negative number below 2^64
>     Aborted (core dumped)
> The cure is simple - we should use 'M' as a suffix in default option value
> instead of 'MiB'.
> 
> Signed-off-by: Edgar Kaziahmedov <edos@virtuozzo.mipt.ru>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Markus Armbruster <armbru@redhat.com>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  block/parallels.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

Patch
diff mbox

diff --git a/block/parallels.c b/block/parallels.c
index 19935e2..6bf9375 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -114,7 +114,7 @@  static QemuOptsList parallels_runtime_opts = {
             .name = PARALLELS_OPT_PREALLOC_SIZE,
             .type = QEMU_OPT_SIZE,
             .help = "Preallocation size on image expansion",
-            .def_value_str = "128MiB",
+            .def_value_str = "128M",
         },
         {
             .name = PARALLELS_OPT_PREALLOC_MODE,