mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
block: Improve some block-commit, block-stream error messages
block-commit defaults @base-node to the deepest backing image. When
there is none, it fails with "Base 'NULL' not found". Improve to
"There is no backing image".
block-commit and block-stream reject a @base argument that doesn't
resolve with "Base 'BASE' not found". Commit 6b33f3ae8b
"qemu-img:
Improve commit invalid base message" improved this message in
qemu-img. Improve it here, too: "Can't find '%s' in the backing
chain".
QERR_BASE_NOT_FOUND is now unused. Drop.
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20201113082626.2725812-4-armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
f820af8743
commit
b0d7be2a62
3 changed files with 15 additions and 14 deletions
15
blockdev.c
15
blockdev.c
|
@ -2531,7 +2531,7 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
|
|||
if (has_base) {
|
||||
base_bs = bdrv_find_backing_image(bs, base);
|
||||
if (base_bs == NULL) {
|
||||
error_setg(errp, QERR_BASE_NOT_FOUND, base);
|
||||
error_setg(errp, "Can't find '%s' in the backing chain", base);
|
||||
goto out;
|
||||
}
|
||||
assert(bdrv_get_aio_context(base_bs) == aio_context);
|
||||
|
@ -2703,13 +2703,16 @@ void qmp_block_commit(bool has_job_id, const char *job_id, const char *device,
|
|||
}
|
||||
} else if (has_base && base) {
|
||||
base_bs = bdrv_find_backing_image(top_bs, base);
|
||||
if (base_bs == NULL) {
|
||||
error_setg(errp, "Can't find '%s' in the backing chain", base);
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
base_bs = bdrv_find_base(top_bs);
|
||||
}
|
||||
|
||||
if (base_bs == NULL) {
|
||||
error_setg(errp, QERR_BASE_NOT_FOUND, base ? base : "NULL");
|
||||
goto out;
|
||||
if (base_bs == NULL) {
|
||||
error_setg(errp, "There is no backimg image");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
assert(bdrv_get_aio_context(base_bs) == aio_context);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue