summaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2016-05-23 10:19:35 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2016-06-07 14:40:50 +0100
commit0d97891312d24891868e341674541f4147c7faf4 (patch)
tree1e033889f4e2af5c128e749046a74430bbf877de /blockdev.c
parent271b385e7ec2f1ca23c5345599cd58d9651427e5 (diff)
downloadqemu-0d97891312d24891868e341674541f4147c7faf4.zip
blockdev-backup: Use bdrv_lookup_bs on target
This allows backing up to a BDS that has not been attached to any BB. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1463969978-24970-2-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/blockdev.c b/blockdev.c
index 717785eb8d..ea7f3974e2 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3335,7 +3335,7 @@ void do_blockdev_backup(const char *device, const char *target,
BlockdevOnError on_target_error,
BlockJobTxn *txn, Error **errp)
{
- BlockBackend *blk, *target_blk;
+ BlockBackend *blk;
BlockDriverState *bs;
BlockDriverState *target_bs;
Error *local_err = NULL;
@@ -3366,17 +3366,10 @@ void do_blockdev_backup(const char *device, const char *target,
}
bs = blk_bs(blk);
- target_blk = blk_by_name(target);
- if (!target_blk) {
- error_setg(errp, "Device '%s' not found", target);
- goto out;
- }
-
- if (!blk_is_available(target_blk)) {
- error_setg(errp, "Device '%s' has no medium", target);
+ target_bs = bdrv_lookup_bs(target, target, errp);
+ if (!target_bs) {
goto out;
}
- target_bs = blk_bs(target_blk);
bdrv_set_aio_context(target_bs, aio_context);
backup_start(bs, target_bs, speed, sync, NULL, on_source_error,