From a22c9e50568bc78a6ba7fb09b844748b707d2af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 28 Aug 2026 16:04:01 +0400 Subject: [PATCH] hmp: fix snapshot_blkdev argument type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `snapshot-file` argument for `snapshot_blkdev` is mandatory. Correct the `args_type` definition to reflect this. Fixes: 6106e2492fe ("qapi: Convert blockdev_snapshot_sync") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Marc-André Lureau Message-ID: <20260828-qemu-no-hmp-v5-4-9227de146347@redhat.com> --- block/monitor/block-hmp-cmds.c | 12 +----------- hmp-commands.hx | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 69ade0534f..39b82e8ef5 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -344,25 +344,15 @@ void hmp_block_job_complete(Monitor *mon, const QDict *qdict) void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict) { const char *device = qdict_get_str(qdict, "device"); - const char *filename = qdict_get_try_str(qdict, "snapshot-file"); + const char *filename = qdict_get_str(qdict, "snapshot-file"); const char *format = qdict_get_try_str(qdict, "format"); bool reuse = qdict_get_try_bool(qdict, "reuse", false); enum NewImageMode mode; Error *err = NULL; - if (!filename) { - /* - * In the future, if 'snapshot-file' is not specified, the snapshot - * will be taken internally. Today it's actually required. - */ - error_setg(&err, QERR_MISSING_PARAMETER, "snapshot-file"); - goto end; - } - mode = reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABSOLUTE_PATHS; qmp_blockdev_snapshot_sync(device, NULL, filename, NULL, format, true, mode, &err); -end: hmp_handle_error(mon, err); } diff --git a/hmp-commands.hx b/hmp-commands.hx index ea4a1db78f..f0b8d8914c 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1173,7 +1173,7 @@ ERST { .name = "snapshot_blkdev", - .args_type = "reuse:-n,device:B,snapshot-file:s?,format:s?", + .args_type = "reuse:-n,device:B,snapshot-file:s,format:s?", .params = "[-n] device [new-image-file] [format]", .help = "initiates a live snapshot\n\t\t\t" "of device. If a new image file is specified, the\n\t\t\t"