qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-block@nongnu.org
Subject: [Qemu-devel] [PATCH v2 1/4] blockdev-backup: Use bdrv_lookup_bs on target
Date: Mon, 23 May 2016 10:19:35 +0800	[thread overview]
Message-ID: <1463969978-24970-2-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1463969978-24970-1-git-send-email-famz@redhat.com>

This allows backing up to a BDS that has not been attached to any BB.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 blockdev.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 40e4e6f..026ead0 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3346,7 +3346,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;
@@ -3377,18 +3377,11 @@ 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);
+    target_bs = bdrv_lookup_bs(target, target, errp);
+    if (!target_bs) {
         goto out;
     }
 
-    if (!blk_is_available(target_blk)) {
-        error_setg(errp, "Device '%s' has no medium", target);
-        goto out;
-    }
-    target_bs = blk_bs(target_blk);
-
     bdrv_ref(target_bs);
     bdrv_set_aio_context(target_bs, aio_context);
     backup_start(bs, target_bs, speed, sync, NULL, on_source_error,
-- 
2.8.2

  reply	other threads:[~2016-05-23  2:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23  2:19 [Qemu-devel] [PATCH v2 0/4] Drop virtio-{blk,scsi} op blockers Fam Zheng
2016-05-23  2:19 ` Fam Zheng [this message]
2016-05-23  2:19 ` [Qemu-devel] [PATCH v2 2/4] blockdev-backup: Don't move target AioContext if it's attached Fam Zheng
2016-05-23  2:19 ` [Qemu-devel] [PATCH v2 3/4] virtio-blk: Remove op blocker for dataplane Fam Zheng
2016-05-23  2:19 ` [Qemu-devel] [PATCH v2 4/4] virtio-scsi: " Fam Zheng
2016-05-25  7:20 ` [Qemu-devel] [PATCH v2 0/4] Drop virtio-{blk,scsi} op blockers Fam Zheng
2016-05-27 22:33 ` [Qemu-devel] [Qemu-block] [PATCH v2 0/4] Drop virtio-{blk, scsi} " Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1463969978-24970-2-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).