Skip to content

Commit

Permalink
migration: improve error reporting of block driver state name
Browse files Browse the repository at this point in the history
With blockdev, a BlockDriverState may not have a device name,
so using a node name is required as an alternative.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200827111606.1408275-2-berrange@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  • Loading branch information
berrange authored and dagrh committed Aug 28, 2020
1 parent 9ba3b2b commit aa8a926
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions migration/savevm.c
Expand Up @@ -2682,7 +2682,7 @@ int save_snapshot(const char *name, Error **errp)

if (!bdrv_all_can_snapshot(&bs)) {
error_setg(errp, "Device '%s' is writable but does not support "
"snapshots", bdrv_get_device_name(bs));
"snapshots", bdrv_get_device_or_node_name(bs));
return ret;
}

Expand All @@ -2691,7 +2691,7 @@ int save_snapshot(const char *name, Error **errp)
ret = bdrv_all_delete_snapshot(name, &bs1, errp);
if (ret < 0) {
error_prepend(errp, "Error while deleting snapshot on device "
"'%s': ", bdrv_get_device_name(bs1));
"'%s': ", bdrv_get_device_or_node_name(bs1));
return ret;
}
}
Expand Down Expand Up @@ -2766,7 +2766,7 @@ int save_snapshot(const char *name, Error **errp)
ret = bdrv_all_create_snapshot(sn, bs, vm_state_size, &bs);
if (ret < 0) {
error_setg(errp, "Error while creating snapshot on '%s'",
bdrv_get_device_name(bs));
bdrv_get_device_or_node_name(bs));
goto the_end;
}

Expand Down Expand Up @@ -2884,14 +2884,14 @@ int load_snapshot(const char *name, Error **errp)
if (!bdrv_all_can_snapshot(&bs)) {
error_setg(errp,
"Device '%s' is writable but does not support snapshots",
bdrv_get_device_name(bs));
bdrv_get_device_or_node_name(bs));
return -ENOTSUP;
}
ret = bdrv_all_find_snapshot(name, &bs);
if (ret < 0) {
error_setg(errp,
"Device '%s' does not have the requested snapshot '%s'",
bdrv_get_device_name(bs), name);
bdrv_get_device_or_node_name(bs), name);
return ret;
}

Expand Down Expand Up @@ -2920,7 +2920,7 @@ int load_snapshot(const char *name, Error **errp)
ret = bdrv_all_goto_snapshot(name, &bs, errp);
if (ret < 0) {
error_prepend(errp, "Could not load snapshot '%s' on '%s': ",
name, bdrv_get_device_name(bs));
name, bdrv_get_device_or_node_name(bs));
goto err_drain;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/qemu-iotests/267.out
Expand Up @@ -81,11 +81,11 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=file
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) savevm snap0
Error: Device '' is writable but does not support snapshots
Error: Device 'file' is writable but does not support snapshots
(qemu) info snapshots
No available block device supports snapshots
(qemu) loadvm snap0
Error: Device '' is writable but does not support snapshots
Error: Device 'file' is writable but does not support snapshots
(qemu) quit

Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
Expand Down

0 comments on commit aa8a926

Please sign in to comment.