* Fri Feb 14 2020 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.2.0-10.el8
- kvm-i386-Resolve-CPU-models-to-v1-by-default.patch [bz#1779078 bz#1787291 bz#1779078 bz#1779078] - kvm-iotests-Support-job-complete-in-run_job.patch [bz#1781637] - kvm-iotests-Create-VM.blockdev_create.patch [bz#1781637] - kvm-block-Activate-recursively-even-for-already-active-n.patch [bz#1781637] - kvm-hmp-Allow-using-qdev-ID-for-qemu-io-command.patch [bz#1781637] - kvm-iotests-Test-external-snapshot-with-VM-state.patch [bz#1781637] - kvm-iotests.py-Let-wait_migration-wait-even-more.patch [bz#1781637] - kvm-blockdev-fix-coding-style-issues-in-drive_backup_pre.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-blockdev-unify-qmp_drive_backup-and-drive-backup-tra.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-blockdev-unify-qmp_blockdev_backup-and-blockdev-back.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-blockdev-honor-bdrv_try_set_aio_context-context-requ.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-backup-top-Begin-drain-earlier.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-block-backup-top-Don-t-acquire-context-while-droppin.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-blockdev-Acquire-AioContext-on-dirty-bitmap-function.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-blockdev-Return-bs-to-the-proper-context-on-snapshot.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-iotests-Test-handling-of-AioContexts-with-some-block.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965] - kvm-target-arm-monitor-query-cpu-model-expansion-crashed.patch [bz#1801320] - kvm-docs-arm-cpu-features-Make-kvm-no-adjvtime-comment-c.patch [bz#1801320] - Resolves: bz#1745606 (Qemu hang when do incremental live backup in transaction mode without bitmap) - Resolves: bz#1746217 (Src qemu hang when do storage vm migration during guest installation) - Resolves: bz#1773517 (Src qemu hang when do storage vm migration with dataplane enable) - Resolves: bz#1779036 (Qemu coredump when do snapshot in transaction mode with one snapshot path not exist) - Resolves: bz#1779078 (RHVH 4.4: Failed to run VM on 4.3/4.4 engine (Exit message: the CPU is incompatible with host CPU: Host CPU does not provide required features: hle, rtm)) - Resolves: bz#1781637 (qemu crashed when do mem and disk snapshot) - Resolves: bz#1782111 (Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable)) - Resolves: bz#1782175 (Qemu core dump when add persistent bitmap(data plane enable)) - Resolves: bz#1783965 (Qemu core dump when do backup with sync: bitmap and no bitmap provided) - Resolves: bz#1787291 (RHVH 4.4: Failed to run VM on 4.3/4.4 engine (Exit message: the CPU is incompatible with host CPU: Host CPU does not provide required features: hle, rtm) [rhel-8.1.0.z]) - Resolves: bz#1801320 (aarch64: backport query-cpu-model-expansion and adjvtime document fixes)
This commit is contained in:
parent
6ca2f341c2
commit
fda7fbcd8d
56
kvm-backup-top-Begin-drain-earlier.patch
Normal file
56
kvm-backup-top-Begin-drain-earlier.patch
Normal file
@ -0,0 +1,56 @@
|
||||
From bc78ee07bf400cbff0021367e05d308870471710 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:45 +0000
|
||||
Subject: [PATCH 12/18] backup-top: Begin drain earlier
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-6-slp@redhat.com>
|
||||
Patchwork-id: 93757
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 5/9] backup-top: Begin drain earlier
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
From: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
When dropping backup-top, we need to drain the node before freeing the
|
||||
BlockCopyState. Otherwise, requests may still be in flight and then the
|
||||
assertion in shres_destroy() will fail.
|
||||
|
||||
(This becomes visible in intermittent failure of 056.)
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
Message-id: 20191219182638.104621-1-mreitz@redhat.com
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit 503ca1262bab2c11c533a4816d1ff4297d4f58a6)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/backup-top.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/block/backup-top.c b/block/backup-top.c
|
||||
index 7cdb1f8..818d3f2 100644
|
||||
--- a/block/backup-top.c
|
||||
+++ b/block/backup-top.c
|
||||
@@ -257,12 +257,12 @@ void bdrv_backup_top_drop(BlockDriverState *bs)
|
||||
BDRVBackupTopState *s = bs->opaque;
|
||||
AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||
|
||||
- block_copy_state_free(s->bcs);
|
||||
-
|
||||
aio_context_acquire(aio_context);
|
||||
|
||||
bdrv_drained_begin(bs);
|
||||
|
||||
+ block_copy_state_free(s->bcs);
|
||||
+
|
||||
s->active = false;
|
||||
bdrv_child_refresh_perms(bs, bs->backing, &error_abort);
|
||||
bdrv_replace_node(bs, backing_bs(bs), &error_abort);
|
||||
--
|
||||
1.8.3.1
|
||||
|
116
kvm-block-Activate-recursively-even-for-already-active-n.patch
Normal file
116
kvm-block-Activate-recursively-even-for-already-active-n.patch
Normal file
@ -0,0 +1,116 @@
|
||||
From 0ef6691ce8964bb2bbd677756c4e594793ca3ad8 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:24:01 +0000
|
||||
Subject: [PATCH 04/18] block: Activate recursively even for already active
|
||||
nodes
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200207112404.25198-4-kwolf@redhat.com>
|
||||
Patchwork-id: 93749
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 3/6] block: Activate recursively even for already active nodes
|
||||
Bugzilla: 1781637
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
bdrv_invalidate_cache_all() assumes that all nodes in a given subtree
|
||||
are either active or inactive when it starts. Therefore, as soon as it
|
||||
arrives at an already active node, it stops.
|
||||
|
||||
However, this assumption is wrong. For example, it's possible to take a
|
||||
snapshot of an inactive node, which results in an active overlay over an
|
||||
inactive backing file. The active overlay is probably also the root node
|
||||
of an inactive BlockBackend (blk->disable_perm == true).
|
||||
|
||||
In this case, bdrv_invalidate_cache_all() does not need to do anything
|
||||
to activate the overlay node, but it still needs to recurse into the
|
||||
children and the parents to make sure that after returning success,
|
||||
really everything is activated.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
(cherry picked from commit 7bb4941ace471fc7dd6ded4749b95b9622baa6ed)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block.c | 50 ++++++++++++++++++++++++--------------------------
|
||||
1 file changed, 24 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/block.c b/block.c
|
||||
index 473eb6e..2e5e8b6 100644
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -5335,10 +5335,6 @@ static void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs,
|
||||
return;
|
||||
}
|
||||
|
||||
- if (!(bs->open_flags & BDRV_O_INACTIVE)) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
QLIST_FOREACH(child, &bs->children, next) {
|
||||
bdrv_co_invalidate_cache(child->bs, &local_err);
|
||||
if (local_err) {
|
||||
@@ -5360,34 +5356,36 @@ static void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs,
|
||||
* just keep the extended permissions for the next time that an activation
|
||||
* of the image is tried.
|
||||
*/
|
||||
- bs->open_flags &= ~BDRV_O_INACTIVE;
|
||||
- bdrv_get_cumulative_perm(bs, &perm, &shared_perm);
|
||||
- ret = bdrv_check_perm(bs, NULL, perm, shared_perm, NULL, NULL, &local_err);
|
||||
- if (ret < 0) {
|
||||
- bs->open_flags |= BDRV_O_INACTIVE;
|
||||
- error_propagate(errp, local_err);
|
||||
- return;
|
||||
- }
|
||||
- bdrv_set_perm(bs, perm, shared_perm);
|
||||
-
|
||||
- if (bs->drv->bdrv_co_invalidate_cache) {
|
||||
- bs->drv->bdrv_co_invalidate_cache(bs, &local_err);
|
||||
- if (local_err) {
|
||||
+ if (bs->open_flags & BDRV_O_INACTIVE) {
|
||||
+ bs->open_flags &= ~BDRV_O_INACTIVE;
|
||||
+ bdrv_get_cumulative_perm(bs, &perm, &shared_perm);
|
||||
+ ret = bdrv_check_perm(bs, NULL, perm, shared_perm, NULL, NULL, &local_err);
|
||||
+ if (ret < 0) {
|
||||
bs->open_flags |= BDRV_O_INACTIVE;
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
- }
|
||||
+ bdrv_set_perm(bs, perm, shared_perm);
|
||||
|
||||
- FOR_EACH_DIRTY_BITMAP(bs, bm) {
|
||||
- bdrv_dirty_bitmap_skip_store(bm, false);
|
||||
- }
|
||||
+ if (bs->drv->bdrv_co_invalidate_cache) {
|
||||
+ bs->drv->bdrv_co_invalidate_cache(bs, &local_err);
|
||||
+ if (local_err) {
|
||||
+ bs->open_flags |= BDRV_O_INACTIVE;
|
||||
+ error_propagate(errp, local_err);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- ret = refresh_total_sectors(bs, bs->total_sectors);
|
||||
- if (ret < 0) {
|
||||
- bs->open_flags |= BDRV_O_INACTIVE;
|
||||
- error_setg_errno(errp, -ret, "Could not refresh total sector count");
|
||||
- return;
|
||||
+ FOR_EACH_DIRTY_BITMAP(bs, bm) {
|
||||
+ bdrv_dirty_bitmap_skip_store(bm, false);
|
||||
+ }
|
||||
+
|
||||
+ ret = refresh_total_sectors(bs, bs->total_sectors);
|
||||
+ if (ret < 0) {
|
||||
+ bs->open_flags |= BDRV_O_INACTIVE;
|
||||
+ error_setg_errno(errp, -ret, "Could not refresh total sector count");
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
QLIST_FOREACH(parent, &bs->parents, next_parent) {
|
||||
--
|
||||
1.8.3.1
|
||||
|
130
kvm-block-backup-top-Don-t-acquire-context-while-droppin.patch
Normal file
130
kvm-block-backup-top-Don-t-acquire-context-while-droppin.patch
Normal file
@ -0,0 +1,130 @@
|
||||
From aefff389c4d11bd69180db7177135c4645a9b1bd Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:46 +0000
|
||||
Subject: [PATCH 13/18] block/backup-top: Don't acquire context while dropping
|
||||
top
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-7-slp@redhat.com>
|
||||
Patchwork-id: 93759
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 6/9] block/backup-top: Don't acquire context while dropping top
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
All paths that lead to bdrv_backup_top_drop(), except for the call
|
||||
from backup_clean(), imply that the BDS AioContext has already been
|
||||
acquired, so doing it there too can potentially lead to QEMU hanging
|
||||
on AIO_WAIT_WHILE().
|
||||
|
||||
An easy way to trigger this situation is by issuing a two actions
|
||||
transaction, with a proper and a bogus blockdev-backup, so the second
|
||||
one will trigger a rollback. This will trigger a hang with an stack
|
||||
trace like this one:
|
||||
|
||||
#0 0x00007fb680c75016 in __GI_ppoll (fds=0x55e74580f7c0, nfds=1, timeout=<optimized out>,
|
||||
timeout@entry=0x0, sigmask=sigmask@entry=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:39
|
||||
#1 0x000055e743386e09 in ppoll (__ss=0x0, __timeout=0x0, __nfds=<optimized out>, __fds=<optimized out>)
|
||||
at /usr/include/bits/poll2.h:77
|
||||
#2 0x000055e743386e09 in qemu_poll_ns
|
||||
(fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>) at util/qemu-timer.c:336
|
||||
#3 0x000055e743388dc4 in aio_poll (ctx=0x55e7458925d0, blocking=blocking@entry=true)
|
||||
at util/aio-posix.c:669
|
||||
#4 0x000055e743305dea in bdrv_flush (bs=bs@entry=0x55e74593c0d0) at block/io.c:2878
|
||||
#5 0x000055e7432be58e in bdrv_close (bs=0x55e74593c0d0) at block.c:4017
|
||||
#6 0x000055e7432be58e in bdrv_delete (bs=<optimized out>) at block.c:4262
|
||||
#7 0x000055e7432be58e in bdrv_unref (bs=bs@entry=0x55e74593c0d0) at block.c:5644
|
||||
#8 0x000055e743316b9b in bdrv_backup_top_drop (bs=bs@entry=0x55e74593c0d0) at block/backup-top.c:273
|
||||
#9 0x000055e74331461f in backup_job_create
|
||||
(job_id=0x0, bs=bs@entry=0x55e7458d5820, target=target@entry=0x55e74589f640, speed=0, sync_mode=MIRROR_SYNC_MODE_FULL, sync_bitmap=sync_bitmap@entry=0x0, bitmap_mode=BITMAP_SYNC_MODE_ON_SUCCESS, compress=false, filter_node_name=0x0, on_source_error=BLOCKDEV_ON_ERROR_REPORT, on_target_error=BLOCKDEV_ON_ERROR_REPORT, creation_flags=0, cb=0x0, opaque=0x0, txn=0x0, errp=0x7ffddfd1efb0) at block/backup.c:478
|
||||
#10 0x000055e74315bc52 in do_backup_common
|
||||
(backup=backup@entry=0x55e746c066d0, bs=bs@entry=0x55e7458d5820, target_bs=target_bs@entry=0x55e74589f640, aio_context=aio_context@entry=0x55e7458a91e0, txn=txn@entry=0x0, errp=errp@entry=0x7ffddfd1efb0)
|
||||
at blockdev.c:3580
|
||||
#11 0x000055e74315c37c in do_blockdev_backup
|
||||
(backup=backup@entry=0x55e746c066d0, txn=0x0, errp=errp@entry=0x7ffddfd1efb0)
|
||||
at /usr/src/debug/qemu-kvm-4.2.0-2.module+el8.2.0+5135+ed3b2489.x86_64/./qapi/qapi-types-block-core.h:1492
|
||||
#12 0x000055e74315c449 in blockdev_backup_prepare (common=0x55e746a8de90, errp=0x7ffddfd1f018)
|
||||
at blockdev.c:1885
|
||||
#13 0x000055e743160152 in qmp_transaction
|
||||
(dev_list=<optimized out>, has_props=<optimized out>, props=0x55e7467fe2c0, errp=errp@entry=0x7ffddfd1f088) at blockdev.c:2340
|
||||
#14 0x000055e743287ff5 in qmp_marshal_transaction
|
||||
(args=<optimized out>, ret=<optimized out>, errp=0x7ffddfd1f0f8)
|
||||
at qapi/qapi-commands-transaction.c:44
|
||||
#15 0x000055e74333de6c in do_qmp_dispatch
|
||||
(errp=0x7ffddfd1f0f0, allow_oob=<optimized out>, request=<optimized out>, cmds=0x55e743c28d60 <qmp_commands>) at qapi/qmp-dispatch.c:132
|
||||
#16 0x000055e74333de6c in qmp_dispatch
|
||||
(cmds=0x55e743c28d60 <qmp_commands>, request=<optimized out>, allow_oob=<optimized out>)
|
||||
at qapi/qmp-dispatch.c:175
|
||||
#17 0x000055e74325c061 in monitor_qmp_dispatch (mon=0x55e745908030, req=<optimized out>)
|
||||
at monitor/qmp.c:145
|
||||
#18 0x000055e74325c6fa in monitor_qmp_bh_dispatcher (data=<optimized out>) at monitor/qmp.c:234
|
||||
#19 0x000055e743385866 in aio_bh_call (bh=0x55e745807ae0) at util/async.c:117
|
||||
#20 0x000055e743385866 in aio_bh_poll (ctx=ctx@entry=0x55e7458067a0) at util/async.c:117
|
||||
#21 0x000055e743388c54 in aio_dispatch (ctx=0x55e7458067a0) at util/aio-posix.c:459
|
||||
#22 0x000055e743385742 in aio_ctx_dispatch
|
||||
(source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at util/async.c:260
|
||||
#23 0x00007fb68543e67d in g_main_dispatch (context=0x55e745893a40) at gmain.c:3176
|
||||
#24 0x00007fb68543e67d in g_main_context_dispatch (context=context@entry=0x55e745893a40) at gmain.c:3829
|
||||
#25 0x000055e743387d08 in glib_pollfds_poll () at util/main-loop.c:219
|
||||
#26 0x000055e743387d08 in os_host_main_loop_wait (timeout=<optimized out>) at util/main-loop.c:242
|
||||
#27 0x000055e743387d08 in main_loop_wait (nonblocking=<optimized out>) at util/main-loop.c:518
|
||||
#28 0x000055e74316a3c1 in main_loop () at vl.c:1828
|
||||
#29 0x000055e743016a72 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>)
|
||||
at vl.c:4504
|
||||
|
||||
Fix this by not acquiring the AioContext there, and ensuring all paths
|
||||
leading to it have it already acquired (backup_clean()).
|
||||
|
||||
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1782111
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 0abf2581717a19d9749d5c2ff8acd0ac203452c2)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
block/backup-top.c | 5 -----
|
||||
block/backup.c | 3 +++
|
||||
2 files changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/block/backup-top.c b/block/backup-top.c
|
||||
index 818d3f2..b8d863f 100644
|
||||
--- a/block/backup-top.c
|
||||
+++ b/block/backup-top.c
|
||||
@@ -255,9 +255,6 @@ append_failed:
|
||||
void bdrv_backup_top_drop(BlockDriverState *bs)
|
||||
{
|
||||
BDRVBackupTopState *s = bs->opaque;
|
||||
- AioContext *aio_context = bdrv_get_aio_context(bs);
|
||||
-
|
||||
- aio_context_acquire(aio_context);
|
||||
|
||||
bdrv_drained_begin(bs);
|
||||
|
||||
@@ -271,6 +268,4 @@ void bdrv_backup_top_drop(BlockDriverState *bs)
|
||||
bdrv_drained_end(bs);
|
||||
|
||||
bdrv_unref(bs);
|
||||
-
|
||||
- aio_context_release(aio_context);
|
||||
}
|
||||
diff --git a/block/backup.c b/block/backup.c
|
||||
index cf62b1a..1383e21 100644
|
||||
--- a/block/backup.c
|
||||
+++ b/block/backup.c
|
||||
@@ -135,8 +135,11 @@ static void backup_abort(Job *job)
|
||||
static void backup_clean(Job *job)
|
||||
{
|
||||
BackupBlockJob *s = container_of(job, BackupBlockJob, common.job);
|
||||
+ AioContext *aio_context = bdrv_get_aio_context(s->backup_top);
|
||||
|
||||
+ aio_context_acquire(aio_context);
|
||||
bdrv_backup_top_drop(s->backup_top);
|
||||
+ aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
void backup_do_checkpoint(BlockJob *job, Error **errp)
|
||||
--
|
||||
1.8.3.1
|
||||
|
176
kvm-blockdev-Acquire-AioContext-on-dirty-bitmap-function.patch
Normal file
176
kvm-blockdev-Acquire-AioContext-on-dirty-bitmap-function.patch
Normal file
@ -0,0 +1,176 @@
|
||||
From dc2654f2319ad6c379e0ba10be143726c6f0e9e0 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:47 +0000
|
||||
Subject: [PATCH 14/18] blockdev: Acquire AioContext on dirty bitmap functions
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-8-slp@redhat.com>
|
||||
Patchwork-id: 93760
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 7/9] blockdev: Acquire AioContext on dirty bitmap functions
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
Dirty map addition and removal functions are not acquiring to BDS
|
||||
AioContext, while they may call to code that expects it to be
|
||||
acquired.
|
||||
|
||||
This may trigger a crash with a stack trace like this one:
|
||||
|
||||
#0 0x00007f0ef146370f in __GI_raise (sig=sig@entry=6)
|
||||
at ../sysdeps/unix/sysv/linux/raise.c:50
|
||||
#1 0x00007f0ef144db25 in __GI_abort () at abort.c:79
|
||||
#2 0x0000565022294dce in error_exit
|
||||
(err=<optimized out>, msg=msg@entry=0x56502243a730 <__func__.16350> "qemu_mutex_unlock_impl") at util/qemu-thread-posix.c:36
|
||||
#3 0x00005650222950ba in qemu_mutex_unlock_impl
|
||||
(mutex=mutex@entry=0x5650244b0240, file=file@entry=0x565022439adf "util/async.c", line=line@entry=526) at util/qemu-thread-posix.c:108
|
||||
#4 0x0000565022290029 in aio_context_release
|
||||
(ctx=ctx@entry=0x5650244b01e0) at util/async.c:526
|
||||
#5 0x000056502221cd08 in bdrv_can_store_new_dirty_bitmap
|
||||
(bs=bs@entry=0x5650244dc820, name=name@entry=0x56502481d360 "bitmap1", granularity=granularity@entry=65536, errp=errp@entry=0x7fff22831718)
|
||||
at block/dirty-bitmap.c:542
|
||||
#6 0x000056502206ae53 in qmp_block_dirty_bitmap_add
|
||||
(errp=0x7fff22831718, disabled=false, has_disabled=<optimized out>, persistent=<optimized out>, has_persistent=true, granularity=65536, has_granularity=<optimized out>, name=0x56502481d360 "bitmap1", node=<optimized out>) at blockdev.c:2894
|
||||
#7 0x000056502206ae53 in qmp_block_dirty_bitmap_add
|
||||
(node=<optimized out>, name=0x56502481d360 "bitmap1", has_granularity=<optimized out>, granularity=<optimized out>, has_persistent=true, persistent=<optimized out>, has_disabled=false, disabled=false, errp=0x7fff22831718) at blockdev.c:2856
|
||||
#8 0x00005650221847a3 in qmp_marshal_block_dirty_bitmap_add
|
||||
(args=<optimized out>, ret=<optimized out>, errp=0x7fff22831798)
|
||||
at qapi/qapi-commands-block-core.c:651
|
||||
#9 0x0000565022247e6c in do_qmp_dispatch
|
||||
(errp=0x7fff22831790, allow_oob=<optimized out>, request=<optimized out>, cmds=0x565022b32d60 <qmp_commands>) at qapi/qmp-dispatch.c:132
|
||||
#10 0x0000565022247e6c in qmp_dispatch
|
||||
(cmds=0x565022b32d60 <qmp_commands>, request=<optimized out>, allow_oob=<optimized out>) at qapi/qmp-dispatch.c:175
|
||||
#11 0x0000565022166061 in monitor_qmp_dispatch
|
||||
(mon=0x56502450faa0, req=<optimized out>) at monitor/qmp.c:145
|
||||
#12 0x00005650221666fa in monitor_qmp_bh_dispatcher
|
||||
(data=<optimized out>) at monitor/qmp.c:234
|
||||
#13 0x000056502228f866 in aio_bh_call (bh=0x56502440eae0)
|
||||
at util/async.c:117
|
||||
#14 0x000056502228f866 in aio_bh_poll (ctx=ctx@entry=0x56502440d7a0)
|
||||
at util/async.c:117
|
||||
#15 0x0000565022292c54 in aio_dispatch (ctx=0x56502440d7a0)
|
||||
at util/aio-posix.c:459
|
||||
#16 0x000056502228f742 in aio_ctx_dispatch
|
||||
(source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at util/async.c:260
|
||||
#17 0x00007f0ef5ce667d in g_main_dispatch (context=0x56502449aa40)
|
||||
at gmain.c:3176
|
||||
#18 0x00007f0ef5ce667d in g_main_context_dispatch
|
||||
(context=context@entry=0x56502449aa40) at gmain.c:3829
|
||||
#19 0x0000565022291d08 in glib_pollfds_poll () at util/main-loop.c:219
|
||||
#20 0x0000565022291d08 in os_host_main_loop_wait
|
||||
(timeout=<optimized out>) at util/main-loop.c:242
|
||||
#21 0x0000565022291d08 in main_loop_wait (nonblocking=<optimized out>)
|
||||
at util/main-loop.c:518
|
||||
#22 0x00005650220743c1 in main_loop () at vl.c:1828
|
||||
#23 0x0000565021f20a72 in main
|
||||
(argc=<optimized out>, argv=<optimized out>, envp=<optimized out>)
|
||||
at vl.c:4504
|
||||
|
||||
Fix this by acquiring the AioContext at qmp_block_dirty_bitmap_add()
|
||||
and qmp_block_dirty_bitmap_add().
|
||||
|
||||
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1782175
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 91005a495e228ebd7e5e173cd18f952450eef82d)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 22 ++++++++++++++++++----
|
||||
1 file changed, 18 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 1dacbc2..d4ef6cd 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -2984,6 +2984,7 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
|
||||
{
|
||||
BlockDriverState *bs;
|
||||
BdrvDirtyBitmap *bitmap;
|
||||
+ AioContext *aio_context;
|
||||
|
||||
if (!name || name[0] == '\0') {
|
||||
error_setg(errp, "Bitmap name cannot be empty");
|
||||
@@ -2995,11 +2996,14 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
|
||||
return;
|
||||
}
|
||||
|
||||
+ aio_context = bdrv_get_aio_context(bs);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
if (has_granularity) {
|
||||
if (granularity < 512 || !is_power_of_2(granularity)) {
|
||||
error_setg(errp, "Granularity must be power of 2 "
|
||||
"and at least 512");
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
} else {
|
||||
/* Default to cluster size, if available: */
|
||||
@@ -3017,12 +3021,12 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
|
||||
if (persistent &&
|
||||
!bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp))
|
||||
{
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
bitmap = bdrv_create_dirty_bitmap(bs, granularity, name, errp);
|
||||
if (bitmap == NULL) {
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
@@ -3030,6 +3034,9 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
|
||||
}
|
||||
|
||||
bdrv_dirty_bitmap_set_persistence(bitmap, persistent);
|
||||
+
|
||||
+out:
|
||||
+ aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
||||
@@ -3038,21 +3045,27 @@ static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
||||
{
|
||||
BlockDriverState *bs;
|
||||
BdrvDirtyBitmap *bitmap;
|
||||
+ AioContext *aio_context;
|
||||
|
||||
bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
||||
if (!bitmap || !bs) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ aio_context = bdrv_get_aio_context(bs);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_BUSY | BDRV_BITMAP_RO,
|
||||
errp)) {
|
||||
+ aio_context_release(aio_context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (bdrv_dirty_bitmap_get_persistence(bitmap) &&
|
||||
bdrv_remove_persistent_dirty_bitmap(bs, name, errp) < 0)
|
||||
{
|
||||
- return NULL;
|
||||
+ aio_context_release(aio_context);
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
if (release) {
|
||||
@@ -3063,6 +3076,7 @@ static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
||||
*bitmap_bs = bs;
|
||||
}
|
||||
|
||||
+ aio_context_release(aio_context);
|
||||
return release ? NULL : bitmap;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
107
kvm-blockdev-Return-bs-to-the-proper-context-on-snapshot.patch
Normal file
107
kvm-blockdev-Return-bs-to-the-proper-context-on-snapshot.patch
Normal file
@ -0,0 +1,107 @@
|
||||
From 24e5eca4218b294bd013e2d85a38345045506bec Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:48 +0000
|
||||
Subject: [PATCH 15/18] blockdev: Return bs to the proper context on snapshot
|
||||
abort
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-9-slp@redhat.com>
|
||||
Patchwork-id: 93761
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 8/9] blockdev: Return bs to the proper context on snapshot abort
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
external_snapshot_abort() calls to bdrv_set_backing_hd(), which
|
||||
returns state->old_bs to the main AioContext, as it's intended to be
|
||||
used then the BDS is going to be released. As that's not the case when
|
||||
aborting an external snapshot, return it to the AioContext it was
|
||||
before the call.
|
||||
|
||||
This issue can be triggered by issuing a transaction with two actions,
|
||||
a proper blockdev-snapshot-sync and a bogus one, so the second will
|
||||
trigger a transaction abort. This results in a crash with an stack
|
||||
trace like this one:
|
||||
|
||||
#0 0x00007fa1048b28df in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
|
||||
#1 0x00007fa10489ccf5 in __GI_abort () at abort.c:79
|
||||
#2 0x00007fa10489cbc9 in __assert_fail_base
|
||||
(fmt=0x7fa104a03300 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5572240b44d8 "bdrv_get_aio_context(old_bs) == bdrv_get_aio_context(new_bs)", file=0x557224014d30 "block.c", line=2240, function=<optimized out>) at assert.c:92
|
||||
#3 0x00007fa1048aae96 in __GI___assert_fail
|
||||
(assertion=assertion@entry=0x5572240b44d8 "bdrv_get_aio_context(old_bs) == bdrv_get_aio_context(new_bs)", file=file@entry=0x557224014d30 "block.c", line=line@entry=2240, function=function@entry=0x5572240b5d60 <__PRETTY_FUNCTION__.31620> "bdrv_replace_child_noperm") at assert.c:101
|
||||
#4 0x0000557223e631f8 in bdrv_replace_child_noperm (child=0x557225b9c980, new_bs=new_bs@entry=0x557225c42e40) at block.c:2240
|
||||
#5 0x0000557223e68be7 in bdrv_replace_node (from=0x557226951a60, to=0x557225c42e40, errp=0x5572247d6138 <error_abort>) at block.c:4196
|
||||
#6 0x0000557223d069c4 in external_snapshot_abort (common=0x557225d7e170) at blockdev.c:1731
|
||||
#7 0x0000557223d069c4 in external_snapshot_abort (common=0x557225d7e170) at blockdev.c:1717
|
||||
#8 0x0000557223d09013 in qmp_transaction (dev_list=<optimized out>, has_props=<optimized out>, props=0x557225cc7d70, errp=errp@entry=0x7ffe704c0c98) at blockdev.c:2360
|
||||
#9 0x0000557223e32085 in qmp_marshal_transaction (args=<optimized out>, ret=<optimized out>, errp=0x7ffe704c0d08) at qapi/qapi-commands-transaction.c:44
|
||||
#10 0x0000557223ee798c in do_qmp_dispatch (errp=0x7ffe704c0d00, allow_oob=<optimized out>, request=<optimized out>, cmds=0x5572247d3cc0 <qmp_commands>) at qapi/qmp-dispatch.c:132
|
||||
#11 0x0000557223ee798c in qmp_dispatch (cmds=0x5572247d3cc0 <qmp_commands>, request=<optimized out>, allow_oob=<optimized out>) at qapi/qmp-dispatch.c:175
|
||||
#12 0x0000557223e06141 in monitor_qmp_dispatch (mon=0x557225c69ff0, req=<optimized out>) at monitor/qmp.c:120
|
||||
#13 0x0000557223e0678a in monitor_qmp_bh_dispatcher (data=<optimized out>) at monitor/qmp.c:209
|
||||
#14 0x0000557223f2f366 in aio_bh_call (bh=0x557225b9dc60) at util/async.c:117
|
||||
#15 0x0000557223f2f366 in aio_bh_poll (ctx=ctx@entry=0x557225b9c840) at util/async.c:117
|
||||
#16 0x0000557223f32754 in aio_dispatch (ctx=0x557225b9c840) at util/aio-posix.c:459
|
||||
#17 0x0000557223f2f242 in aio_ctx_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at util/async.c:260
|
||||
#18 0x00007fa10913467d in g_main_dispatch (context=0x557225c28e80) at gmain.c:3176
|
||||
#19 0x00007fa10913467d in g_main_context_dispatch (context=context@entry=0x557225c28e80) at gmain.c:3829
|
||||
#20 0x0000557223f31808 in glib_pollfds_poll () at util/main-loop.c:219
|
||||
#21 0x0000557223f31808 in os_host_main_loop_wait (timeout=<optimized out>) at util/main-loop.c:242
|
||||
#22 0x0000557223f31808 in main_loop_wait (nonblocking=<optimized out>) at util/main-loop.c:518
|
||||
#23 0x0000557223d13201 in main_loop () at vl.c:1828
|
||||
#24 0x0000557223bbfb82 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4504
|
||||
|
||||
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1779036
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 377410f6fb4f6b0d26d4a028c20766fae05de17e)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 21 +++++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index d4ef6cd..4cd9a58 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1731,6 +1731,8 @@ static void external_snapshot_abort(BlkActionState *common)
|
||||
if (state->new_bs) {
|
||||
if (state->overlay_appended) {
|
||||
AioContext *aio_context;
|
||||
+ AioContext *tmp_context;
|
||||
+ int ret;
|
||||
|
||||
aio_context = bdrv_get_aio_context(state->old_bs);
|
||||
aio_context_acquire(aio_context);
|
||||
@@ -1738,6 +1740,25 @@ static void external_snapshot_abort(BlkActionState *common)
|
||||
bdrv_ref(state->old_bs); /* we can't let bdrv_set_backind_hd()
|
||||
close state->old_bs; we need it */
|
||||
bdrv_set_backing_hd(state->new_bs, NULL, &error_abort);
|
||||
+
|
||||
+ /*
|
||||
+ * The call to bdrv_set_backing_hd() above returns state->old_bs to
|
||||
+ * the main AioContext. As we're still going to be using it, return
|
||||
+ * it to the AioContext it was before.
|
||||
+ */
|
||||
+ tmp_context = bdrv_get_aio_context(state->old_bs);
|
||||
+ if (aio_context != tmp_context) {
|
||||
+ aio_context_release(aio_context);
|
||||
+ aio_context_acquire(tmp_context);
|
||||
+
|
||||
+ ret = bdrv_try_set_aio_context(state->old_bs,
|
||||
+ aio_context, NULL);
|
||||
+ assert(ret == 0);
|
||||
+
|
||||
+ aio_context_release(tmp_context);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+ }
|
||||
+
|
||||
bdrv_replace_node(state->new_bs, state->old_bs, &error_abort);
|
||||
bdrv_unref(state->old_bs); /* bdrv_replace_node() ref'ed old_bs */
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,62 @@
|
||||
From d56b53cd75c4146eae7a06d1cc30ab823a9bde93 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:41 +0000
|
||||
Subject: [PATCH 08/18] blockdev: fix coding style issues in
|
||||
drive_backup_prepare
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-2-slp@redhat.com>
|
||||
Patchwork-id: 93754
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 1/9] blockdev: fix coding style issues in drive_backup_prepare
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
Fix a couple of minor coding style issues in drive_backup_prepare.
|
||||
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 471ded690e19689018535e3f48480507ed073e22)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 8e029e9..553e315 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -3620,7 +3620,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
|
||||
|
||||
if (!backup->has_format) {
|
||||
backup->format = backup->mode == NEW_IMAGE_MODE_EXISTING ?
|
||||
- NULL : (char*) bs->drv->format_name;
|
||||
+ NULL : (char *) bs->drv->format_name;
|
||||
}
|
||||
|
||||
/* Early check to avoid creating target */
|
||||
@@ -3630,8 +3630,10 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
|
||||
|
||||
flags = bs->open_flags | BDRV_O_RDWR;
|
||||
|
||||
- /* See if we have a backing HD we can use to create our new image
|
||||
- * on top of. */
|
||||
+ /*
|
||||
+ * See if we have a backing HD we can use to create our new image
|
||||
+ * on top of.
|
||||
+ */
|
||||
if (backup->sync == MIRROR_SYNC_MODE_TOP) {
|
||||
source = backing_bs(bs);
|
||||
if (!source) {
|
||||
--
|
||||
1.8.3.1
|
||||
|
204
kvm-blockdev-honor-bdrv_try_set_aio_context-context-requ.patch
Normal file
204
kvm-blockdev-honor-bdrv_try_set_aio_context-context-requ.patch
Normal file
@ -0,0 +1,204 @@
|
||||
From da4ee4c0d56200042cb86f8ccd2777009bd82df3 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:44 +0000
|
||||
Subject: [PATCH 11/18] blockdev: honor bdrv_try_set_aio_context() context
|
||||
requirements
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-5-slp@redhat.com>
|
||||
Patchwork-id: 93758
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 4/9] blockdev: honor bdrv_try_set_aio_context() context requirements
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
bdrv_try_set_aio_context() requires that the old context is held, and
|
||||
the new context is not held. Fix all the occurrences where it's not
|
||||
done this way.
|
||||
|
||||
Suggested-by: Max Reitz <mreitz@redhat.com>
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 3ea67e08832775a28d0bd2795f01bc77e7ea1512)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 60 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 152a0f7..1dacbc2 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1535,6 +1535,7 @@ static void external_snapshot_prepare(BlkActionState *common,
|
||||
DO_UPCAST(ExternalSnapshotState, common, common);
|
||||
TransactionAction *action = common->action;
|
||||
AioContext *aio_context;
|
||||
+ AioContext *old_context;
|
||||
int ret;
|
||||
|
||||
/* 'blockdev-snapshot' and 'blockdev-snapshot-sync' have similar
|
||||
@@ -1675,7 +1676,16 @@ static void external_snapshot_prepare(BlkActionState *common,
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ /* Honor bdrv_try_set_aio_context() context acquisition requirements. */
|
||||
+ old_context = bdrv_get_aio_context(state->new_bs);
|
||||
+ aio_context_release(aio_context);
|
||||
+ aio_context_acquire(old_context);
|
||||
+
|
||||
ret = bdrv_try_set_aio_context(state->new_bs, aio_context, errp);
|
||||
+
|
||||
+ aio_context_release(old_context);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
if (ret < 0) {
|
||||
goto out;
|
||||
}
|
||||
@@ -1775,11 +1785,13 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp)
|
||||
BlockDriverState *target_bs;
|
||||
BlockDriverState *source = NULL;
|
||||
AioContext *aio_context;
|
||||
+ AioContext *old_context;
|
||||
QDict *options;
|
||||
Error *local_err = NULL;
|
||||
int flags;
|
||||
int64_t size;
|
||||
bool set_backing_hd = false;
|
||||
+ int ret;
|
||||
|
||||
assert(common->action->type == TRANSACTION_ACTION_KIND_DRIVE_BACKUP);
|
||||
backup = common->action->u.drive_backup.data;
|
||||
@@ -1868,6 +1880,21 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp)
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ /* Honor bdrv_try_set_aio_context() context acquisition requirements. */
|
||||
+ old_context = bdrv_get_aio_context(target_bs);
|
||||
+ aio_context_release(aio_context);
|
||||
+ aio_context_acquire(old_context);
|
||||
+
|
||||
+ ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
|
||||
+ if (ret < 0) {
|
||||
+ bdrv_unref(target_bs);
|
||||
+ aio_context_release(old_context);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ aio_context_release(old_context);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
if (set_backing_hd) {
|
||||
bdrv_set_backing_hd(target_bs, source, &local_err);
|
||||
if (local_err) {
|
||||
@@ -1947,6 +1974,8 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
|
||||
BlockDriverState *bs;
|
||||
BlockDriverState *target_bs;
|
||||
AioContext *aio_context;
|
||||
+ AioContext *old_context;
|
||||
+ int ret;
|
||||
|
||||
assert(common->action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP);
|
||||
backup = common->action->u.blockdev_backup.data;
|
||||
@@ -1961,7 +1990,18 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
+ /* Honor bdrv_try_set_aio_context() context acquisition requirements. */
|
||||
aio_context = bdrv_get_aio_context(bs);
|
||||
+ old_context = bdrv_get_aio_context(target_bs);
|
||||
+ aio_context_acquire(old_context);
|
||||
+
|
||||
+ ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
|
||||
+ if (ret < 0) {
|
||||
+ aio_context_release(old_context);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ aio_context_release(old_context);
|
||||
aio_context_acquire(aio_context);
|
||||
state->bs = bs;
|
||||
|
||||
@@ -3562,7 +3602,6 @@ static BlockJob *do_backup_common(BackupCommon *backup,
|
||||
BlockJob *job = NULL;
|
||||
BdrvDirtyBitmap *bmap = NULL;
|
||||
int job_flags = JOB_DEFAULT;
|
||||
- int ret;
|
||||
|
||||
if (!backup->has_speed) {
|
||||
backup->speed = 0;
|
||||
@@ -3586,11 +3625,6 @@ static BlockJob *do_backup_common(BackupCommon *backup,
|
||||
backup->compress = false;
|
||||
}
|
||||
|
||||
- ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
|
||||
- if (ret < 0) {
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
if ((backup->sync == MIRROR_SYNC_MODE_BITMAP) ||
|
||||
(backup->sync == MIRROR_SYNC_MODE_INCREMENTAL)) {
|
||||
/* done before desugaring 'incremental' to print the right message */
|
||||
@@ -3825,6 +3859,7 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
|
||||
BlockDriverState *bs;
|
||||
BlockDriverState *source, *target_bs;
|
||||
AioContext *aio_context;
|
||||
+ AioContext *old_context;
|
||||
BlockMirrorBackingMode backing_mode;
|
||||
Error *local_err = NULL;
|
||||
QDict *options = NULL;
|
||||
@@ -3937,12 +3972,22 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
|
||||
(arg->mode == NEW_IMAGE_MODE_EXISTING ||
|
||||
!bdrv_has_zero_init(target_bs)));
|
||||
|
||||
+
|
||||
+ /* Honor bdrv_try_set_aio_context() context acquisition requirements. */
|
||||
+ old_context = bdrv_get_aio_context(target_bs);
|
||||
+ aio_context_release(aio_context);
|
||||
+ aio_context_acquire(old_context);
|
||||
+
|
||||
ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
|
||||
if (ret < 0) {
|
||||
bdrv_unref(target_bs);
|
||||
- goto out;
|
||||
+ aio_context_release(old_context);
|
||||
+ return;
|
||||
}
|
||||
|
||||
+ aio_context_release(old_context);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, target_bs,
|
||||
arg->has_replaces, arg->replaces, arg->sync,
|
||||
backing_mode, zero_target,
|
||||
@@ -3984,6 +4029,7 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
|
||||
BlockDriverState *bs;
|
||||
BlockDriverState *target_bs;
|
||||
AioContext *aio_context;
|
||||
+ AioContext *old_context;
|
||||
BlockMirrorBackingMode backing_mode = MIRROR_LEAVE_BACKING_CHAIN;
|
||||
Error *local_err = NULL;
|
||||
bool zero_target;
|
||||
@@ -4001,10 +4047,16 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
|
||||
|
||||
zero_target = (sync == MIRROR_SYNC_MODE_FULL);
|
||||
|
||||
+ /* Honor bdrv_try_set_aio_context() context acquisition requirements. */
|
||||
+ old_context = bdrv_get_aio_context(target_bs);
|
||||
aio_context = bdrv_get_aio_context(bs);
|
||||
- aio_context_acquire(aio_context);
|
||||
+ aio_context_acquire(old_context);
|
||||
|
||||
ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
|
||||
+
|
||||
+ aio_context_release(old_context);
|
||||
+ aio_context_acquire(aio_context);
|
||||
+
|
||||
if (ret < 0) {
|
||||
goto out;
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
144
kvm-blockdev-unify-qmp_blockdev_backup-and-blockdev-back.patch
Normal file
144
kvm-blockdev-unify-qmp_blockdev_backup-and-blockdev-back.patch
Normal file
@ -0,0 +1,144 @@
|
||||
From 959955217f745f1ee6cbea97314efe69f2d7dc08 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:43 +0000
|
||||
Subject: [PATCH 10/18] blockdev: unify qmp_blockdev_backup and blockdev-backup
|
||||
transaction paths
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-4-slp@redhat.com>
|
||||
Patchwork-id: 93756
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 3/9] blockdev: unify qmp_blockdev_backup and blockdev-backup transaction paths
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
Issuing a blockdev-backup from qmp_blockdev_backup takes a slightly
|
||||
different path than when it's issued from a transaction. In the code,
|
||||
this is manifested as some redundancy between do_blockdev_backup() and
|
||||
blockdev_backup_prepare().
|
||||
|
||||
This change unifies both paths, merging do_blockdev_backup() and
|
||||
blockdev_backup_prepare(), and changing qmp_blockdev_backup() to
|
||||
create a transaction instead of calling do_backup_common() direcly.
|
||||
|
||||
As a side-effect, now qmp_blockdev_backup() is executed inside a
|
||||
drained section, as it happens when creating a blockdev-backup
|
||||
transaction. This change is visible from the user's perspective, as
|
||||
the job gets paused and immediately resumed before starting the actual
|
||||
work.
|
||||
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
||||
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 5b7bfe515ecbd584b40ff6e41d2fd8b37c7d5139)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 60 +++++++++++++-----------------------------------------------
|
||||
1 file changed, 13 insertions(+), 47 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 5e85fc0..152a0f7 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1940,16 +1940,13 @@ typedef struct BlockdevBackupState {
|
||||
BlockJob *job;
|
||||
} BlockdevBackupState;
|
||||
|
||||
-static BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn,
|
||||
- Error **errp);
|
||||
-
|
||||
static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
|
||||
{
|
||||
BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, common, common);
|
||||
BlockdevBackup *backup;
|
||||
- BlockDriverState *bs, *target;
|
||||
+ BlockDriverState *bs;
|
||||
+ BlockDriverState *target_bs;
|
||||
AioContext *aio_context;
|
||||
- Error *local_err = NULL;
|
||||
|
||||
assert(common->action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP);
|
||||
backup = common->action->u.blockdev_backup.data;
|
||||
@@ -1959,8 +1956,8 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
- target = bdrv_lookup_bs(backup->target, backup->target, errp);
|
||||
- if (!target) {
|
||||
+ target_bs = bdrv_lookup_bs(backup->target, backup->target, errp);
|
||||
+ if (!target_bs) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1971,13 +1968,10 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
|
||||
/* Paired with .clean() */
|
||||
bdrv_drained_begin(state->bs);
|
||||
|
||||
- state->job = do_blockdev_backup(backup, common->block_job_txn, &local_err);
|
||||
- if (local_err) {
|
||||
- error_propagate(errp, local_err);
|
||||
- goto out;
|
||||
- }
|
||||
+ state->job = do_backup_common(qapi_BlockdevBackup_base(backup),
|
||||
+ bs, target_bs, aio_context,
|
||||
+ common->block_job_txn, errp);
|
||||
|
||||
-out:
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
@@ -3695,41 +3689,13 @@ XDbgBlockGraph *qmp_x_debug_query_block_graph(Error **errp)
|
||||
return bdrv_get_xdbg_block_graph(errp);
|
||||
}
|
||||
|
||||
-BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn,
|
||||
- Error **errp)
|
||||
+void qmp_blockdev_backup(BlockdevBackup *backup, Error **errp)
|
||||
{
|
||||
- BlockDriverState *bs;
|
||||
- BlockDriverState *target_bs;
|
||||
- AioContext *aio_context;
|
||||
- BlockJob *job;
|
||||
-
|
||||
- bs = bdrv_lookup_bs(backup->device, backup->device, errp);
|
||||
- if (!bs) {
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- target_bs = bdrv_lookup_bs(backup->target, backup->target, errp);
|
||||
- if (!target_bs) {
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- aio_context = bdrv_get_aio_context(bs);
|
||||
- aio_context_acquire(aio_context);
|
||||
-
|
||||
- job = do_backup_common(qapi_BlockdevBackup_base(backup),
|
||||
- bs, target_bs, aio_context, txn, errp);
|
||||
-
|
||||
- aio_context_release(aio_context);
|
||||
- return job;
|
||||
-}
|
||||
-
|
||||
-void qmp_blockdev_backup(BlockdevBackup *arg, Error **errp)
|
||||
-{
|
||||
- BlockJob *job;
|
||||
- job = do_blockdev_backup(arg, NULL, errp);
|
||||
- if (job) {
|
||||
- job_start(&job->job);
|
||||
- }
|
||||
+ TransactionAction action = {
|
||||
+ .type = TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP,
|
||||
+ .u.blockdev_backup.data = backup,
|
||||
+ };
|
||||
+ blockdev_do_action(&action, errp);
|
||||
}
|
||||
|
||||
/* Parameter check and block job starting for drive mirroring.
|
||||
--
|
||||
1.8.3.1
|
||||
|
419
kvm-blockdev-unify-qmp_drive_backup-and-drive-backup-tra.patch
Normal file
419
kvm-blockdev-unify-qmp_drive_backup-and-drive-backup-tra.patch
Normal file
@ -0,0 +1,419 @@
|
||||
From 4a03ab2a6cc4974d8d43240d1297b09160818af3 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:27:42 +0000
|
||||
Subject: [PATCH 09/18] blockdev: unify qmp_drive_backup and drive-backup
|
||||
transaction paths
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-3-slp@redhat.com>
|
||||
Patchwork-id: 93755
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 2/9] blockdev: unify qmp_drive_backup and drive-backup transaction paths
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
Issuing a drive-backup from qmp_drive_backup takes a slightly
|
||||
different path than when it's issued from a transaction. In the code,
|
||||
this is manifested as some redundancy between do_drive_backup() and
|
||||
drive_backup_prepare().
|
||||
|
||||
This change unifies both paths, merging do_drive_backup() and
|
||||
drive_backup_prepare(), and changing qmp_drive_backup() to create a
|
||||
transaction instead of calling do_backup_common() direcly.
|
||||
|
||||
As a side-effect, now qmp_drive_backup() is executed inside a drained
|
||||
section, as it happens when creating a drive-backup transaction. This
|
||||
change is visible from the user's perspective, as the job gets paused
|
||||
and immediately resumed before starting the actual work.
|
||||
|
||||
Also fix tests 141, 185 and 219 to cope with the extra
|
||||
JOB_STATUS_CHANGE lines.
|
||||
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 2288ccfac96281c316db942d10e3f921c1373064)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
blockdev.c | 224 ++++++++++++++++++++-------------------------
|
||||
tests/qemu-iotests/141.out | 2 +
|
||||
tests/qemu-iotests/185.out | 2 +
|
||||
tests/qemu-iotests/219 | 7 +-
|
||||
tests/qemu-iotests/219.out | 8 ++
|
||||
5 files changed, 117 insertions(+), 126 deletions(-)
|
||||
|
||||
diff --git a/blockdev.c b/blockdev.c
|
||||
index 553e315..5e85fc0 100644
|
||||
--- a/blockdev.c
|
||||
+++ b/blockdev.c
|
||||
@@ -1761,39 +1761,128 @@ typedef struct DriveBackupState {
|
||||
BlockJob *job;
|
||||
} DriveBackupState;
|
||||
|
||||
-static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
|
||||
- Error **errp);
|
||||
+static BlockJob *do_backup_common(BackupCommon *backup,
|
||||
+ BlockDriverState *bs,
|
||||
+ BlockDriverState *target_bs,
|
||||
+ AioContext *aio_context,
|
||||
+ JobTxn *txn, Error **errp);
|
||||
|
||||
static void drive_backup_prepare(BlkActionState *common, Error **errp)
|
||||
{
|
||||
DriveBackupState *state = DO_UPCAST(DriveBackupState, common, common);
|
||||
- BlockDriverState *bs;
|
||||
DriveBackup *backup;
|
||||
+ BlockDriverState *bs;
|
||||
+ BlockDriverState *target_bs;
|
||||
+ BlockDriverState *source = NULL;
|
||||
AioContext *aio_context;
|
||||
+ QDict *options;
|
||||
Error *local_err = NULL;
|
||||
+ int flags;
|
||||
+ int64_t size;
|
||||
+ bool set_backing_hd = false;
|
||||
|
||||
assert(common->action->type == TRANSACTION_ACTION_KIND_DRIVE_BACKUP);
|
||||
backup = common->action->u.drive_backup.data;
|
||||
|
||||
+ if (!backup->has_mode) {
|
||||
+ backup->mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
|
||||
+ }
|
||||
+
|
||||
bs = bdrv_lookup_bs(backup->device, backup->device, errp);
|
||||
if (!bs) {
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (!bs->drv) {
|
||||
+ error_setg(errp, "Device has no medium");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
aio_context = bdrv_get_aio_context(bs);
|
||||
aio_context_acquire(aio_context);
|
||||
|
||||
/* Paired with .clean() */
|
||||
bdrv_drained_begin(bs);
|
||||
|
||||
- state->bs = bs;
|
||||
+ if (!backup->has_format) {
|
||||
+ backup->format = backup->mode == NEW_IMAGE_MODE_EXISTING ?
|
||||
+ NULL : (char *) bs->drv->format_name;
|
||||
+ }
|
||||
+
|
||||
+ /* Early check to avoid creating target */
|
||||
+ if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) {
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ flags = bs->open_flags | BDRV_O_RDWR;
|
||||
+
|
||||
+ /*
|
||||
+ * See if we have a backing HD we can use to create our new image
|
||||
+ * on top of.
|
||||
+ */
|
||||
+ if (backup->sync == MIRROR_SYNC_MODE_TOP) {
|
||||
+ source = backing_bs(bs);
|
||||
+ if (!source) {
|
||||
+ backup->sync = MIRROR_SYNC_MODE_FULL;
|
||||
+ }
|
||||
+ }
|
||||
+ if (backup->sync == MIRROR_SYNC_MODE_NONE) {
|
||||
+ source = bs;
|
||||
+ flags |= BDRV_O_NO_BACKING;
|
||||
+ set_backing_hd = true;
|
||||
+ }
|
||||
+
|
||||
+ size = bdrv_getlength(bs);
|
||||
+ if (size < 0) {
|
||||
+ error_setg_errno(errp, -size, "bdrv_getlength failed");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (backup->mode != NEW_IMAGE_MODE_EXISTING) {
|
||||
+ assert(backup->format);
|
||||
+ if (source) {
|
||||
+ bdrv_refresh_filename(source);
|
||||
+ bdrv_img_create(backup->target, backup->format, source->filename,
|
||||
+ source->drv->format_name, NULL,
|
||||
+ size, flags, false, &local_err);
|
||||
+ } else {
|
||||
+ bdrv_img_create(backup->target, backup->format, NULL, NULL, NULL,
|
||||
+ size, flags, false, &local_err);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- state->job = do_drive_backup(backup, common->block_job_txn, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ options = qdict_new();
|
||||
+ qdict_put_str(options, "discard", "unmap");
|
||||
+ qdict_put_str(options, "detect-zeroes", "unmap");
|
||||
+ if (backup->format) {
|
||||
+ qdict_put_str(options, "driver", backup->format);
|
||||
+ }
|
||||
+
|
||||
+ target_bs = bdrv_open(backup->target, NULL, options, flags, errp);
|
||||
+ if (!target_bs) {
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (set_backing_hd) {
|
||||
+ bdrv_set_backing_hd(target_bs, source, &local_err);
|
||||
+ if (local_err) {
|
||||
+ goto unref;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ state->bs = bs;
|
||||
+
|
||||
+ state->job = do_backup_common(qapi_DriveBackup_base(backup),
|
||||
+ bs, target_bs, aio_context,
|
||||
+ common->block_job_txn, errp);
|
||||
+
|
||||
+unref:
|
||||
+ bdrv_unref(target_bs);
|
||||
out:
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
@@ -3587,126 +3676,13 @@ static BlockJob *do_backup_common(BackupCommon *backup,
|
||||
return job;
|
||||
}
|
||||
|
||||
-static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
|
||||
- Error **errp)
|
||||
-{
|
||||
- BlockDriverState *bs;
|
||||
- BlockDriverState *target_bs;
|
||||
- BlockDriverState *source = NULL;
|
||||
- BlockJob *job = NULL;
|
||||
- AioContext *aio_context;
|
||||
- QDict *options;
|
||||
- Error *local_err = NULL;
|
||||
- int flags;
|
||||
- int64_t size;
|
||||
- bool set_backing_hd = false;
|
||||
-
|
||||
- if (!backup->has_mode) {
|
||||
- backup->mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
|
||||
- }
|
||||
-
|
||||
- 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);
|
||||
-
|
||||
- if (!backup->has_format) {
|
||||
- backup->format = backup->mode == NEW_IMAGE_MODE_EXISTING ?
|
||||
- NULL : (char *) bs->drv->format_name;
|
||||
- }
|
||||
-
|
||||
- /* Early check to avoid creating target */
|
||||
- if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) {
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- flags = bs->open_flags | BDRV_O_RDWR;
|
||||
-
|
||||
- /*
|
||||
- * See if we have a backing HD we can use to create our new image
|
||||
- * on top of.
|
||||
- */
|
||||
- if (backup->sync == MIRROR_SYNC_MODE_TOP) {
|
||||
- source = backing_bs(bs);
|
||||
- if (!source) {
|
||||
- backup->sync = MIRROR_SYNC_MODE_FULL;
|
||||
- }
|
||||
- }
|
||||
- if (backup->sync == MIRROR_SYNC_MODE_NONE) {
|
||||
- source = bs;
|
||||
- flags |= BDRV_O_NO_BACKING;
|
||||
- set_backing_hd = true;
|
||||
- }
|
||||
-
|
||||
- size = bdrv_getlength(bs);
|
||||
- if (size < 0) {
|
||||
- error_setg_errno(errp, -size, "bdrv_getlength failed");
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- if (backup->mode != NEW_IMAGE_MODE_EXISTING) {
|
||||
- assert(backup->format);
|
||||
- if (source) {
|
||||
- bdrv_refresh_filename(source);
|
||||
- bdrv_img_create(backup->target, backup->format, source->filename,
|
||||
- source->drv->format_name, NULL,
|
||||
- size, flags, false, &local_err);
|
||||
- } else {
|
||||
- bdrv_img_create(backup->target, backup->format, NULL, NULL, NULL,
|
||||
- size, flags, false, &local_err);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (local_err) {
|
||||
- error_propagate(errp, local_err);
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- options = qdict_new();
|
||||
- qdict_put_str(options, "discard", "unmap");
|
||||
- qdict_put_str(options, "detect-zeroes", "unmap");
|
||||
- if (backup->format) {
|
||||
- qdict_put_str(options, "driver", backup->format);
|
||||
- }
|
||||
-
|
||||
- target_bs = bdrv_open(backup->target, NULL, options, flags, errp);
|
||||
- if (!target_bs) {
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- if (set_backing_hd) {
|
||||
- bdrv_set_backing_hd(target_bs, source, &local_err);
|
||||
- if (local_err) {
|
||||
- goto unref;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- job = do_backup_common(qapi_DriveBackup_base(backup),
|
||||
- bs, target_bs, aio_context, txn, errp);
|
||||
-
|
||||
-unref:
|
||||
- bdrv_unref(target_bs);
|
||||
-out:
|
||||
- aio_context_release(aio_context);
|
||||
- return job;
|
||||
-}
|
||||
-
|
||||
-void qmp_drive_backup(DriveBackup *arg, Error **errp)
|
||||
+void qmp_drive_backup(DriveBackup *backup, Error **errp)
|
||||
{
|
||||
-
|
||||
- BlockJob *job;
|
||||
- job = do_drive_backup(arg, NULL, errp);
|
||||
- if (job) {
|
||||
- job_start(&job->job);
|
||||
- }
|
||||
+ TransactionAction action = {
|
||||
+ .type = TRANSACTION_ACTION_KIND_DRIVE_BACKUP,
|
||||
+ .u.drive_backup.data = backup,
|
||||
+ };
|
||||
+ blockdev_do_action(&action, errp);
|
||||
}
|
||||
|
||||
BlockDeviceInfoList *qmp_query_named_block_nodes(Error **errp)
|
||||
diff --git a/tests/qemu-iotests/141.out b/tests/qemu-iotests/141.out
|
||||
index 3645675..263b680 100644
|
||||
--- a/tests/qemu-iotests/141.out
|
||||
+++ b/tests/qemu-iotests/141.out
|
||||
@@ -13,6 +13,8 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/m.
|
||||
Formatting 'TEST_DIR/o.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}}
|
||||
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "paused", "id": "job0"}}
|
||||
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}}
|
||||
{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}}
|
||||
{"error": {"class": "GenericError", "desc": "Node 'drv0' is busy: node is used as backing hd of 'NODE_NAME'"}}
|
||||
{'execute': 'block-job-cancel', 'arguments': {'device': 'job0'}}
|
||||
diff --git a/tests/qemu-iotests/185.out b/tests/qemu-iotests/185.out
|
||||
index 8379ac5..9a3b657 100644
|
||||
--- a/tests/qemu-iotests/185.out
|
||||
+++ b/tests/qemu-iotests/185.out
|
||||
@@ -65,6 +65,8 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l
|
||||
Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk"}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
|
||||
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "paused", "id": "disk"}}
|
||||
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
|
||||
{"return": {}}
|
||||
{ 'execute': 'quit' }
|
||||
{"return": {}}
|
||||
diff --git a/tests/qemu-iotests/219 b/tests/qemu-iotests/219
|
||||
index e0c5166..655f54d 100755
|
||||
--- a/tests/qemu-iotests/219
|
||||
+++ b/tests/qemu-iotests/219
|
||||
@@ -63,7 +63,7 @@ def test_pause_resume(vm):
|
||||
# logged immediately
|
||||
iotests.log(vm.qmp('query-jobs'))
|
||||
|
||||
-def test_job_lifecycle(vm, job, job_args, has_ready=False):
|
||||
+def test_job_lifecycle(vm, job, job_args, has_ready=False, is_mirror=False):
|
||||
global img_size
|
||||
|
||||
iotests.log('')
|
||||
@@ -135,6 +135,9 @@ def test_job_lifecycle(vm, job, job_args, has_ready=False):
|
||||
iotests.log('Waiting for PENDING state...')
|
||||
iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
|
||||
iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
|
||||
+ if is_mirror:
|
||||
+ iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
|
||||
+ iotests.log(iotests.filter_qmp_event(vm.event_wait('JOB_STATUS_CHANGE')))
|
||||
|
||||
if not job_args.get('auto-finalize', True):
|
||||
# PENDING state:
|
||||
@@ -218,7 +221,7 @@ with iotests.FilePath('disk.img') as disk_path, \
|
||||
|
||||
for auto_finalize in [True, False]:
|
||||
for auto_dismiss in [True, False]:
|
||||
- test_job_lifecycle(vm, 'drive-backup', job_args={
|
||||
+ test_job_lifecycle(vm, 'drive-backup', is_mirror=True, job_args={
|
||||
'device': 'drive0-node',
|
||||
'target': copy_path,
|
||||
'sync': 'full',
|
||||
diff --git a/tests/qemu-iotests/219.out b/tests/qemu-iotests/219.out
|
||||
index 8ebd3fe..0ea5d0b 100644
|
||||
--- a/tests/qemu-iotests/219.out
|
||||
+++ b/tests/qemu-iotests/219.out
|
||||
@@ -135,6 +135,8 @@ Pause/resume in RUNNING
|
||||
{"return": {}}
|
||||
|
||||
Waiting for PENDING state...
|
||||
+{"data": {"id": "job0", "status": "paused"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"data": {"id": "job0", "status": "running"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "waiting"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "pending"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "concluded"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
@@ -186,6 +188,8 @@ Pause/resume in RUNNING
|
||||
{"return": {}}
|
||||
|
||||
Waiting for PENDING state...
|
||||
+{"data": {"id": "job0", "status": "paused"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"data": {"id": "job0", "status": "running"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "waiting"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "pending"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "concluded"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
@@ -245,6 +249,8 @@ Pause/resume in RUNNING
|
||||
{"return": {}}
|
||||
|
||||
Waiting for PENDING state...
|
||||
+{"data": {"id": "job0", "status": "paused"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"data": {"id": "job0", "status": "running"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "waiting"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "pending"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"return": [{"current-progress": 4194304, "id": "job0", "status": "pending", "total-progress": 4194304, "type": "backup"}]}
|
||||
@@ -304,6 +310,8 @@ Pause/resume in RUNNING
|
||||
{"return": {}}
|
||||
|
||||
Waiting for PENDING state...
|
||||
+{"data": {"id": "job0", "status": "paused"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"data": {"id": "job0", "status": "running"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "waiting"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"data": {"id": "job0", "status": "pending"}, "event": "JOB_STATUS_CHANGE", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
{"return": [{"current-progress": 4194304, "id": "job0", "status": "pending", "total-progress": 4194304, "type": "backup"}]}
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,56 @@
|
||||
From f01178897c8f5ff98692a22059dd65e35677eaa3 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Jones <drjones@redhat.com>
|
||||
Date: Mon, 10 Feb 2020 17:33:58 +0000
|
||||
Subject: [PATCH 18/18] docs/arm-cpu-features: Make kvm-no-adjvtime comment
|
||||
clearer
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Andrew Jones <drjones@redhat.com>
|
||||
Message-id: <20200210173358.16896-3-drjones@redhat.com>
|
||||
Patchwork-id: 93772
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 2/2] docs/arm-cpu-features: Make kvm-no-adjvtime comment clearer
|
||||
Bugzilla: 1801320
|
||||
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
|
||||
RH-Acked-by: Gavin Shan <gshan@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1801320
|
||||
|
||||
Author: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
Date: Fri, 07 Feb 2020 14:04:28 +0000
|
||||
|
||||
docs/arm-cpu-features: Make kvm-no-adjvtime comment clearer
|
||||
|
||||
The bold text sounds like 'knock knock'. Only bolding the
|
||||
second 'not' makes it easier to read.
|
||||
|
||||
Fixes: dea101a1ae
|
||||
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
Reviewed-by: Andrew Jones <drjones@redhat.com>
|
||||
Message-id: 20200206225148.23923-1-philmd@redhat.com
|
||||
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
||||
|
||||
(cherry picked from commit fa3236a970b6ea5be3fa3ad258f1a75920ca1ebb)
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
docs/arm-cpu-features.rst | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/docs/arm-cpu-features.rst b/docs/arm-cpu-features.rst
|
||||
index 45d1eb6..48d5054 100644
|
||||
--- a/docs/arm-cpu-features.rst
|
||||
+++ b/docs/arm-cpu-features.rst
|
||||
@@ -185,7 +185,7 @@ the list of KVM VCPU features and their descriptions.
|
||||
|
||||
kvm-no-adjvtime By default kvm-no-adjvtime is disabled. This
|
||||
means that by default the virtual time
|
||||
- adjustment is enabled (vtime is *not not*
|
||||
+ adjustment is enabled (vtime is not *not*
|
||||
adjusted).
|
||||
|
||||
When virtual time adjustment is enabled each
|
||||
--
|
||||
1.8.3.1
|
||||
|
100
kvm-hmp-Allow-using-qdev-ID-for-qemu-io-command.patch
Normal file
100
kvm-hmp-Allow-using-qdev-ID-for-qemu-io-command.patch
Normal file
@ -0,0 +1,100 @@
|
||||
From cebc614e5ddd1f770c4d6dc26c066791f36e56df Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:24:02 +0000
|
||||
Subject: [PATCH 05/18] hmp: Allow using qdev ID for qemu-io command
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200207112404.25198-5-kwolf@redhat.com>
|
||||
Patchwork-id: 93750
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 4/6] hmp: Allow using qdev ID for qemu-io command
|
||||
Bugzilla: 1781637
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
In order to issue requests on an existing BlockBackend with the
|
||||
'qemu-io' HMP command, allow specifying the BlockBackend not only with a
|
||||
BlockBackend name, but also with a qdev ID/QOM path for a device that
|
||||
owns the (possibly anonymous) BlockBackend.
|
||||
|
||||
Because qdev names could be conflicting with BlockBackend and node
|
||||
names, introduce a -d option to explicitly address a device. If the
|
||||
option is not given, a BlockBackend or a node is addressed.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 89b6fc45614bb45dcd58f1590415afe5c2791abd)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hmp-commands.hx | 8 +++++---
|
||||
monitor/hmp-cmds.c | 28 ++++++++++++++++++----------
|
||||
2 files changed, 23 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/hmp-commands.hx b/hmp-commands.hx
|
||||
index cfcc044..dc23185 100644
|
||||
--- a/hmp-commands.hx
|
||||
+++ b/hmp-commands.hx
|
||||
@@ -1875,9 +1875,11 @@ ETEXI
|
||||
|
||||
{
|
||||
.name = "qemu-io",
|
||||
- .args_type = "device:B,command:s",
|
||||
- .params = "[device] \"[command]\"",
|
||||
- .help = "run a qemu-io command on a block device",
|
||||
+ .args_type = "qdev:-d,device:B,command:s",
|
||||
+ .params = "[-d] [device] \"[command]\"",
|
||||
+ .help = "run a qemu-io command on a block device\n\t\t\t"
|
||||
+ "-d: [device] is a device ID rather than a "
|
||||
+ "drive ID or node name",
|
||||
.cmd = hmp_qemu_io,
|
||||
},
|
||||
|
||||
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
||||
index b2551c1..5f8941d 100644
|
||||
--- a/monitor/hmp-cmds.c
|
||||
+++ b/monitor/hmp-cmds.c
|
||||
@@ -2468,23 +2468,31 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
BlockBackend *blk;
|
||||
BlockBackend *local_blk = NULL;
|
||||
+ bool qdev = qdict_get_try_bool(qdict, "qdev", false);
|
||||
const char* device = qdict_get_str(qdict, "device");
|
||||
const char* command = qdict_get_str(qdict, "command");
|
||||
Error *err = NULL;
|
||||
int ret;
|
||||
|
||||
- blk = blk_by_name(device);
|
||||
- if (!blk) {
|
||||
- BlockDriverState *bs = bdrv_lookup_bs(NULL, device, &err);
|
||||
- if (bs) {
|
||||
- blk = local_blk = blk_new(bdrv_get_aio_context(bs),
|
||||
- 0, BLK_PERM_ALL);
|
||||
- ret = blk_insert_bs(blk, bs, &err);
|
||||
- if (ret < 0) {
|
||||
+ if (qdev) {
|
||||
+ blk = blk_by_qdev_id(device, &err);
|
||||
+ if (!blk) {
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ } else {
|
||||
+ blk = blk_by_name(device);
|
||||
+ if (!blk) {
|
||||
+ BlockDriverState *bs = bdrv_lookup_bs(NULL, device, &err);
|
||||
+ if (bs) {
|
||||
+ blk = local_blk = blk_new(bdrv_get_aio_context(bs),
|
||||
+ 0, BLK_PERM_ALL);
|
||||
+ ret = blk_insert_bs(blk, bs, &err);
|
||||
+ if (ret < 0) {
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ } else {
|
||||
goto fail;
|
||||
}
|
||||
- } else {
|
||||
- goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
95
kvm-i386-Resolve-CPU-models-to-v1-by-default.patch
Normal file
95
kvm-i386-Resolve-CPU-models-to-v1-by-default.patch
Normal file
@ -0,0 +1,95 @@
|
||||
From ccda4494b0ea4b81b6b0c3e539a0bcf7e673c68c Mon Sep 17 00:00:00 2001
|
||||
From: Eduardo Habkost <ehabkost@redhat.com>
|
||||
Date: Thu, 5 Dec 2019 21:56:50 +0000
|
||||
Subject: [PATCH 01/18] i386: Resolve CPU models to v1 by default
|
||||
|
||||
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
|
||||
Message-id: <20191205225650.772600-2-ehabkost@redhat.com>
|
||||
Patchwork-id: 92907
|
||||
O-Subject: [RHEL-AV-8.1.1 qemu-kvm PATCH 1/1] i386: Resolve CPU models to v1 by default
|
||||
Bugzilla: 1787291 1779078 1779078
|
||||
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1779078
|
||||
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=25187823
|
||||
Upstream: submitted, Message-Id: <20191205223339.764534-1-ehabkost@redhat.com>
|
||||
|
||||
When using `query-cpu-definitions` using `-machine none`,
|
||||
QEMU is resolving all CPU models to their latest versions. The
|
||||
actual CPU model version being used by another machine type (e.g.
|
||||
`pc-q35-4.0`) might be different.
|
||||
|
||||
In theory, this was OK because the correct CPU model
|
||||
version is returned when using the correct `-machine` argument.
|
||||
|
||||
Except that in practice, this breaks libvirt expectations:
|
||||
libvirt always use `-machine none` when checking if a CPU model
|
||||
is runnable, because runnability is not expected to be affected
|
||||
when the machine type is changed.
|
||||
|
||||
For example, when running on a Haswell host without TSX,
|
||||
Haswell-v4 is runnable, but Haswell-v1 is not. On those hosts,
|
||||
`query-cpu-definitions` says Haswell is runnable if using
|
||||
`-machine none`, but Haswell is actually not runnable using any
|
||||
of the `pc-*` machine types (because they resolve Haswell to
|
||||
Haswell-v1). In other words, we're breaking the "runnability
|
||||
guarantee" we promised to not break for a few releases (see
|
||||
qemu-deprecated.texi).
|
||||
|
||||
To address this issue, change the default CPU model version to v1
|
||||
on all machine types, so we make `query-cpu-definitions` output
|
||||
when using `-machine none` match the results when using `pc-*`.
|
||||
This will change in the future (the plan is to always return the
|
||||
latest CPU model version if using `-machine none`), but only
|
||||
after giving libvirt the opportunity to adapt.
|
||||
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1779078
|
||||
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
qemu-deprecated.texi | 7 +++++++
|
||||
target/i386/cpu.c | 8 +++++++-
|
||||
2 files changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
|
||||
index 4b4b742..534ebe9 100644
|
||||
--- a/qemu-deprecated.texi
|
||||
+++ b/qemu-deprecated.texi
|
||||
@@ -374,6 +374,13 @@ guarantees must resolve the CPU model aliases using te
|
||||
``alias-of'' field returned by the ``query-cpu-definitions'' QMP
|
||||
command.
|
||||
|
||||
+While those guarantees are kept, the return value of
|
||||
+``query-cpu-definitions'' will have existing CPU model aliases
|
||||
+point to a version that doesn't break runnability guarantees
|
||||
+(specifically, version 1 of those CPU models). In future QEMU
|
||||
+versions, aliases will point to newer CPU model versions
|
||||
+depending on the machine type, so management software must
|
||||
+resolve CPU model aliases before starting a virtual machine.
|
||||
|
||||
@node Recently removed features
|
||||
@appendix Recently removed features
|
||||
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
||||
index 6dce6f2..863192c 100644
|
||||
--- a/target/i386/cpu.c
|
||||
+++ b/target/i386/cpu.c
|
||||
@@ -3926,7 +3926,13 @@ static PropValue tcg_default_props[] = {
|
||||
};
|
||||
|
||||
|
||||
-X86CPUVersion default_cpu_version = CPU_VERSION_LATEST;
|
||||
+/*
|
||||
+ * We resolve CPU model aliases using -v1 when using "-machine
|
||||
+ * none", but this is just for compatibility while libvirt isn't
|
||||
+ * adapted to resolve CPU model versions before creating VMs.
|
||||
+ * See "Runnability guarantee of CPU models" at * qemu-deprecated.texi.
|
||||
+ */
|
||||
+X86CPUVersion default_cpu_version = 1;
|
||||
|
||||
void x86_cpu_set_default_version(X86CPUVersion version)
|
||||
{
|
||||
--
|
||||
1.8.3.1
|
||||
|
59
kvm-iotests-Create-VM.blockdev_create.patch
Normal file
59
kvm-iotests-Create-VM.blockdev_create.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From 05fedde1374abb180cd2b51457385d8128aa7fe4 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:24:00 +0000
|
||||
Subject: [PATCH 03/18] iotests: Create VM.blockdev_create()
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200207112404.25198-3-kwolf@redhat.com>
|
||||
Patchwork-id: 93748
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 2/6] iotests: Create VM.blockdev_create()
|
||||
Bugzilla: 1781637
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
We have several almost identical copies of a blockdev_create() function
|
||||
in different test cases. Time to create one unified function in
|
||||
iotests.py.
|
||||
|
||||
To keep the diff managable, this patch only creates the function and
|
||||
follow-up patches will convert the individual test cases.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit e9dbd1cae86f7cb6f8e470e1485aeb0c6e23ae64)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
tests/qemu-iotests/iotests.py | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
|
||||
index 3cff671..5741efb 100644
|
||||
--- a/tests/qemu-iotests/iotests.py
|
||||
+++ b/tests/qemu-iotests/iotests.py
|
||||
@@ -638,6 +638,22 @@ class VM(qtest.QEMUQtestMachine):
|
||||
elif status == 'null':
|
||||
return error
|
||||
|
||||
+ # Returns None on success, and an error string on failure
|
||||
+ def blockdev_create(self, options, job_id='job0', filters=None):
|
||||
+ if filters is None:
|
||||
+ filters = [filter_qmp_testfiles]
|
||||
+ result = self.qmp_log('blockdev-create', filters=filters,
|
||||
+ job_id=job_id, options=options)
|
||||
+
|
||||
+ if 'return' in result:
|
||||
+ assert result['return'] == {}
|
||||
+ job_result = self.run_job(job_id)
|
||||
+ else:
|
||||
+ job_result = result['error']
|
||||
+
|
||||
+ log("")
|
||||
+ return job_result
|
||||
+
|
||||
def enable_migration_events(self, name):
|
||||
log('Enabling migration QMP events on %s...' % name)
|
||||
log(self.qmp('migrate-set-capabilities', capabilities=[
|
||||
--
|
||||
1.8.3.1
|
||||
|
46
kvm-iotests-Support-job-complete-in-run_job.patch
Normal file
46
kvm-iotests-Support-job-complete-in-run_job.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From a3778aef0be61dead835af39073a62bbf72c8e20 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:23:59 +0000
|
||||
Subject: [PATCH 02/18] iotests: Support job-complete in run_job()
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200207112404.25198-2-kwolf@redhat.com>
|
||||
Patchwork-id: 93746
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 1/6] iotests: Support job-complete in run_job()
|
||||
Bugzilla: 1781637
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
Automatically complete jobs that have a 'ready' state and need an
|
||||
explicit job-complete. Without this, run_job() would hang for such
|
||||
jobs.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Reviewed-by: Eric Blake <eblake@redhat.com>
|
||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
||||
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
||||
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
(cherry picked from commit 4688c4e32ec76004676470f11734478799673d6d)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
tests/qemu-iotests/iotests.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
|
||||
index df07089..3cff671 100644
|
||||
--- a/tests/qemu-iotests/iotests.py
|
||||
+++ b/tests/qemu-iotests/iotests.py
|
||||
@@ -617,6 +617,8 @@ class VM(qtest.QEMUQtestMachine):
|
||||
error = j['error']
|
||||
if use_log:
|
||||
log('Job failed: %s' % (j['error']))
|
||||
+ elif status == 'ready':
|
||||
+ self.qmp_log('job-complete', id=job)
|
||||
elif status == 'pending' and not auto_finalize:
|
||||
if pre_finalize:
|
||||
pre_finalize()
|
||||
--
|
||||
1.8.3.1
|
||||
|
189
kvm-iotests-Test-external-snapshot-with-VM-state.patch
Normal file
189
kvm-iotests-Test-external-snapshot-with-VM-state.patch
Normal file
@ -0,0 +1,189 @@
|
||||
From 38b0cff9703fc740c30f5874973ac1be88f94d9f Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:24:03 +0000
|
||||
Subject: [PATCH 06/18] iotests: Test external snapshot with VM state
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200207112404.25198-6-kwolf@redhat.com>
|
||||
Patchwork-id: 93752
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 5/6] iotests: Test external snapshot with VM state
|
||||
Bugzilla: 1781637
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
This tests creating an external snapshot with VM state (which results in
|
||||
an active overlay over an inactive backing file, which is also the root
|
||||
node of an inactive BlockBackend), re-activating the images and
|
||||
performing some operations to test that the re-activation worked as
|
||||
intended.
|
||||
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit f62f08ab7a9d902da70078992248ec5c98f652ad)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
tests/qemu-iotests/280 | 83 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
tests/qemu-iotests/280.out | 50 ++++++++++++++++++++++++++++
|
||||
tests/qemu-iotests/group | 1 +
|
||||
3 files changed, 134 insertions(+)
|
||||
create mode 100755 tests/qemu-iotests/280
|
||||
create mode 100644 tests/qemu-iotests/280.out
|
||||
|
||||
diff --git a/tests/qemu-iotests/280 b/tests/qemu-iotests/280
|
||||
new file mode 100755
|
||||
index 0000000..0b1fa8e
|
||||
--- /dev/null
|
||||
+++ b/tests/qemu-iotests/280
|
||||
@@ -0,0 +1,83 @@
|
||||
+#!/usr/bin/env python
|
||||
+#
|
||||
+# Copyright (C) 2019 Red Hat, Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+#
|
||||
+# Creator/Owner: Kevin Wolf <kwolf@redhat.com>
|
||||
+#
|
||||
+# Test migration to file for taking an external snapshot with VM state.
|
||||
+
|
||||
+import iotests
|
||||
+import os
|
||||
+
|
||||
+iotests.verify_image_format(supported_fmts=['qcow2'])
|
||||
+iotests.verify_protocol(supported=['file'])
|
||||
+iotests.verify_platform(['linux'])
|
||||
+
|
||||
+with iotests.FilePath('base') as base_path , \
|
||||
+ iotests.FilePath('top') as top_path, \
|
||||
+ iotests.VM() as vm:
|
||||
+
|
||||
+ iotests.qemu_img_log('create', '-f', iotests.imgfmt, base_path, '64M')
|
||||
+
|
||||
+ iotests.log('=== Launch VM ===')
|
||||
+ vm.add_object('iothread,id=iothread0')
|
||||
+ vm.add_blockdev('file,filename=%s,node-name=base-file' % (base_path))
|
||||
+ vm.add_blockdev('%s,file=base-file,node-name=base-fmt' % (iotests.imgfmt))
|
||||
+ vm.add_device('virtio-blk,drive=base-fmt,iothread=iothread0,id=vda')
|
||||
+ vm.launch()
|
||||
+
|
||||
+ vm.enable_migration_events('VM')
|
||||
+
|
||||
+ iotests.log('\n=== Migrate to file ===')
|
||||
+ vm.qmp_log('migrate', uri='exec:cat > /dev/null')
|
||||
+
|
||||
+ with iotests.Timeout(3, 'Migration does not complete'):
|
||||
+ vm.wait_migration()
|
||||
+
|
||||
+ iotests.log('\nVM is now stopped:')
|
||||
+ iotests.log(vm.qmp('query-migrate')['return']['status'])
|
||||
+ vm.qmp_log('query-status')
|
||||
+
|
||||
+ iotests.log('\n=== Create a snapshot of the disk image ===')
|
||||
+ vm.blockdev_create({
|
||||
+ 'driver': 'file',
|
||||
+ 'filename': top_path,
|
||||
+ 'size': 0,
|
||||
+ })
|
||||
+ vm.qmp_log('blockdev-add', node_name='top-file',
|
||||
+ driver='file', filename=top_path,
|
||||
+ filters=[iotests.filter_qmp_testfiles])
|
||||
+
|
||||
+ vm.blockdev_create({
|
||||
+ 'driver': iotests.imgfmt,
|
||||
+ 'file': 'top-file',
|
||||
+ 'size': 1024 * 1024,
|
||||
+ })
|
||||
+ vm.qmp_log('blockdev-add', node_name='top-fmt',
|
||||
+ driver=iotests.imgfmt, file='top-file')
|
||||
+
|
||||
+ vm.qmp_log('blockdev-snapshot', node='base-fmt', overlay='top-fmt')
|
||||
+
|
||||
+ iotests.log('\n=== Resume the VM and simulate a write request ===')
|
||||
+ vm.qmp_log('cont')
|
||||
+ iotests.log(vm.hmp_qemu_io('-d vda/virtio-backend', 'write 4k 4k'))
|
||||
+
|
||||
+ iotests.log('\n=== Commit it to the backing file ===')
|
||||
+ result = vm.qmp_log('block-commit', job_id='job0', auto_dismiss=False,
|
||||
+ device='top-fmt', top_node='top-fmt',
|
||||
+ filters=[iotests.filter_qmp_testfiles])
|
||||
+ if 'return' in result:
|
||||
+ vm.run_job('job0')
|
||||
diff --git a/tests/qemu-iotests/280.out b/tests/qemu-iotests/280.out
|
||||
new file mode 100644
|
||||
index 0000000..5d382fa
|
||||
--- /dev/null
|
||||
+++ b/tests/qemu-iotests/280.out
|
||||
@@ -0,0 +1,50 @@
|
||||
+Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16
|
||||
+
|
||||
+=== Launch VM ===
|
||||
+Enabling migration QMP events on VM...
|
||||
+{"return": {}}
|
||||
+
|
||||
+=== Migrate to file ===
|
||||
+{"execute": "migrate", "arguments": {"uri": "exec:cat > /dev/null"}}
|
||||
+{"return": {}}
|
||||
+{"data": {"status": "setup"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"data": {"status": "active"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"data": {"status": "completed"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+
|
||||
+VM is now stopped:
|
||||
+completed
|
||||
+{"execute": "query-status", "arguments": {}}
|
||||
+{"return": {"running": false, "singlestep": false, "status": "postmigrate"}}
|
||||
+
|
||||
+=== Create a snapshot of the disk image ===
|
||||
+{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "file", "filename": "TEST_DIR/PID-top", "size": 0}}}
|
||||
+{"return": {}}
|
||||
+{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||
+{"return": {}}
|
||||
+
|
||||
+{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-top", "node-name": "top-file"}}
|
||||
+{"return": {}}
|
||||
+{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "qcow2", "file": "top-file", "size": 1048576}}}
|
||||
+{"return": {}}
|
||||
+{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||
+{"return": {}}
|
||||
+
|
||||
+{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": "top-file", "node-name": "top-fmt"}}
|
||||
+{"return": {}}
|
||||
+{"execute": "blockdev-snapshot", "arguments": {"node": "base-fmt", "overlay": "top-fmt"}}
|
||||
+{"return": {}}
|
||||
+
|
||||
+=== Resume the VM and simulate a write request ===
|
||||
+{"execute": "cont", "arguments": {}}
|
||||
+{"return": {}}
|
||||
+{"return": ""}
|
||||
+
|
||||
+=== Commit it to the backing file ===
|
||||
+{"execute": "block-commit", "arguments": {"auto-dismiss": false, "device": "top-fmt", "job-id": "job0", "top-node": "top-fmt"}}
|
||||
+{"return": {}}
|
||||
+{"execute": "job-complete", "arguments": {"id": "job0"}}
|
||||
+{"return": {}}
|
||||
+{"data": {"device": "job0", "len": 65536, "offset": 65536, "speed": 0, "type": "commit"}, "event": "BLOCK_JOB_READY", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"data": {"device": "job0", "len": 65536, "offset": 65536, "speed": 0, "type": "commit"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||
+{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
||||
+{"return": {}}
|
||||
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
|
||||
index 06cc734..01301cd 100644
|
||||
--- a/tests/qemu-iotests/group
|
||||
+++ b/tests/qemu-iotests/group
|
||||
@@ -286,3 +286,4 @@
|
||||
272 rw
|
||||
273 backing quick
|
||||
277 rw quick
|
||||
+280 rw migration quick
|
||||
--
|
||||
1.8.3.1
|
||||
|
322
kvm-iotests-Test-handling-of-AioContexts-with-some-block.patch
Normal file
322
kvm-iotests-Test-handling-of-AioContexts-with-some-block.patch
Normal file
@ -0,0 +1,322 @@
|
||||
From 6b9a6ba9ed753ad7aa714b35de938ebeeb4fa6cb Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 10:27:49 +0000
|
||||
Subject: [PATCH 16/18] iotests: Test handling of AioContexts with some
|
||||
blockdev actions
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20200207112749.25073-10-slp@redhat.com>
|
||||
Patchwork-id: 93762
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 9/9] iotests: Test handling of AioContexts with some blockdev actions
|
||||
Bugzilla: 1745606 1746217 1773517 1779036 1782111 1782175 1783965
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
Includes the following tests:
|
||||
|
||||
- Adding a dirty bitmap.
|
||||
* RHBZ: 1782175
|
||||
|
||||
- Starting a drive-mirror to an NBD-backed target.
|
||||
* RHBZ: 1746217, 1773517
|
||||
|
||||
- Aborting an external snapshot transaction.
|
||||
* RHBZ: 1779036
|
||||
|
||||
- Aborting a blockdev backup transaction.
|
||||
* RHBZ: 1782111
|
||||
|
||||
For each one of them, a VM with a number of disks running in an
|
||||
IOThread AioContext is used.
|
||||
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 9b8c59e7610b9c5315ef093d801843dbe8debfac)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
tests/qemu-iotests/281 | 247 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
tests/qemu-iotests/281.out | 5 +
|
||||
tests/qemu-iotests/group | 1 +
|
||||
3 files changed, 253 insertions(+)
|
||||
create mode 100755 tests/qemu-iotests/281
|
||||
create mode 100644 tests/qemu-iotests/281.out
|
||||
|
||||
diff --git a/tests/qemu-iotests/281 b/tests/qemu-iotests/281
|
||||
new file mode 100755
|
||||
index 0000000..269d583
|
||||
--- /dev/null
|
||||
+++ b/tests/qemu-iotests/281
|
||||
@@ -0,0 +1,247 @@
|
||||
+#!/usr/bin/env python
|
||||
+#
|
||||
+# Test cases for blockdev + IOThread interactions
|
||||
+#
|
||||
+# Copyright (C) 2019 Red Hat, Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+#
|
||||
+
|
||||
+import os
|
||||
+import iotests
|
||||
+from iotests import qemu_img
|
||||
+
|
||||
+image_len = 64 * 1024 * 1024
|
||||
+
|
||||
+# Test for RHBZ#1782175
|
||||
+class TestDirtyBitmapIOThread(iotests.QMPTestCase):
|
||||
+ drive0_img = os.path.join(iotests.test_dir, 'drive0.img')
|
||||
+ images = { 'drive0': drive0_img }
|
||||
+
|
||||
+ def setUp(self):
|
||||
+ for name in self.images:
|
||||
+ qemu_img('create', '-f', iotests.imgfmt,
|
||||
+ self.images[name], str(image_len))
|
||||
+
|
||||
+ self.vm = iotests.VM()
|
||||
+ self.vm.add_object('iothread,id=iothread0')
|
||||
+
|
||||
+ for name in self.images:
|
||||
+ self.vm.add_blockdev('driver=file,filename=%s,node-name=file_%s'
|
||||
+ % (self.images[name], name))
|
||||
+ self.vm.add_blockdev('driver=qcow2,file=file_%s,node-name=%s'
|
||||
+ % (name, name))
|
||||
+
|
||||
+ self.vm.launch()
|
||||
+ self.vm.qmp('x-blockdev-set-iothread',
|
||||
+ node_name='drive0', iothread='iothread0',
|
||||
+ force=True)
|
||||
+
|
||||
+ def tearDown(self):
|
||||
+ self.vm.shutdown()
|
||||
+ for name in self.images:
|
||||
+ os.remove(self.images[name])
|
||||
+
|
||||
+ def test_add_dirty_bitmap(self):
|
||||
+ result = self.vm.qmp(
|
||||
+ 'block-dirty-bitmap-add',
|
||||
+ node='drive0',
|
||||
+ name='bitmap1',
|
||||
+ persistent=True,
|
||||
+ )
|
||||
+
|
||||
+ self.assert_qmp(result, 'return', {})
|
||||
+
|
||||
+
|
||||
+# Test for RHBZ#1746217 & RHBZ#1773517
|
||||
+class TestNBDMirrorIOThread(iotests.QMPTestCase):
|
||||
+ nbd_sock = os.path.join(iotests.sock_dir, 'nbd.sock')
|
||||
+ drive0_img = os.path.join(iotests.test_dir, 'drive0.img')
|
||||
+ mirror_img = os.path.join(iotests.test_dir, 'mirror.img')
|
||||
+ images = { 'drive0': drive0_img, 'mirror': mirror_img }
|
||||
+
|
||||
+ def setUp(self):
|
||||
+ for name in self.images:
|
||||
+ qemu_img('create', '-f', iotests.imgfmt,
|
||||
+ self.images[name], str(image_len))
|
||||
+
|
||||
+ self.vm_src = iotests.VM(path_suffix='src')
|
||||
+ self.vm_src.add_object('iothread,id=iothread0')
|
||||
+ self.vm_src.add_blockdev('driver=file,filename=%s,node-name=file0'
|
||||
+ % (self.drive0_img))
|
||||
+ self.vm_src.add_blockdev('driver=qcow2,file=file0,node-name=drive0')
|
||||
+ self.vm_src.launch()
|
||||
+ self.vm_src.qmp('x-blockdev-set-iothread',
|
||||
+ node_name='drive0', iothread='iothread0',
|
||||
+ force=True)
|
||||
+
|
||||
+ self.vm_tgt = iotests.VM(path_suffix='tgt')
|
||||
+ self.vm_tgt.add_object('iothread,id=iothread0')
|
||||
+ self.vm_tgt.add_blockdev('driver=file,filename=%s,node-name=file0'
|
||||
+ % (self.mirror_img))
|
||||
+ self.vm_tgt.add_blockdev('driver=qcow2,file=file0,node-name=drive0')
|
||||
+ self.vm_tgt.launch()
|
||||
+ self.vm_tgt.qmp('x-blockdev-set-iothread',
|
||||
+ node_name='drive0', iothread='iothread0',
|
||||
+ force=True)
|
||||
+
|
||||
+ def tearDown(self):
|
||||
+ self.vm_src.shutdown()
|
||||
+ self.vm_tgt.shutdown()
|
||||
+ for name in self.images:
|
||||
+ os.remove(self.images[name])
|
||||
+
|
||||
+ def test_nbd_mirror(self):
|
||||
+ result = self.vm_tgt.qmp(
|
||||
+ 'nbd-server-start',
|
||||
+ addr={
|
||||
+ 'type': 'unix',
|
||||
+ 'data': { 'path': self.nbd_sock }
|
||||
+ }
|
||||
+ )
|
||||
+ self.assert_qmp(result, 'return', {})
|
||||
+
|
||||
+ result = self.vm_tgt.qmp(
|
||||
+ 'nbd-server-add',
|
||||
+ device='drive0',
|
||||
+ writable=True
|
||||
+ )
|
||||
+ self.assert_qmp(result, 'return', {})
|
||||
+
|
||||
+ result = self.vm_src.qmp(
|
||||
+ 'drive-mirror',
|
||||
+ device='drive0',
|
||||
+ target='nbd+unix:///drive0?socket=' + self.nbd_sock,
|
||||
+ sync='full',
|
||||
+ mode='existing',
|
||||
+ speed=64*1024*1024,
|
||||
+ job_id='j1'
|
||||
+ )
|
||||
+ self.assert_qmp(result, 'return', {})
|
||||
+
|
||||
+ self.vm_src.event_wait(name="BLOCK_JOB_READY")
|
||||
+
|
||||
+
|
||||
+# Test for RHBZ#1779036
|
||||
+class TestExternalSnapshotAbort(iotests.QMPTestCase):
|
||||
+ drive0_img = os.path.join(iotests.test_dir, 'drive0.img')
|
||||
+ snapshot_img = os.path.join(iotests.test_dir, 'snapshot.img')
|
||||
+ images = { 'drive0': drive0_img, 'snapshot': snapshot_img }
|
||||
+
|
||||
+ def setUp(self):
|
||||
+ for name in self.images:
|
||||
+ qemu_img('create', '-f', iotests.imgfmt,
|
||||
+ self.images[name], str(image_len))
|
||||
+
|
||||
+ self.vm = iotests.VM()
|
||||
+ self.vm.add_object('iothread,id=iothread0')
|
||||
+ self.vm.add_blockdev('driver=file,filename=%s,node-name=file0'
|
||||
+ % (self.drive0_img))
|
||||
+ self.vm.add_blockdev('driver=qcow2,file=file0,node-name=drive0')
|
||||
+ self.vm.launch()
|
||||
+ self.vm.qmp('x-blockdev-set-iothread',
|
||||
+ node_name='drive0', iothread='iothread0',
|
||||
+ force=True)
|
||||
+
|
||||
+ def tearDown(self):
|
||||
+ self.vm.shutdown()
|
||||
+ for name in self.images:
|
||||
+ os.remove(self.images[name])
|
||||
+
|
||||
+ def test_external_snapshot_abort(self):
|
||||
+ # Use a two actions transaction with a bogus values on the second
|
||||
+ # one to trigger an abort of the transaction.
|
||||
+ result = self.vm.qmp('transaction', actions=[
|
||||
+ {
|
||||
+ 'type': 'blockdev-snapshot-sync',
|
||||
+ 'data': { 'node-name': 'drive0',
|
||||
+ 'snapshot-file': self.snapshot_img,
|
||||
+ 'snapshot-node-name': 'snap1',
|
||||
+ 'mode': 'absolute-paths',
|
||||
+ 'format': 'qcow2' }
|
||||
+ },
|
||||
+ {
|
||||
+ 'type': 'blockdev-snapshot-sync',
|
||||
+ 'data': { 'node-name': 'drive0',
|
||||
+ 'snapshot-file': '/fakesnapshot',
|
||||
+ 'snapshot-node-name': 'snap2',
|
||||
+ 'mode': 'absolute-paths',
|
||||
+ 'format': 'qcow2' }
|
||||
+ },
|
||||
+ ])
|
||||
+
|
||||
+ # Crashes on failure, we expect this error.
|
||||
+ self.assert_qmp(result, 'error/class', 'GenericError')
|
||||
+
|
||||
+
|
||||
+# Test for RHBZ#1782111
|
||||
+class TestBlockdevBackupAbort(iotests.QMPTestCase):
|
||||
+ drive0_img = os.path.join(iotests.test_dir, 'drive0.img')
|
||||
+ drive1_img = os.path.join(iotests.test_dir, 'drive1.img')
|
||||
+ snap0_img = os.path.join(iotests.test_dir, 'snap0.img')
|
||||
+ snap1_img = os.path.join(iotests.test_dir, 'snap1.img')
|
||||
+ images = { 'drive0': drive0_img,
|
||||
+ 'drive1': drive1_img,
|
||||
+ 'snap0': snap0_img,
|
||||
+ 'snap1': snap1_img }
|
||||
+
|
||||
+ def setUp(self):
|
||||
+ for name in self.images:
|
||||
+ qemu_img('create', '-f', iotests.imgfmt,
|
||||
+ self.images[name], str(image_len))
|
||||
+
|
||||
+ self.vm = iotests.VM()
|
||||
+ self.vm.add_object('iothread,id=iothread0')
|
||||
+ self.vm.add_device('virtio-scsi,iothread=iothread0')
|
||||
+
|
||||
+ for name in self.images:
|
||||
+ self.vm.add_blockdev('driver=file,filename=%s,node-name=file_%s'
|
||||
+ % (self.images[name], name))
|
||||
+ self.vm.add_blockdev('driver=qcow2,file=file_%s,node-name=%s'
|
||||
+ % (name, name))
|
||||
+
|
||||
+ self.vm.add_device('scsi-hd,drive=drive0')
|
||||
+ self.vm.add_device('scsi-hd,drive=drive1')
|
||||
+ self.vm.launch()
|
||||
+
|
||||
+ def tearDown(self):
|
||||
+ self.vm.shutdown()
|
||||
+ for name in self.images:
|
||||
+ os.remove(self.images[name])
|
||||
+
|
||||
+ def test_blockdev_backup_abort(self):
|
||||
+ # Use a two actions transaction with a bogus values on the second
|
||||
+ # one to trigger an abort of the transaction.
|
||||
+ result = self.vm.qmp('transaction', actions=[
|
||||
+ {
|
||||
+ 'type': 'blockdev-backup',
|
||||
+ 'data': { 'device': 'drive0',
|
||||
+ 'target': 'snap0',
|
||||
+ 'sync': 'full',
|
||||
+ 'job-id': 'j1' }
|
||||
+ },
|
||||
+ {
|
||||
+ 'type': 'blockdev-backup',
|
||||
+ 'data': { 'device': 'drive1',
|
||||
+ 'target': 'snap1',
|
||||
+ 'sync': 'full' }
|
||||
+ },
|
||||
+ ])
|
||||
+
|
||||
+ # Hangs on failure, we expect this error.
|
||||
+ self.assert_qmp(result, 'error/class', 'GenericError')
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ iotests.main(supported_fmts=['qcow2'],
|
||||
+ supported_protocols=['file'])
|
||||
diff --git a/tests/qemu-iotests/281.out b/tests/qemu-iotests/281.out
|
||||
new file mode 100644
|
||||
index 0000000..89968f3
|
||||
--- /dev/null
|
||||
+++ b/tests/qemu-iotests/281.out
|
||||
@@ -0,0 +1,5 @@
|
||||
+....
|
||||
+----------------------------------------------------------------------
|
||||
+Ran 4 tests
|
||||
+
|
||||
+OK
|
||||
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
|
||||
index 01301cd..c0e8197 100644
|
||||
--- a/tests/qemu-iotests/group
|
||||
+++ b/tests/qemu-iotests/group
|
||||
@@ -287,3 +287,4 @@
|
||||
273 backing quick
|
||||
277 rw quick
|
||||
280 rw migration quick
|
||||
+281 rw quick
|
||||
--
|
||||
1.8.3.1
|
||||
|
123
kvm-iotests.py-Let-wait_migration-wait-even-more.patch
Normal file
123
kvm-iotests.py-Let-wait_migration-wait-even-more.patch
Normal file
@ -0,0 +1,123 @@
|
||||
From d6df1426ae65b3a0d50bdbb1f8a7246386dd6ebf Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 7 Feb 2020 11:24:04 +0000
|
||||
Subject: [PATCH 07/18] iotests.py: Let wait_migration wait even more
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: <20200207112404.25198-7-kwolf@redhat.com>
|
||||
Patchwork-id: 93751
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 6/6] iotests.py: Let wait_migration wait even more
|
||||
Bugzilla: 1781637
|
||||
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
|
||||
From: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
The "migration completed" event may be sent (on the source, to be
|
||||
specific) before the migration is actually completed, so the VM runstate
|
||||
will still be "finish-migrate" instead of "postmigrate". So ask the
|
||||
users of VM.wait_migration() to specify the final runstate they desire
|
||||
and then poll the VM until it has reached that state. (This should be
|
||||
over very quickly, so busy polling is fine.)
|
||||
|
||||
Without this patch, I see intermittent failures in the new iotest 280
|
||||
under high system load. I have not yet seen such failures with other
|
||||
iotests that use VM.wait_migration() and query-status afterwards, but
|
||||
maybe they just occur even more rarely, or it is because they also wait
|
||||
on the destination VM to be running.
|
||||
|
||||
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 8da7969bd7014f6de037d8ae132b40721944b186)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
tests/qemu-iotests/234 | 8 ++++----
|
||||
tests/qemu-iotests/262 | 4 ++--
|
||||
tests/qemu-iotests/280 | 2 +-
|
||||
tests/qemu-iotests/iotests.py | 6 +++++-
|
||||
4 files changed, 12 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/tests/qemu-iotests/234 b/tests/qemu-iotests/234
|
||||
index 34c818c..59a7f94 100755
|
||||
--- a/tests/qemu-iotests/234
|
||||
+++ b/tests/qemu-iotests/234
|
||||
@@ -69,9 +69,9 @@ with iotests.FilePath('img') as img_path, \
|
||||
iotests.log(vm_a.qmp('migrate', uri='exec:cat >%s' % (fifo_a)))
|
||||
with iotests.Timeout(3, 'Migration does not complete'):
|
||||
# Wait for the source first (which includes setup=setup)
|
||||
- vm_a.wait_migration()
|
||||
+ vm_a.wait_migration('postmigrate')
|
||||
# Wait for the destination second (which does not)
|
||||
- vm_b.wait_migration()
|
||||
+ vm_b.wait_migration('running')
|
||||
|
||||
iotests.log(vm_a.qmp('query-migrate')['return']['status'])
|
||||
iotests.log(vm_b.qmp('query-migrate')['return']['status'])
|
||||
@@ -98,9 +98,9 @@ with iotests.FilePath('img') as img_path, \
|
||||
iotests.log(vm_b.qmp('migrate', uri='exec:cat >%s' % (fifo_b)))
|
||||
with iotests.Timeout(3, 'Migration does not complete'):
|
||||
# Wait for the source first (which includes setup=setup)
|
||||
- vm_b.wait_migration()
|
||||
+ vm_b.wait_migration('postmigrate')
|
||||
# Wait for the destination second (which does not)
|
||||
- vm_a.wait_migration()
|
||||
+ vm_a.wait_migration('running')
|
||||
|
||||
iotests.log(vm_a.qmp('query-migrate')['return']['status'])
|
||||
iotests.log(vm_b.qmp('query-migrate')['return']['status'])
|
||||
diff --git a/tests/qemu-iotests/262 b/tests/qemu-iotests/262
|
||||
index 0963daa..bbcb526 100755
|
||||
--- a/tests/qemu-iotests/262
|
||||
+++ b/tests/qemu-iotests/262
|
||||
@@ -71,9 +71,9 @@ with iotests.FilePath('img') as img_path, \
|
||||
iotests.log(vm_a.qmp('migrate', uri='exec:cat >%s' % (fifo)))
|
||||
with iotests.Timeout(3, 'Migration does not complete'):
|
||||
# Wait for the source first (which includes setup=setup)
|
||||
- vm_a.wait_migration()
|
||||
+ vm_a.wait_migration('postmigrate')
|
||||
# Wait for the destination second (which does not)
|
||||
- vm_b.wait_migration()
|
||||
+ vm_b.wait_migration('running')
|
||||
|
||||
iotests.log(vm_a.qmp('query-migrate')['return']['status'])
|
||||
iotests.log(vm_b.qmp('query-migrate')['return']['status'])
|
||||
diff --git a/tests/qemu-iotests/280 b/tests/qemu-iotests/280
|
||||
index 0b1fa8e..85e9114 100755
|
||||
--- a/tests/qemu-iotests/280
|
||||
+++ b/tests/qemu-iotests/280
|
||||
@@ -45,7 +45,7 @@ with iotests.FilePath('base') as base_path , \
|
||||
vm.qmp_log('migrate', uri='exec:cat > /dev/null')
|
||||
|
||||
with iotests.Timeout(3, 'Migration does not complete'):
|
||||
- vm.wait_migration()
|
||||
+ vm.wait_migration('postmigrate')
|
||||
|
||||
iotests.log('\nVM is now stopped:')
|
||||
iotests.log(vm.qmp('query-migrate')['return']['status'])
|
||||
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
|
||||
index 5741efb..0c55f7b 100644
|
||||
--- a/tests/qemu-iotests/iotests.py
|
||||
+++ b/tests/qemu-iotests/iotests.py
|
||||
@@ -663,12 +663,16 @@ class VM(qtest.QEMUQtestMachine):
|
||||
}
|
||||
]))
|
||||
|
||||
- def wait_migration(self):
|
||||
+ def wait_migration(self, expect_runstate):
|
||||
while True:
|
||||
event = self.event_wait('MIGRATION')
|
||||
log(event, filters=[filter_qmp_event])
|
||||
if event['data']['status'] == 'completed':
|
||||
break
|
||||
+ # The event may occur in finish-migrate, so wait for the expected
|
||||
+ # post-migration runstate
|
||||
+ while self.qmp('query-status')['return']['status'] != expect_runstate:
|
||||
+ pass
|
||||
|
||||
def node_info(self, node_name):
|
||||
nodes = self.qmp('query-named-block-nodes')
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,81 @@
|
||||
From c82cf5c08617c947b34eb490d1714729103e3379 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Jones <drjones@redhat.com>
|
||||
Date: Mon, 10 Feb 2020 17:33:57 +0000
|
||||
Subject: [PATCH 17/18] target/arm/monitor: query-cpu-model-expansion crashed
|
||||
qemu when using machine type none
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Andrew Jones <drjones@redhat.com>
|
||||
Message-id: <20200210173358.16896-2-drjones@redhat.com>
|
||||
Patchwork-id: 93773
|
||||
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/2] target/arm/monitor: query-cpu-model-expansion crashed qemu when using machine type none
|
||||
Bugzilla: 1801320
|
||||
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
|
||||
RH-Acked-by: Gavin Shan <gshan@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1801320
|
||||
|
||||
Author: Liang Yan <lyan@suse.com>
|
||||
Date: Fri, 07 Feb 2020 14:04:21 +0000
|
||||
|
||||
target/arm/monitor: query-cpu-model-expansion crashed qemu when using machine type none
|
||||
|
||||
Commit e19afd566781 mentioned that target-arm only supports queryable
|
||||
cpu models 'max', 'host', and the current type when KVM is in use.
|
||||
The logic works well until using machine type none.
|
||||
|
||||
For machine type none, cpu_type will be null if cpu option is not
|
||||
set by command line, strlen(cpu_type) will terminate process.
|
||||
So We add a check above it.
|
||||
|
||||
This won't affect i386 and s390x since they do not use current_cpu.
|
||||
|
||||
Signed-off-by: Liang Yan <lyan@suse.com>
|
||||
Message-id: 20200203134251.12986-1-lyan@suse.com
|
||||
Reviewed-by: Andrew Jones <drjones@redhat.com>
|
||||
Tested-by: Andrew Jones <drjones@redhat.com>
|
||||
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
||||
|
||||
(cherry picked from commit 0999a4ba8718aa96105b978d3567fc7e90244c7e)
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
target/arm/monitor.c | 15 +++++++++------
|
||||
1 file changed, 9 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/target/arm/monitor.c b/target/arm/monitor.c
|
||||
index 9725dff..c2dc790 100644
|
||||
--- a/target/arm/monitor.c
|
||||
+++ b/target/arm/monitor.c
|
||||
@@ -137,17 +137,20 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
|
||||
}
|
||||
|
||||
if (kvm_enabled()) {
|
||||
- const char *cpu_type = current_machine->cpu_type;
|
||||
- int len = strlen(cpu_type) - strlen(ARM_CPU_TYPE_SUFFIX);
|
||||
bool supported = false;
|
||||
|
||||
if (!strcmp(model->name, "host") || !strcmp(model->name, "max")) {
|
||||
/* These are kvmarm's recommended cpu types */
|
||||
supported = true;
|
||||
- } else if (strlen(model->name) == len &&
|
||||
- !strncmp(model->name, cpu_type, len)) {
|
||||
- /* KVM is enabled and we're using this type, so it works. */
|
||||
- supported = true;
|
||||
+ } else if (current_machine->cpu_type) {
|
||||
+ const char *cpu_type = current_machine->cpu_type;
|
||||
+ int len = strlen(cpu_type) - strlen(ARM_CPU_TYPE_SUFFIX);
|
||||
+
|
||||
+ if (strlen(model->name) == len &&
|
||||
+ !strncmp(model->name, cpu_type, len)) {
|
||||
+ /* KVM is enabled and we're using this type, so it works. */
|
||||
+ supported = true;
|
||||
+ }
|
||||
}
|
||||
if (!supported) {
|
||||
error_setg(errp, "We cannot guarantee the CPU type '%s' works "
|
||||
--
|
||||
1.8.3.1
|
||||
|
137
qemu-kvm.spec
137
qemu-kvm.spec
@ -67,7 +67,7 @@ Obsoletes: %1-rhev
|
||||
Summary: QEMU is a machine emulator and virtualizer
|
||||
Name: qemu-kvm
|
||||
Version: 4.2.0
|
||||
Release: 9%{?dist}
|
||||
Release: 10%{?dist}
|
||||
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
|
||||
Epoch: 15
|
||||
License: GPLv2 and GPLv2+ and CC-BY
|
||||
@ -401,6 +401,99 @@ Patch160: kvm-migration-Define-VMSTATE_INSTANCE_ID_ANY.patch
|
||||
Patch161: kvm-migration-Change-SaveStateEntry.instance_id-into-uin.patch
|
||||
# For bz#1529231 - [q35] VM hangs after migration with 200 vCPUs
|
||||
Patch162: kvm-apic-Use-32bit-APIC-ID-for-migration-instance-ID.patch
|
||||
# For bz#1779078 - RHVH 4.4: Failed to run VM on 4.3/4.4 engine (Exit message: the CPU is incompatible with host CPU: Host CPU does not provide required features: hle, rtm)
|
||||
# For bz#1787291 - RHVH 4.4: Failed to run VM on 4.3/4.4 engine (Exit message: the CPU is incompatible with host CPU: Host CPU does not provide required features: hle, rtm) [rhel-8.1.0.z]
|
||||
# For bz#1779078 - RHVH 4.4: Failed to run VM on 4.3/4.4 engine (Exit message: the CPU is incompatible with host CPU: Host CPU does not provide required features: hle, rtm)
|
||||
# For bz#1779078 - RHVH 4.4: Failed to run VM on 4.3/4.4 engine (Exit message: the CPU is incompatible with host CPU: Host CPU does not provide required features: hle, rtm)
|
||||
Patch163: kvm-i386-Resolve-CPU-models-to-v1-by-default.patch
|
||||
# For bz#1781637 - qemu crashed when do mem and disk snapshot
|
||||
Patch164: kvm-iotests-Support-job-complete-in-run_job.patch
|
||||
# For bz#1781637 - qemu crashed when do mem and disk snapshot
|
||||
Patch165: kvm-iotests-Create-VM.blockdev_create.patch
|
||||
# For bz#1781637 - qemu crashed when do mem and disk snapshot
|
||||
Patch166: kvm-block-Activate-recursively-even-for-already-active-n.patch
|
||||
# For bz#1781637 - qemu crashed when do mem and disk snapshot
|
||||
Patch167: kvm-hmp-Allow-using-qdev-ID-for-qemu-io-command.patch
|
||||
# For bz#1781637 - qemu crashed when do mem and disk snapshot
|
||||
Patch168: kvm-iotests-Test-external-snapshot-with-VM-state.patch
|
||||
# For bz#1781637 - qemu crashed when do mem and disk snapshot
|
||||
Patch169: kvm-iotests.py-Let-wait_migration-wait-even-more.patch
|
||||
# For bz#1745606 - Qemu hang when do incremental live backup in transaction mode without bitmap
|
||||
# For bz#1746217 - Src qemu hang when do storage vm migration during guest installation
|
||||
# For bz#1773517 - Src qemu hang when do storage vm migration with dataplane enable
|
||||
# For bz#1779036 - Qemu coredump when do snapshot in transaction mode with one snapshot path not exist
|
||||
# For bz#1782111 - Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable)
|
||||
# For bz#1782175 - Qemu core dump when add persistent bitmap(data plane enable)
|
||||
# For bz#1783965 - Qemu core dump when do backup with sync: bitmap and no bitmap provided
|
||||
Patch170: kvm-blockdev-fix-coding-style-issues-in-drive_backup_pre.patch
|
||||
# For bz#1745606 - Qemu hang when do incremental live backup in transaction mode without bitmap
|
||||
# For bz#1746217 - Src qemu hang when do storage vm migration during guest installation
|
||||
# For bz#1773517 - Src qemu hang when do storage vm migration with dataplane enable
|
||||
# For bz#1779036 - Qemu coredump when do snapshot in transaction mode with one snapshot path not exist
|
||||
# For bz#1782111 - Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable)
|
||||
# For bz#1782175 - Qemu core dump when add persistent bitmap(data plane enable)
|
||||
# For bz#1783965 - Qemu core dump when do backup with sync: bitmap and no bitmap provided
|
||||
Patch171: kvm-blockdev-unify-qmp_drive_backup-and-drive-backup-tra.patch
|
||||
# For bz#1745606 - Qemu hang when do incremental live backup in transaction mode without bitmap
|
||||
# For bz#1746217 - Src qemu hang when do storage vm migration during guest installation
|
||||
# For bz#1773517 - Src qemu hang when do storage vm migration with dataplane enable
|
||||
# For bz#1779036 - Qemu coredump when do snapshot in transaction mode with one snapshot path not exist
|
||||
# For bz#1782111 - Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable)
|
||||
# For bz#1782175 - Qemu core dump when add persistent bitmap(data plane enable)
|
||||
# For bz#1783965 - Qemu core dump when do backup with sync: bitmap and no bitmap provided
|
||||
Patch172: kvm-blockdev-unify-qmp_blockdev_backup-and-blockdev-back.patch
|
||||
# For bz#1745606 - Qemu hang when do incremental live backup in transaction mode without bitmap
|
||||
# For bz#1746217 - Src qemu hang when do storage vm migration during guest installation
|
||||
# For bz#1773517 - Src qemu hang when do storage vm migration with dataplane enable
|
||||
# For bz#1779036 - Qemu coredump when do snapshot in transaction mode with one snapshot path not exist
|
||||
# For bz#1782111 - Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable)
|
||||
# For bz#1782175 - Qemu core dump when add persistent bitmap(data plane enable)
|
||||
# For bz#1783965 - Qemu core dump when do backup with sync: bitmap and no bitmap provided
|
||||
Patch173: kvm-blockdev-honor-bdrv_try_set_aio_context-context-requ.patch
|
||||
# For bz#1745606 - Qemu hang when do incremental live backup in transaction mode without bitmap
|
||||
# For bz#1746217 - Src qemu hang when do storage vm migration during guest installation
|
||||
# For bz#1773517 - Src qemu hang when do storage vm migration with dataplane enable
|
||||
# For bz#1779036 - Qemu coredump when do snapshot in transaction mode with one snapshot path not exist
|
||||
# For bz#1782111 - Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable)
|
||||
# For bz#1782175 - Qemu core dump when add persistent bitmap(data plane enable)
|
||||
# For bz#1783965 - Qemu core dump when do backup with sync: bitmap and no bitmap provided
|
||||
Patch174: kvm-backup-top-Begin-drain-earlier.patch
|
||||
# For bz#1745606 - Qemu hang when do incremental live backup in transaction mode without bitmap
|
||||
# For bz#1746217 - Src qemu hang when do storage vm migration during guest installation
|
||||
# For bz#1773517 - Src qemu hang when do storage vm migration with dataplane enable
|
||||
# For bz#1779036 - Qemu coredump when do snapshot in transaction mode with one snapshot path not exist
|
||||
# For bz#1782111 - Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable)
|
||||
# For bz#1782175 - Qemu core dump when add persistent bitmap(data plane enable)
|
||||
# For bz#1783965 - Qemu core dump when do backup with sync: bitmap and no bitmap provided
|
||||
Patch175: kvm-block-backup-top-Don-t-acquire-context-while-droppin.patch
|
||||
# For bz#1745606 - Qemu hang when do incremental live backup in transaction mode without bitmap
|
||||
# For bz#1746217 - Src qemu hang when do storage vm migration during guest installation
|
||||
# For bz#1773517 - Src qemu hang when do storage vm migration with dataplane enable
|
||||
# For bz#1779036 - Qemu coredump when do snapshot in transaction mode with one snapshot path not exist
|
||||
# For bz#1782111 - Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable)
|
||||
# For bz#1782175 - Qemu core dump when add persistent bitmap(data plane enable)
|
||||
# For bz#1783965 - Qemu core dump when do backup with sync: bitmap and no bitmap provided
|
||||
Patch176: kvm-blockdev-Acquire-AioContext-on-dirty-bitmap-function.patch
|
||||
# For bz#1745606 - Qemu hang when do incremental live backup in transaction mode without bitmap
|
||||
# For bz#1746217 - Src qemu hang when do storage vm migration during guest installation
|
||||
# For bz#1773517 - Src qemu hang when do storage vm migration with dataplane enable
|
||||
# For bz#1779036 - Qemu coredump when do snapshot in transaction mode with one snapshot path not exist
|
||||
# For bz#1782111 - Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable)
|
||||
# For bz#1782175 - Qemu core dump when add persistent bitmap(data plane enable)
|
||||
# For bz#1783965 - Qemu core dump when do backup with sync: bitmap and no bitmap provided
|
||||
Patch177: kvm-blockdev-Return-bs-to-the-proper-context-on-snapshot.patch
|
||||
# For bz#1745606 - Qemu hang when do incremental live backup in transaction mode without bitmap
|
||||
# For bz#1746217 - Src qemu hang when do storage vm migration during guest installation
|
||||
# For bz#1773517 - Src qemu hang when do storage vm migration with dataplane enable
|
||||
# For bz#1779036 - Qemu coredump when do snapshot in transaction mode with one snapshot path not exist
|
||||
# For bz#1782111 - Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable)
|
||||
# For bz#1782175 - Qemu core dump when add persistent bitmap(data plane enable)
|
||||
# For bz#1783965 - Qemu core dump when do backup with sync: bitmap and no bitmap provided
|
||||
Patch178: kvm-iotests-Test-handling-of-AioContexts-with-some-block.patch
|
||||
# For bz#1801320 - aarch64: backport query-cpu-model-expansion and adjvtime document fixes
|
||||
Patch179: kvm-target-arm-monitor-query-cpu-model-expansion-crashed.patch
|
||||
# For bz#1801320 - aarch64: backport query-cpu-model-expansion and adjvtime document fixes
|
||||
Patch180: kvm-docs-arm-cpu-features-Make-kvm-no-adjvtime-comment-c.patch
|
||||
|
||||
BuildRequires: wget
|
||||
BuildRequires: rpm-build
|
||||
@ -1334,6 +1427,48 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Feb 14 2020 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.2.0-10.el8
|
||||
- kvm-i386-Resolve-CPU-models-to-v1-by-default.patch [bz#1779078 bz#1787291 bz#1779078 bz#1779078]
|
||||
- kvm-iotests-Support-job-complete-in-run_job.patch [bz#1781637]
|
||||
- kvm-iotests-Create-VM.blockdev_create.patch [bz#1781637]
|
||||
- kvm-block-Activate-recursively-even-for-already-active-n.patch [bz#1781637]
|
||||
- kvm-hmp-Allow-using-qdev-ID-for-qemu-io-command.patch [bz#1781637]
|
||||
- kvm-iotests-Test-external-snapshot-with-VM-state.patch [bz#1781637]
|
||||
- kvm-iotests.py-Let-wait_migration-wait-even-more.patch [bz#1781637]
|
||||
- kvm-blockdev-fix-coding-style-issues-in-drive_backup_pre.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965]
|
||||
- kvm-blockdev-unify-qmp_drive_backup-and-drive-backup-tra.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965]
|
||||
- kvm-blockdev-unify-qmp_blockdev_backup-and-blockdev-back.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965]
|
||||
- kvm-blockdev-honor-bdrv_try_set_aio_context-context-requ.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965]
|
||||
- kvm-backup-top-Begin-drain-earlier.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965]
|
||||
- kvm-block-backup-top-Don-t-acquire-context-while-droppin.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965]
|
||||
- kvm-blockdev-Acquire-AioContext-on-dirty-bitmap-function.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965]
|
||||
- kvm-blockdev-Return-bs-to-the-proper-context-on-snapshot.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965]
|
||||
- kvm-iotests-Test-handling-of-AioContexts-with-some-block.patch [bz#1745606 bz#1746217 bz#1773517 bz#1779036 bz#1782111 bz#1782175 bz#1783965]
|
||||
- kvm-target-arm-monitor-query-cpu-model-expansion-crashed.patch [bz#1801320]
|
||||
- kvm-docs-arm-cpu-features-Make-kvm-no-adjvtime-comment-c.patch [bz#1801320]
|
||||
- Resolves: bz#1745606
|
||||
(Qemu hang when do incremental live backup in transaction mode without bitmap)
|
||||
- Resolves: bz#1746217
|
||||
(Src qemu hang when do storage vm migration during guest installation)
|
||||
- Resolves: bz#1773517
|
||||
(Src qemu hang when do storage vm migration with dataplane enable)
|
||||
- Resolves: bz#1779036
|
||||
(Qemu coredump when do snapshot in transaction mode with one snapshot path not exist)
|
||||
- Resolves: bz#1779078
|
||||
(RHVH 4.4: Failed to run VM on 4.3/4.4 engine (Exit message: the CPU is incompatible with host CPU: Host CPU does not provide required features: hle, rtm))
|
||||
- Resolves: bz#1781637
|
||||
(qemu crashed when do mem and disk snapshot)
|
||||
- Resolves: bz#1782111
|
||||
(Qemu hang when do full backup on multi-disks with one job's 'job-id' missed in transaction mode(data plane enable))
|
||||
- Resolves: bz#1782175
|
||||
(Qemu core dump when add persistent bitmap(data plane enable))
|
||||
- Resolves: bz#1783965
|
||||
(Qemu core dump when do backup with sync: bitmap and no bitmap provided)
|
||||
- Resolves: bz#1787291
|
||||
(RHVH 4.4: Failed to run VM on 4.3/4.4 engine (Exit message: the CPU is incompatible with host CPU: Host CPU does not provide required features: hle, rtm) [rhel-8.1.0.z])
|
||||
- Resolves: bz#1801320
|
||||
(aarch64: backport query-cpu-model-expansion and adjvtime document fixes)
|
||||
|
||||
* Mon Feb 10 2020 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.2.0-9.el8
|
||||
- kvm-ppc-Deassert-the-external-interrupt-pin-in-KVM-on-re.patch [bz#1776638]
|
||||
- kvm-xics-Don-t-deassert-outputs.patch [bz#1776638]
|
||||
|
Loading…
Reference in New Issue
Block a user