aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-12-29 14:33:22 -0800
committerRichard Henderson <richard.henderson@linaro.org>2021-12-29 14:33:23 -0800
commitd5a9f352896fe43183ef01072b374e89a3488315 (patch)
tree85b44c75f58b8bf7e4e2057e0ec17948c0248e6f /tests
parent89f3bfa3265554d1d591ee4d7f1197b6e3397e84 (diff)
parent985cac8f200443ad952becc03b07c51ff4f80983 (diff)
downloadqemu-d5a9f352896fe43183ef01072b374e89a3488315.zip
qemu-d5a9f352896fe43183ef01072b374e89a3488315.tar.gz
qemu-d5a9f352896fe43183ef01072b374e89a3488315.tar.bz2
Merge tag 'pull-jobs-2021-12-29' of https://src.openvz.org/scm/~vsementsov/qemu into staging
Jobs patches: - small fix of job_create() - refactoring: drop BlockJob.blk field # gpg: Signature made Wed 29 Dec 2021 11:11:25 AM PST # gpg: using RSA key 8B9C26CDB2FD147C880E86A1561F24C1F19F79FB # gpg: Good signature from "Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 8B9C 26CD B2FD 147C 880E 86A1 561F 24C1 F19F 79FB * tag 'pull-jobs-2021-12-29' of https://src.openvz.org/scm/~vsementsov/qemu: blockjob: drop BlockJob.blk field test-bdrv-drain: don't use BlockJob.blk block/stream: add own blk test-blockjob-txn: don't abuse job->blk blockjob: implement and use block_job_get_aio_context job.c: add missing notifier initialization Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/qemu-iotests/141.out2
-rwxr-xr-xtests/qemu-iotests/2833
-rw-r--r--tests/qemu-iotests/283.out2
-rw-r--r--tests/unit/test-bdrv-drain.c12
-rw-r--r--tests/unit/test-blockjob-txn.c10
5 files changed, 13 insertions, 16 deletions
diff --git a/tests/qemu-iotests/141.out b/tests/qemu-iotests/141.out
index c4c15fb..63203d9 100644
--- a/tests/qemu-iotests/141.out
+++ b/tests/qemu-iotests/141.out
@@ -132,7 +132,7 @@ wrote 1048576/1048576 bytes at offset 0
{"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 in use"}}
+{"error": {"class": "GenericError", "desc": "Node 'drv0' is busy: block device is in use by block job: commit"}}
{'execute': 'block-job-cancel',
'arguments': {'device': 'job0'}}
{"return": {}}
diff --git a/tests/qemu-iotests/283 b/tests/qemu-iotests/283
index a09e018..5defe48 100755
--- a/tests/qemu-iotests/283
+++ b/tests/qemu-iotests/283
@@ -93,7 +93,8 @@ vm.qmp_log('blockdev-add', **{
'take-child-perms': ['write']
})
-vm.qmp_log('blockdev-backup', sync='full', device='source', target='target')
+vm.qmp_log('blockdev-backup', sync='full', device='source', target='target',
+ job_id="backup0")
vm.shutdown()
diff --git a/tests/qemu-iotests/283.out b/tests/qemu-iotests/283.out
index 5bb7595..5e4f456 100644
--- a/tests/qemu-iotests/283.out
+++ b/tests/qemu-iotests/283.out
@@ -4,7 +4,7 @@
{"return": {}}
{"execute": "blockdev-add", "arguments": {"driver": "blkdebug", "image": "base", "node-name": "other", "take-child-perms": ["write"]}}
{"return": {}}
-{"execute": "blockdev-backup", "arguments": {"device": "source", "sync": "full", "target": "target"}}
+{"execute": "blockdev-backup", "arguments": {"device": "source", "job-id": "backup0", "sync": "full", "target": "target"}}
{"error": {"class": "GenericError", "desc": "Permission conflict on node 'base': permissions 'write' are both required by node 'other' (uses node 'base' as 'image' child) and unshared by node 'source' (uses node 'base' as 'image' child)."}}
=== copy-before-write filter should be gone after job-finalize ===
diff --git a/tests/unit/test-bdrv-drain.c b/tests/unit/test-bdrv-drain.c
index 2d3c17e..36be84a 100644
--- a/tests/unit/test-bdrv-drain.c
+++ b/tests/unit/test-bdrv-drain.c
@@ -772,6 +772,7 @@ static void test_iothread_drain_subtree(void)
typedef struct TestBlockJob {
BlockJob common;
+ BlockDriverState *bs;
int run_ret;
int prepare_ret;
bool running;
@@ -783,7 +784,7 @@ static int test_job_prepare(Job *job)
TestBlockJob *s = container_of(job, TestBlockJob, common.job);
/* Provoke an AIO_WAIT_WHILE() call to verify there is no deadlock */
- blk_flush(s->common.blk);
+ bdrv_flush(s->bs);
return s->prepare_ret;
}
@@ -792,7 +793,7 @@ static void test_job_commit(Job *job)
TestBlockJob *s = container_of(job, TestBlockJob, common.job);
/* Provoke an AIO_WAIT_WHILE() call to verify there is no deadlock */
- blk_flush(s->common.blk);
+ bdrv_flush(s->bs);
}
static void test_job_abort(Job *job)
@@ -800,7 +801,7 @@ static void test_job_abort(Job *job)
TestBlockJob *s = container_of(job, TestBlockJob, common.job);
/* Provoke an AIO_WAIT_WHILE() call to verify there is no deadlock */
- blk_flush(s->common.blk);
+ bdrv_flush(s->bs);
}
static int coroutine_fn test_job_run(Job *job, Error **errp)
@@ -915,6 +916,7 @@ static void test_blockjob_common_drain_node(enum drain_type drain_type,
tjob = block_job_create("job0", &test_job_driver, NULL, src,
0, BLK_PERM_ALL,
0, 0, NULL, NULL, &error_abort);
+ tjob->bs = src;
job = &tjob->common;
block_job_add_bdrv(job, "target", target, 0, BLK_PERM_ALL, &error_abort);
@@ -1538,6 +1540,7 @@ typedef struct TestDropBackingBlockJob {
bool should_complete;
bool *did_complete;
BlockDriverState *detach_also;
+ BlockDriverState *bs;
} TestDropBackingBlockJob;
static int coroutine_fn test_drop_backing_job_run(Job *job, Error **errp)
@@ -1557,7 +1560,7 @@ static void test_drop_backing_job_commit(Job *job)
TestDropBackingBlockJob *s =
container_of(job, TestDropBackingBlockJob, common.job);
- bdrv_set_backing_hd(blk_bs(s->common.blk), NULL, &error_abort);
+ bdrv_set_backing_hd(s->bs, NULL, &error_abort);
bdrv_set_backing_hd(s->detach_also, NULL, &error_abort);
*s->did_complete = true;
@@ -1657,6 +1660,7 @@ static void test_blockjob_commit_by_drained_end(void)
job = block_job_create("job", &test_drop_backing_job_driver, NULL,
bs_parents[2], 0, BLK_PERM_ALL, 0, 0, NULL, NULL,
&error_abort);
+ job->bs = bs_parents[2];
job->detach_also = bs_parents[0];
job->did_complete = &job_has_completed;
diff --git a/tests/unit/test-blockjob-txn.c b/tests/unit/test-blockjob-txn.c
index 8bd13b9..c69028b 100644
--- a/tests/unit/test-blockjob-txn.c
+++ b/tests/unit/test-blockjob-txn.c
@@ -25,14 +25,6 @@ typedef struct {
int *result;
} TestBlockJob;
-static void test_block_job_clean(Job *job)
-{
- BlockJob *bjob = container_of(job, BlockJob, job);
- BlockDriverState *bs = blk_bs(bjob->blk);
-
- bdrv_unref(bs);
-}
-
static int coroutine_fn test_block_job_run(Job *job, Error **errp)
{
TestBlockJob *s = container_of(job, TestBlockJob, common.job);
@@ -73,7 +65,6 @@ static const BlockJobDriver test_block_job_driver = {
.free = block_job_free,
.user_resume = block_job_user_resume,
.run = test_block_job_run,
- .clean = test_block_job_clean,
},
};
@@ -105,6 +96,7 @@ static BlockJob *test_block_job_start(unsigned int iterations,
s = block_job_create(job_id, &test_block_job_driver, txn, bs,
0, BLK_PERM_ALL, 0, JOB_DEFAULT,
test_block_job_cb, data, &error_abort);
+ bdrv_unref(bs); /* referenced by job now */
s->iterations = iterations;
s->use_timer = use_timer;
s->rc = rc;