hmp: fix snapshot_blkdev argument type

The `snapshot-file` argument for `snapshot_blkdev` is mandatory. Correct
the `args_type` definition to reflect this.

Fixes: 6106e2492f ("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>
This commit is contained in:
Marc-André Lureau committed 2026-08-29 12:07:43 +04:00
1 parent 25ad0dbb74
commit a22c9e5056
2 files changed
+2 -12

No files matched your search

+1 -11
View File
@@ -344,25 +344,15 @@ void hmp_block_job_complete(Monitor *mon, const QDict *qdict)
void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict) void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
{ {
const char *device = qdict_get_str(qdict, "device"); 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"); const char *format = qdict_get_try_str(qdict, "format");
bool reuse = qdict_get_try_bool(qdict, "reuse", false); bool reuse = qdict_get_try_bool(qdict, "reuse", false);
enum NewImageMode mode; enum NewImageMode mode;
Error *err = NULL; 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; mode = reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABSOLUTE_PATHS;
qmp_blockdev_snapshot_sync(device, NULL, filename, NULL, format, qmp_blockdev_snapshot_sync(device, NULL, filename, NULL, format,
true, mode, &err); true, mode, &err);
end:
hmp_handle_error(mon, err); hmp_handle_error(mon, err);
} }
+1 -1
View File
@@ -1173,7 +1173,7 @@ ERST
{ {
.name = "snapshot_blkdev", .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]", .params = "[-n] device [new-image-file] [format]",
.help = "initiates a live snapshot\n\t\t\t" .help = "initiates a live snapshot\n\t\t\t"
"of device. If a new image file is specified, the\n\t\t\t" "of device. If a new image file is specified, the\n\t\t\t"