hmp: fix snapshot_blkdev argument type
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é <philmd@oss.qualcomm.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260828-qemu-no-hmp-v5-4-9227de146347@redhat.com>
Marc-André Lureau committed
Aug 28, 2026 at 16:04 UTC
a22c9e50568bc78a6ba7fb09b844748b707d2af0
2 files changed
+2
-12
block/monitor/block-hmp-cmds.c
+1
-11
@@ -344,25 +344,15 @@ void hmp_block_job_complete(Monitor *mon, const QDict *qdict)
344
void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
345
{
346
const char *device = qdict_get_str(qdict, "device");
347
- const char *filename = qdict_get_try_str(qdict, "snapshot-file");
347
+ const char *filename = qdict_get_str(qdict, "snapshot-file");
348
const char *format = qdict_get_try_str(qdict, "format");
349
bool reuse = qdict_get_try_bool(qdict, "reuse", false);
350
enum NewImageMode mode;
351
Error *err = NULL;
352
353
- if (!filename) {
354
- /*
355
- * In the future, if 'snapshot-file' is not specified, the snapshot
356
- * will be taken internally. Today it's actually required.
357
- */
358
- error_setg(&err, QERR_MISSING_PARAMETER, "snapshot-file");
359
- goto end;
360
- }
361
-
353
mode = reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABSOLUTE_PATHS;
354
qmp_blockdev_snapshot_sync(device, NULL, filename, NULL, format,
355
true, mode, &err);
365
-end:
356
hmp_handle_error(mon, err);
357
}
358
hmp-commands.hx
+1
-1
@@ -1173,7 +1173,7 @@ ERST
1173
1174
{
1175
.name = "snapshot_blkdev",
1176
- .args_type = "reuse:-n,device:B,snapshot-file:s?,format:s?",
1176
+ .args_type = "reuse:-n,device:B,snapshot-file:s,format:s?",
1177
.params = "[-n] device [new-image-file] [format]",
1178
.help = "initiates a live snapshot\n\t\t\t"
1179
"of device. If a new image file is specified, the\n\t\t\t"