[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 21/21] blockdev: loosen restrictions on drive-backup
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL 21/21] blockdev: loosen restrictions on drive-backup source node |
Date: |
Tue, 28 May 2019 21:28:47 +0200 |
From: John Snow <address@hidden>
We mandate that the source node must be a root node; but there's no reason
I am aware of that it needs to be restricted to such. In some cases, we need
to make sure that there's a medium present, but in the general case we can
allow the backup job itself to do the graph checking.
This patch helps improve the error message when you try to backup from
the same node more than once, which is reflected in the change to test
056.
For backups with bitmaps, it will also show a better error message that
the bitmap is in use instead of giving you something cryptic like "need
a root node."
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1707303
Signed-off-by: John Snow <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
blockdev.c | 7 ++++++-
tests/qemu-iotests/056 | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 79fbac8450..bc339d7818 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3450,11 +3450,16 @@ static BlockJob *do_drive_backup(DriveBackup *backup,
JobTxn *txn,
backup->compress = false;
}
- bs = qmp_get_root_bs(backup->device, errp);
+ bs = bdrv_lookup_bs(backup->device, backup->device, errp);
if (!bs) {
return NULL;
}
+ if (!bs->drv) {
+ error_setg(errp, "Device has no medium");
+ return NULL;
+ }
+
aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);
diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056
index 3df323984d..f40fc11a09 100755
--- a/tests/qemu-iotests/056
+++ b/tests/qemu-iotests/056
@@ -214,7 +214,7 @@ class BackupTest(iotests.QMPTestCase):
res = self.vm.qmp('query-block-jobs')
self.assert_qmp(res, 'return[0]/status', 'concluded')
# Leave zombie job un-dismissed, observe a failure:
- res = self.qmp_backup_and_wait(serror='Need a root block node',
+ res = self.qmp_backup_and_wait(serror="Node 'drive0' is busy: block
device is in use by block job: backup",
device='drive0', format=iotests.imgfmt,
sync='full', target=self.dest_img,
auto_dismiss=False)
--
2.21.0
- [Qemu-devel] [PULL 02/21] qcow2: add separate file for threaded data processing functions, (continued)
- [Qemu-devel] [PULL 02/21] qcow2: add separate file for threaded data processing functions, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 16/21] qemu-img: rebase: Reuse parent BlockDriverState, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 13/21] block/backup: refactor: split out backup_calculate_cluster_size, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 07/21] qcow2: bdrv_co_pwritev: move encryption code out of the lock, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 06/21] qcow2: qcow2_co_preadv: improve locking, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 14/21] block: Use bdrv_unref_child() for all children in bdrv_close(), Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 09/21] block/backup: simplify backup_incremental_init_copy_bitmap, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 15/21] block: Make bdrv_root_attach_child() unref child_bs on failure, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 08/21] qcow2: do encryption in threads, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 10/21] block/backup: move to copy_bitmap with granularity, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 21/21] blockdev: loosen restrictions on drive-backup source node,
Max Reitz <=
- [Qemu-devel] [PULL 18/21] qemu-img: rebase: Reuse in-chain BlockDriverState, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 17/21] qemu-img: rebase: Reduce reads on in-chain rebase, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 11/21] block/backup: refactor and tolerate unallocated cluster skipping, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 12/21] block/backup: unify different modes code path, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 20/21] qcow2-bitmap: initialize bitmap directory alignment, Max Reitz, 2019/05/28
- [Qemu-devel] [PULL 19/21] qcow2: skip writing zero buffers to empty COW areas, Max Reitz, 2019/05/28
- Re: [Qemu-devel] [PULL 00/21] Block patches, Peter Maydell, 2019/05/30