1 | The following changes since commit e3acc2c1961cbe22ca474cd5da4163b7bbf7cea3: | 1 | The following changes since commit ba58ccbef60338d0b7334c714589a6423a3e7f91: |
---|---|---|---|
2 | 2 | ||
3 | tests/docker/dockerfiles: Bump fedora-i386-cross to fedora 34 (2021-10-05 16:40:39 -0700) | 3 | Merge tag 'for-7.1-hppa' of https://github.com/hdeller/qemu-hppa into staging (2022-08-19 09:35:29 -0700) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | git://repo.or.cz/qemu/kevin.git tags/for-upstream | 7 | git://repo.or.cz/qemu/kevin.git tags/for-upstream |
8 | 8 | ||
9 | for you to fetch changes up to 3765315d4c84f9c0799744f43a314169baaccc05: | 9 | for you to fetch changes up to 51e15194b0a091e5c40aab2eb234a1d36c5c58ee: |
10 | 10 | ||
11 | iotests: Update for pylint 2.11.1 (2021-10-06 10:25:55 +0200) | 11 | scsi-generic: Fix emulated block limits VPD page (2022-08-23 16:01:13 +0200) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block layer patches | 14 | Block layer patches |
15 | 15 | ||
16 | - Fix I/O errors because of incorrectly detected max_iov | 16 | - scsi-generic: Fix I/O errors due to wrong block limits |
17 | - Fix not white-listed copy-before-write | ||
18 | - qemu-storage-daemon: Only display FUSE help when FUSE is built-in | ||
19 | - iotests: update environment and linting configuration | ||
20 | 17 | ||
21 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
22 | Emanuele Giuseppe Esposito (1): | 19 | Kevin Wolf (1): |
23 | include/block.h: remove outdated comment | 20 | scsi-generic: Fix emulated block limits VPD page |
24 | 21 | ||
25 | John Snow (5): | 22 | hw/scsi/scsi-generic.c | 21 ++++++++++++++------- |
26 | iotests: add 'qemu' package location to PYTHONPATH in testenv | 23 | 1 file changed, 14 insertions(+), 7 deletions(-) |
27 | iotests/linters: check mypy files all at once | ||
28 | iotests/mirror-top-perms: Adjust imports | ||
29 | iotests/migrate-bitmaps-test: delint | ||
30 | iotests: Update for pylint 2.11.1 | ||
31 | |||
32 | Paolo Bonzini (1): | ||
33 | block: introduce max_hw_iov for use in scsi-generic | ||
34 | |||
35 | Philippe Mathieu-Daudé (1): | ||
36 | qemu-storage-daemon: Only display FUSE help when FUSE is built-in | ||
37 | |||
38 | Vladimir Sementsov-Ogievskiy (5): | ||
39 | block: implement bdrv_new_open_driver_opts() | ||
40 | block: bdrv_insert_node(): fix and improve error handling | ||
41 | block: bdrv_insert_node(): doc and style | ||
42 | block: bdrv_insert_node(): don't use bdrv_open() | ||
43 | iotests/image-fleecing: declare requirement of copy-before-write | ||
44 | |||
45 | include/block/block.h | 8 ++- | ||
46 | include/block/block_int.h | 7 +++ | ||
47 | include/sysemu/block-backend.h | 1 + | ||
48 | block.c | 79 ++++++++++++++++++++++----- | ||
49 | block/block-backend.c | 6 ++ | ||
50 | block/file-posix.c | 2 +- | ||
51 | block/io.c | 1 + | ||
52 | hw/scsi/scsi-generic.c | 2 +- | ||
53 | storage-daemon/qemu-storage-daemon.c | 2 + | ||
54 | tests/qemu-iotests/iotests.py | 2 - | ||
55 | tests/qemu-iotests/testenv.py | 15 +++-- | ||
56 | tests/qemu-iotests/testrunner.py | 7 ++- | ||
57 | tests/qemu-iotests/235 | 2 - | ||
58 | tests/qemu-iotests/297 | 52 +++++++----------- | ||
59 | tests/qemu-iotests/300 | 5 +- | ||
60 | tests/qemu-iotests/pylintrc | 6 +- | ||
61 | tests/qemu-iotests/tests/image-fleecing | 1 + | ||
62 | tests/qemu-iotests/tests/migrate-bitmaps-test | 50 +++++++++-------- | ||
63 | tests/qemu-iotests/tests/mirror-top-perms | 12 ++-- | ||
64 | 19 files changed, 164 insertions(+), 96 deletions(-) | ||
65 | |||
66 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Emanuele Giuseppe Esposito <eesposit@redhat.com> | ||
2 | 1 | ||
3 | There are a couple of errors in bdrv_drained_begin header comment: | ||
4 | - block_job_pause does not exist anymore, it has been replaced | ||
5 | with job_pause in b15de82867 | ||
6 | - job_pause is automatically invoked as a .drained_begin callback | ||
7 | (child_job_drained_begin) by the child_job BdrvChildClass struct | ||
8 | in blockjob.c. So no additional pause should be required. | ||
9 | |||
10 | Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> | ||
11 | Message-Id: <20210903113800.59970-1-eesposit@redhat.com> | ||
12 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
14 | --- | ||
15 | include/block/block.h | 4 +--- | ||
16 | 1 file changed, 1 insertion(+), 3 deletions(-) | ||
17 | |||
18 | diff --git a/include/block/block.h b/include/block/block.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/include/block/block.h | ||
21 | +++ b/include/block/block.h | ||
22 | @@ -XXX,XX +XXX,XX @@ bool bdrv_drain_poll(BlockDriverState *bs, bool recursive, | ||
23 | * bdrv_drained_begin: | ||
24 | * | ||
25 | * Begin a quiesced section for exclusive access to the BDS, by disabling | ||
26 | - * external request sources including NBD server and device model. Note that | ||
27 | - * this doesn't block timers or coroutines from submitting more requests, which | ||
28 | - * means block_job_pause is still necessary. | ||
29 | + * external request sources including NBD server, block jobs, and device model. | ||
30 | * | ||
31 | * This function can be recursive. | ||
32 | */ | ||
33 | -- | ||
34 | 2.31.1 | ||
35 | |||
36 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
2 | 1 | ||
3 | When configuring QEMU with --disable-fuse, the qemu-storage-daemon | ||
4 | still reports FUSE command line options in its help: | ||
5 | |||
6 | $ qemu-storage-daemon -h | ||
7 | Usage: qemu-storage-daemon [options] | ||
8 | QEMU storage daemon | ||
9 | |||
10 | --export [type=]fuse,id=<id>,node-name=<node-name>,mountpoint=<file> | ||
11 | [,growable=on|off][,writable=on|off] | ||
12 | export the specified block node over FUSE | ||
13 | |||
14 | Remove this help message when FUSE is disabled, to avoid: | ||
15 | |||
16 | $ qemu-storage-daemon --export fuse | ||
17 | qemu-storage-daemon: --export fuse: Invalid parameter 'fuse' | ||
18 | |||
19 | Reported-by: Qing Wang <qinwang@redhat.com> | ||
20 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
21 | Message-Id: <20210816180442.2000642-1-philmd@redhat.com> | ||
22 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
23 | Reviewed-by: Hanna Reitz <hreitz@redhat.com> | ||
24 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
25 | --- | ||
26 | storage-daemon/qemu-storage-daemon.c | 2 ++ | ||
27 | 1 file changed, 2 insertions(+) | ||
28 | |||
29 | diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/storage-daemon/qemu-storage-daemon.c | ||
32 | +++ b/storage-daemon/qemu-storage-daemon.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static void help(void) | ||
34 | " export the specified block node over NBD\n" | ||
35 | " (requires --nbd-server)\n" | ||
36 | "\n" | ||
37 | +#ifdef CONFIG_FUSE | ||
38 | " --export [type=]fuse,id=<id>,node-name=<node-name>,mountpoint=<file>\n" | ||
39 | " [,growable=on|off][,writable=on|off]\n" | ||
40 | " export the specified block node over FUSE\n" | ||
41 | "\n" | ||
42 | +#endif /* CONFIG_FUSE */ | ||
43 | " --monitor [chardev=]name[,mode=control][,pretty[=on|off]]\n" | ||
44 | " configure a QMP monitor\n" | ||
45 | "\n" | ||
46 | -- | ||
47 | 2.31.1 | ||
48 | |||
49 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | Add version of bdrv_new_open_driver() that supports QDict options. | ||
4 | We'll use it in further commit. | ||
5 | |||
6 | Simply add one more argument to bdrv_new_open_driver() is worse, as | ||
7 | there are too many invocations of bdrv_new_open_driver() to update | ||
8 | then. | ||
9 | |||
10 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
11 | Suggested-by: Kevin Wolf <kwolf@redhat.com> | ||
12 | Message-Id: <20210920115538.264372-2-vsementsov@virtuozzo.com> | ||
13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
14 | --- | ||
15 | include/block/block.h | 4 ++++ | ||
16 | block.c | 25 +++++++++++++++++++++---- | ||
17 | 2 files changed, 25 insertions(+), 4 deletions(-) | ||
18 | |||
19 | diff --git a/include/block/block.h b/include/block/block.h | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/include/block/block.h | ||
22 | +++ b/include/block/block.h | ||
23 | @@ -XXX,XX +XXX,XX @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options, | ||
24 | const char *bdref_key, Error **errp); | ||
25 | BlockDriverState *bdrv_open(const char *filename, const char *reference, | ||
26 | QDict *options, int flags, Error **errp); | ||
27 | +BlockDriverState *bdrv_new_open_driver_opts(BlockDriver *drv, | ||
28 | + const char *node_name, | ||
29 | + QDict *options, int flags, | ||
30 | + Error **errp); | ||
31 | BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name, | ||
32 | int flags, Error **errp); | ||
33 | BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue, | ||
34 | diff --git a/block.c b/block.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/block.c | ||
37 | +++ b/block.c | ||
38 | @@ -XXX,XX +XXX,XX @@ open_failed: | ||
39 | return ret; | ||
40 | } | ||
41 | |||
42 | -BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name, | ||
43 | - int flags, Error **errp) | ||
44 | +/* | ||
45 | + * Create and open a block node. | ||
46 | + * | ||
47 | + * @options is a QDict of options to pass to the block drivers, or NULL for an | ||
48 | + * empty set of options. The reference to the QDict belongs to the block layer | ||
49 | + * after the call (even on failure), so if the caller intends to reuse the | ||
50 | + * dictionary, it needs to use qobject_ref() before calling bdrv_open. | ||
51 | + */ | ||
52 | +BlockDriverState *bdrv_new_open_driver_opts(BlockDriver *drv, | ||
53 | + const char *node_name, | ||
54 | + QDict *options, int flags, | ||
55 | + Error **errp) | ||
56 | { | ||
57 | BlockDriverState *bs; | ||
58 | int ret; | ||
59 | |||
60 | bs = bdrv_new(); | ||
61 | bs->open_flags = flags; | ||
62 | - bs->explicit_options = qdict_new(); | ||
63 | - bs->options = qdict_new(); | ||
64 | + bs->options = options ?: qdict_new(); | ||
65 | + bs->explicit_options = qdict_clone_shallow(bs->options); | ||
66 | bs->opaque = NULL; | ||
67 | |||
68 | update_options_from_flags(bs->options, flags); | ||
69 | @@ -XXX,XX +XXX,XX @@ BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name, | ||
70 | return bs; | ||
71 | } | ||
72 | |||
73 | +/* Create and open a block node. */ | ||
74 | +BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name, | ||
75 | + int flags, Error **errp) | ||
76 | +{ | ||
77 | + return bdrv_new_open_driver_opts(drv, node_name, NULL, flags, errp); | ||
78 | +} | ||
79 | + | ||
80 | QemuOptsList bdrv_runtime_opts = { | ||
81 | .name = "bdrv_common", | ||
82 | .head = QTAILQ_HEAD_INITIALIZER(bdrv_runtime_opts.head), | ||
83 | -- | ||
84 | 2.31.1 | ||
85 | |||
86 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | - use ERRP_GUARD(): function calls error_prepend(), so it must use | ||
4 | ERRP_GUARD(), otherwise error_prepend() would not be called when | ||
5 | passed errp is error_fatal | ||
6 | |||
7 | - drop error propagation, handle return code instead | ||
8 | |||
9 | - for symmetry, do error_prepend() for the second failure | ||
10 | |||
11 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
12 | Message-Id: <20210920115538.264372-3-vsementsov@virtuozzo.com> | ||
13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
14 | --- | ||
15 | block.c | 9 +++++---- | ||
16 | 1 file changed, 5 insertions(+), 4 deletions(-) | ||
17 | |||
18 | diff --git a/block.c b/block.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/block.c | ||
21 | +++ b/block.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static void bdrv_delete(BlockDriverState *bs) | ||
23 | BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *node_options, | ||
24 | int flags, Error **errp) | ||
25 | { | ||
26 | + ERRP_GUARD(); | ||
27 | + int ret; | ||
28 | BlockDriverState *new_node_bs; | ||
29 | - Error *local_err = NULL; | ||
30 | |||
31 | new_node_bs = bdrv_open(NULL, NULL, node_options, flags, errp); | ||
32 | if (new_node_bs == NULL) { | ||
33 | @@ -XXX,XX +XXX,XX @@ BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *node_options, | ||
34 | } | ||
35 | |||
36 | bdrv_drained_begin(bs); | ||
37 | - bdrv_replace_node(bs, new_node_bs, &local_err); | ||
38 | + ret = bdrv_replace_node(bs, new_node_bs, errp); | ||
39 | bdrv_drained_end(bs); | ||
40 | |||
41 | - if (local_err) { | ||
42 | + if (ret < 0) { | ||
43 | + error_prepend(errp, "Could not replace node: "); | ||
44 | bdrv_unref(new_node_bs); | ||
45 | - error_propagate(errp, local_err); | ||
46 | return NULL; | ||
47 | } | ||
48 | |||
49 | -- | ||
50 | 2.31.1 | ||
51 | |||
52 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | - options & flags is common pair for open-like functions, let's use it | ||
4 | - add a comment that specifies use of @options | ||
5 | |||
6 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
7 | Message-Id: <20210920115538.264372-4-vsementsov@virtuozzo.com> | ||
8 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
9 | --- | ||
10 | block.c | 13 +++++++++++-- | ||
11 | 1 file changed, 11 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/block.c b/block.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/block.c | ||
16 | +++ b/block.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void bdrv_delete(BlockDriverState *bs) | ||
18 | g_free(bs); | ||
19 | } | ||
20 | |||
21 | -BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *node_options, | ||
22 | + | ||
23 | +/* | ||
24 | + * Replace @bs by newly created block node. | ||
25 | + * | ||
26 | + * @options is a QDict of options to pass to the block drivers, or NULL for an | ||
27 | + * empty set of options. The reference to the QDict belongs to the block layer | ||
28 | + * after the call (even on failure), so if the caller intends to reuse the | ||
29 | + * dictionary, it needs to use qobject_ref() before calling bdrv_open. | ||
30 | + */ | ||
31 | +BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *options, | ||
32 | int flags, Error **errp) | ||
33 | { | ||
34 | ERRP_GUARD(); | ||
35 | int ret; | ||
36 | BlockDriverState *new_node_bs; | ||
37 | |||
38 | - new_node_bs = bdrv_open(NULL, NULL, node_options, flags, errp); | ||
39 | + new_node_bs = bdrv_open(NULL, NULL, options, flags, errp); | ||
40 | if (new_node_bs == NULL) { | ||
41 | error_prepend(errp, "Could not create node: "); | ||
42 | return NULL; | ||
43 | -- | ||
44 | 2.31.1 | ||
45 | |||
46 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | Use bdrv_new_open_driver_opts() instead of complicated bdrv_open(). | ||
4 | |||
5 | Among other extra things bdrv_open() also check for white-listed | ||
6 | formats, which we don't want for internal node creation: currently | ||
7 | backup doesn't work when copy-before-write filter is not white-listed. | ||
8 | As well block-stream doesn't work when copy-on-read is not | ||
9 | white-listed. | ||
10 | |||
11 | Fixes: 751cec7a261adaf1145dc7adf6de7c9c084e5a0b | ||
12 | Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2004812 | ||
13 | Reported-by: Yanan Fu | ||
14 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
15 | Message-Id: <20210920115538.264372-5-vsementsov@virtuozzo.com> | ||
16 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
17 | --- | ||
18 | block.c | 34 ++++++++++++++++++++++++++++------ | ||
19 | 1 file changed, 28 insertions(+), 6 deletions(-) | ||
20 | |||
21 | diff --git a/block.c b/block.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/block.c | ||
24 | +++ b/block.c | ||
25 | @@ -XXX,XX +XXX,XX @@ BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *options, | ||
26 | { | ||
27 | ERRP_GUARD(); | ||
28 | int ret; | ||
29 | - BlockDriverState *new_node_bs; | ||
30 | + BlockDriverState *new_node_bs = NULL; | ||
31 | + const char *drvname, *node_name; | ||
32 | + BlockDriver *drv; | ||
33 | + | ||
34 | + drvname = qdict_get_try_str(options, "driver"); | ||
35 | + if (!drvname) { | ||
36 | + error_setg(errp, "driver is not specified"); | ||
37 | + goto fail; | ||
38 | + } | ||
39 | + | ||
40 | + drv = bdrv_find_format(drvname); | ||
41 | + if (!drv) { | ||
42 | + error_setg(errp, "Unknown driver: '%s'", drvname); | ||
43 | + goto fail; | ||
44 | + } | ||
45 | |||
46 | - new_node_bs = bdrv_open(NULL, NULL, options, flags, errp); | ||
47 | - if (new_node_bs == NULL) { | ||
48 | + node_name = qdict_get_try_str(options, "node-name"); | ||
49 | + | ||
50 | + new_node_bs = bdrv_new_open_driver_opts(drv, node_name, options, flags, | ||
51 | + errp); | ||
52 | + options = NULL; /* bdrv_new_open_driver() eats options */ | ||
53 | + if (!new_node_bs) { | ||
54 | error_prepend(errp, "Could not create node: "); | ||
55 | - return NULL; | ||
56 | + goto fail; | ||
57 | } | ||
58 | |||
59 | bdrv_drained_begin(bs); | ||
60 | @@ -XXX,XX +XXX,XX @@ BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *options, | ||
61 | |||
62 | if (ret < 0) { | ||
63 | error_prepend(errp, "Could not replace node: "); | ||
64 | - bdrv_unref(new_node_bs); | ||
65 | - return NULL; | ||
66 | + goto fail; | ||
67 | } | ||
68 | |||
69 | return new_node_bs; | ||
70 | + | ||
71 | +fail: | ||
72 | + qobject_unref(options); | ||
73 | + bdrv_unref(new_node_bs); | ||
74 | + return NULL; | ||
75 | } | ||
76 | |||
77 | /* | ||
78 | -- | ||
79 | 2.31.1 | ||
80 | |||
81 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
2 | 1 | ||
3 | Now test fails if copy-before-write is not white-listed. | ||
4 | Let's skip test instead. | ||
5 | |||
6 | Fixes: c0605985696a19ef034fa25d04f53f3b3b383896 | ||
7 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
8 | Message-Id: <20210920115538.264372-6-vsementsov@virtuozzo.com> | ||
9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
10 | --- | ||
11 | tests/qemu-iotests/tests/image-fleecing | 1 + | ||
12 | 1 file changed, 1 insertion(+) | ||
13 | |||
14 | diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/tests/image-fleecing | ||
15 | index XXXXXXX..XXXXXXX 100755 | ||
16 | --- a/tests/qemu-iotests/tests/image-fleecing | ||
17 | +++ b/tests/qemu-iotests/tests/image-fleecing | ||
18 | @@ -XXX,XX +XXX,XX @@ from iotests import log, qemu_img, qemu_io, qemu_io_silent | ||
19 | iotests.script_initialize( | ||
20 | supported_fmts=['qcow2', 'qcow', 'qed', 'vmdk', 'vhdx', 'raw'], | ||
21 | supported_platforms=['linux'], | ||
22 | + required_fmts=['copy-before-write'], | ||
23 | ) | ||
24 | |||
25 | patterns = [('0x5d', '0', '64k'), | ||
26 | -- | ||
27 | 2.31.1 | ||
28 | |||
29 | diff view generated by jsdifflib |
1 | From: Paolo Bonzini <pbonzini@redhat.com> | 1 | Commits 01ef8185b80 amd 24b36e9813e updated the way that the maximum |
---|---|---|---|
2 | transfer length is calculated for patching block limits VPD page in an | ||
3 | INQUIRY response. | ||
2 | 4 | ||
3 | Linux limits the size of iovecs to 1024 (UIO_MAXIOV in the kernel | 5 | The same updates also need to be made for the case where the host device |
4 | sources, IOV_MAX in POSIX). Because of this, on some host adapters | 6 | does not support the block limits VPD page at all and we emulate the |
5 | requests with many iovecs are rejected with -EINVAL by the | 7 | whole page. |
6 | io_submit() or readv()/writev() system calls. | ||
7 | 8 | ||
8 | In fact, the same limit applies to SG_IO as well. To fix both the | 9 | Without this fix, on host block devices a maximum transfer length of |
9 | EINVAL and the possible performance issues from using fewer iovecs | 10 | (INT_MAX - sector_size) bytes is advertised to the guest, resulting in |
10 | than allowed by Linux (some HBAs have max_segments as low as 128), | 11 | I/O errors when a request that exceeds the host limits is made by the |
11 | introduce a separate entry in BlockLimits to hold the max_segments | 12 | guest. (Prior to commit 24b36e9813e, this code path would use the |
12 | value from sysfs. This new limit is used only for SG_IO and clamped | 13 | max_transfer value from the host instead of INT_MAX, but still miss the |
13 | to bs->bl.max_iov anyway, just like max_hw_transfer is clamped to | 14 | fix from 01ef8185b80 where max_transfer is also capped to max_iov |
14 | bs->bl.max_transfer. | 15 | host pages, so it would be less wrong, but still wrong.) |
15 | 16 | ||
16 | Reported-by: Halil Pasic <pasic@linux.ibm.com> | ||
17 | Cc: Hanna Reitz <hreitz@redhat.com> | ||
18 | Cc: Kevin Wolf <kwolf@redhat.com> | ||
19 | Cc: qemu-block@nongnu.org | ||
20 | Cc: qemu-stable@nongnu.org | 17 | Cc: qemu-stable@nongnu.org |
21 | Fixes: 18473467d5 ("file-posix: try BLKSECTGET on block devices too, do not round to power of 2", 2021-06-25) | 18 | Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2096251 |
22 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | 19 | Fixes: 01ef8185b809af9d287e1a03a3f9d8ea8231118a |
23 | Message-Id: <20210923130436.1187591-1-pbonzini@redhat.com> | 20 | Fixes: 24b36e9813ec15da7db62e3b3621730710c5f020 |
21 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
22 | Message-Id: <20220822125320.48257-1-kwolf@redhat.com> | ||
23 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
24 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 24 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
25 | --- | 25 | --- |
26 | include/block/block_int.h | 7 +++++++ | 26 | hw/scsi/scsi-generic.c | 21 ++++++++++++++------- |
27 | include/sysemu/block-backend.h | 1 + | 27 | 1 file changed, 14 insertions(+), 7 deletions(-) |
28 | block/block-backend.c | 6 ++++++ | ||
29 | block/file-posix.c | 2 +- | ||
30 | block/io.c | 1 + | ||
31 | hw/scsi/scsi-generic.c | 2 +- | ||
32 | 6 files changed, 17 insertions(+), 2 deletions(-) | ||
33 | 28 | ||
34 | diff --git a/include/block/block_int.h b/include/block/block_int.h | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/include/block/block_int.h | ||
37 | +++ b/include/block/block_int.h | ||
38 | @@ -XXX,XX +XXX,XX @@ typedef struct BlockLimits { | ||
39 | */ | ||
40 | uint64_t max_hw_transfer; | ||
41 | |||
42 | + /* Maximal number of scatter/gather elements allowed by the hardware. | ||
43 | + * Applies whenever transfers to the device bypass the kernel I/O | ||
44 | + * scheduler, for example with SG_IO. If larger than max_iov | ||
45 | + * or if zero, blk_get_max_hw_iov will fall back to max_iov. | ||
46 | + */ | ||
47 | + int max_hw_iov; | ||
48 | + | ||
49 | /* memory alignment, in bytes so that no bounce buffer is needed */ | ||
50 | size_t min_mem_alignment; | ||
51 | |||
52 | diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/include/sysemu/block-backend.h | ||
55 | +++ b/include/sysemu/block-backend.h | ||
56 | @@ -XXX,XX +XXX,XX @@ uint32_t blk_get_request_alignment(BlockBackend *blk); | ||
57 | uint32_t blk_get_max_transfer(BlockBackend *blk); | ||
58 | uint64_t blk_get_max_hw_transfer(BlockBackend *blk); | ||
59 | int blk_get_max_iov(BlockBackend *blk); | ||
60 | +int blk_get_max_hw_iov(BlockBackend *blk); | ||
61 | void blk_set_guest_block_size(BlockBackend *blk, int align); | ||
62 | void *blk_try_blockalign(BlockBackend *blk, size_t size); | ||
63 | void *blk_blockalign(BlockBackend *blk, size_t size); | ||
64 | diff --git a/block/block-backend.c b/block/block-backend.c | ||
65 | index XXXXXXX..XXXXXXX 100644 | ||
66 | --- a/block/block-backend.c | ||
67 | +++ b/block/block-backend.c | ||
68 | @@ -XXX,XX +XXX,XX @@ uint32_t blk_get_max_transfer(BlockBackend *blk) | ||
69 | return ROUND_DOWN(max, blk_get_request_alignment(blk)); | ||
70 | } | ||
71 | |||
72 | +int blk_get_max_hw_iov(BlockBackend *blk) | ||
73 | +{ | ||
74 | + return MIN_NON_ZERO(blk->root->bs->bl.max_hw_iov, | ||
75 | + blk->root->bs->bl.max_iov); | ||
76 | +} | ||
77 | + | ||
78 | int blk_get_max_iov(BlockBackend *blk) | ||
79 | { | ||
80 | return blk->root->bs->bl.max_iov; | ||
81 | diff --git a/block/file-posix.c b/block/file-posix.c | ||
82 | index XXXXXXX..XXXXXXX 100644 | ||
83 | --- a/block/file-posix.c | ||
84 | +++ b/block/file-posix.c | ||
85 | @@ -XXX,XX +XXX,XX @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp) | ||
86 | |||
87 | ret = hdev_get_max_segments(s->fd, &st); | ||
88 | if (ret > 0) { | ||
89 | - bs->bl.max_iov = ret; | ||
90 | + bs->bl.max_hw_iov = ret; | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | diff --git a/block/io.c b/block/io.c | ||
95 | index XXXXXXX..XXXXXXX 100644 | ||
96 | --- a/block/io.c | ||
97 | +++ b/block/io.c | ||
98 | @@ -XXX,XX +XXX,XX @@ static void bdrv_merge_limits(BlockLimits *dst, const BlockLimits *src) | ||
99 | dst->min_mem_alignment = MAX(dst->min_mem_alignment, | ||
100 | src->min_mem_alignment); | ||
101 | dst->max_iov = MIN_NON_ZERO(dst->max_iov, src->max_iov); | ||
102 | + dst->max_hw_iov = MIN_NON_ZERO(dst->max_hw_iov, src->max_hw_iov); | ||
103 | } | ||
104 | |||
105 | typedef struct BdrvRefreshLimitsState { | ||
106 | diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c | 29 | diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c |
107 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
108 | --- a/hw/scsi/scsi-generic.c | 31 | --- a/hw/scsi/scsi-generic.c |
109 | +++ b/hw/scsi/scsi-generic.c | 32 | +++ b/hw/scsi/scsi-generic.c |
33 | @@ -XXX,XX +XXX,XX @@ static int execute_command(BlockBackend *blk, | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | +static uint64_t calculate_max_transfer(SCSIDevice *s) | ||
38 | +{ | ||
39 | + uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk); | ||
40 | + uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk); | ||
41 | + | ||
42 | + assert(max_transfer); | ||
43 | + max_transfer = MIN_NON_ZERO(max_transfer, | ||
44 | + max_iov * qemu_real_host_page_size()); | ||
45 | + | ||
46 | + return max_transfer / s->blocksize; | ||
47 | +} | ||
48 | + | ||
49 | static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len) | ||
50 | { | ||
51 | uint8_t page, page_idx; | ||
110 | @@ -XXX,XX +XXX,XX @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len) | 52 | @@ -XXX,XX +XXX,XX @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len) |
53 | (r->req.cmd.buf[1] & 0x01)) { | ||
111 | page = r->req.cmd.buf[2]; | 54 | page = r->req.cmd.buf[2]; |
112 | if (page == 0xb0) { | 55 | if (page == 0xb0) { |
113 | uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk); | 56 | - uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk); |
114 | - uint32_t max_iov = blk_get_max_iov(s->conf.blk); | 57 | - uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk); |
115 | + uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk); | 58 | - |
116 | 59 | - assert(max_transfer); | |
117 | assert(max_transfer); | 60 | - max_transfer = MIN_NON_ZERO(max_transfer, max_iov * qemu_real_host_page_size()) |
118 | max_transfer = MIN_NON_ZERO(max_transfer, max_iov * qemu_real_host_page_size) | 61 | - / s->blocksize; |
62 | + uint64_t max_transfer = calculate_max_transfer(s); | ||
63 | stl_be_p(&r->buf[8], max_transfer); | ||
64 | /* Also take care of the opt xfer len. */ | ||
65 | stl_be_p(&r->buf[12], | ||
66 | @@ -XXX,XX +XXX,XX @@ static int scsi_generic_emulate_block_limits(SCSIGenericReq *r, SCSIDevice *s) | ||
67 | uint8_t buf[64]; | ||
68 | |||
69 | SCSIBlockLimits bl = { | ||
70 | - .max_io_sectors = blk_get_max_transfer(s->conf.blk) / s->blocksize | ||
71 | + .max_io_sectors = calculate_max_transfer(s), | ||
72 | }; | ||
73 | |||
74 | memset(r->buf, 0, r->buflen); | ||
119 | -- | 75 | -- |
120 | 2.31.1 | 76 | 2.37.1 |
121 | |||
122 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: John Snow <jsnow@redhat.com> | ||
2 | 1 | ||
3 | We can drop the sys.path hacking in various places by doing | ||
4 | this. Additionally, by doing it in one place right up top, we can print | ||
5 | interesting warnings in case the environment does not look correct. (See | ||
6 | next commit.) | ||
7 | |||
8 | If we ever decide to change how the environment is crafted, all of the | ||
9 | "help me find my python packages" goop is all in one place, right in one | ||
10 | function. | ||
11 | |||
12 | Signed-off-by: John Snow <jsnow@redhat.com> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
14 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
15 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
16 | Message-Id: <20210923180715.4168522-2-jsnow@redhat.com> | ||
17 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
18 | --- | ||
19 | tests/qemu-iotests/iotests.py | 2 -- | ||
20 | tests/qemu-iotests/testenv.py | 15 +++++++++------ | ||
21 | tests/qemu-iotests/235 | 2 -- | ||
22 | tests/qemu-iotests/297 | 6 ------ | ||
23 | tests/qemu-iotests/300 | 5 ++--- | ||
24 | tests/qemu-iotests/tests/mirror-top-perms | 7 +++---- | ||
25 | 6 files changed, 14 insertions(+), 23 deletions(-) | ||
26 | |||
27 | diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/tests/qemu-iotests/iotests.py | ||
30 | +++ b/tests/qemu-iotests/iotests.py | ||
31 | @@ -XXX,XX +XXX,XX @@ | ||
32 | |||
33 | from contextlib import contextmanager | ||
34 | |||
35 | -# pylint: disable=import-error, wrong-import-position | ||
36 | -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) | ||
37 | from qemu.machine import qtest | ||
38 | from qemu.qmp import QMPMessage | ||
39 | |||
40 | diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/tests/qemu-iotests/testenv.py | ||
43 | +++ b/tests/qemu-iotests/testenv.py | ||
44 | @@ -XXX,XX +XXX,XX @@ def init_directories(self) -> None: | ||
45 | SAMPLE_IMG_DIR | ||
46 | OUTPUT_DIR | ||
47 | """ | ||
48 | - self.pythonpath = os.getenv('PYTHONPATH') | ||
49 | - if self.pythonpath: | ||
50 | - self.pythonpath = self.source_iotests + os.pathsep + \ | ||
51 | - self.pythonpath | ||
52 | - else: | ||
53 | - self.pythonpath = self.source_iotests | ||
54 | + | ||
55 | + # Path where qemu goodies live in this source tree. | ||
56 | + qemu_srctree_path = Path(__file__, '../../../python').resolve() | ||
57 | + | ||
58 | + self.pythonpath = os.pathsep.join(filter(None, ( | ||
59 | + self.source_iotests, | ||
60 | + str(qemu_srctree_path), | ||
61 | + os.getenv('PYTHONPATH'), | ||
62 | + ))) | ||
63 | |||
64 | self.test_dir = os.getenv('TEST_DIR', | ||
65 | os.path.join(os.getcwd(), 'scratch')) | ||
66 | diff --git a/tests/qemu-iotests/235 b/tests/qemu-iotests/235 | ||
67 | index XXXXXXX..XXXXXXX 100755 | ||
68 | --- a/tests/qemu-iotests/235 | ||
69 | +++ b/tests/qemu-iotests/235 | ||
70 | @@ -XXX,XX +XXX,XX @@ import os | ||
71 | import iotests | ||
72 | from iotests import qemu_img_create, qemu_io, file_path, log | ||
73 | |||
74 | -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) | ||
75 | - | ||
76 | from qemu.machine import QEMUMachine | ||
77 | |||
78 | iotests.script_initialize(supported_fmts=['qcow2']) | ||
79 | diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 | ||
80 | index XXXXXXX..XXXXXXX 100755 | ||
81 | --- a/tests/qemu-iotests/297 | ||
82 | +++ b/tests/qemu-iotests/297 | ||
83 | @@ -XXX,XX +XXX,XX @@ def run_linters(): | ||
84 | # Todo notes are fine, but fixme's or xxx's should probably just be | ||
85 | # fixed (in tests, at least) | ||
86 | env = os.environ.copy() | ||
87 | - qemu_module_path = os.path.join(os.path.dirname(__file__), | ||
88 | - '..', '..', 'python') | ||
89 | - try: | ||
90 | - env['PYTHONPATH'] += os.pathsep + qemu_module_path | ||
91 | - except KeyError: | ||
92 | - env['PYTHONPATH'] = qemu_module_path | ||
93 | subprocess.run(('pylint-3', '--score=n', '--notes=FIXME,XXX', *files), | ||
94 | env=env, check=False) | ||
95 | |||
96 | diff --git a/tests/qemu-iotests/300 b/tests/qemu-iotests/300 | ||
97 | index XXXXXXX..XXXXXXX 100755 | ||
98 | --- a/tests/qemu-iotests/300 | ||
99 | +++ b/tests/qemu-iotests/300 | ||
100 | @@ -XXX,XX +XXX,XX @@ import random | ||
101 | import re | ||
102 | from typing import Dict, List, Optional | ||
103 | |||
104 | +from qemu.machine import machine | ||
105 | + | ||
106 | import iotests | ||
107 | |||
108 | -# Import qemu after iotests.py has amended sys.path | ||
109 | -# pylint: disable=wrong-import-order | ||
110 | -from qemu.machine import machine | ||
111 | |||
112 | BlockBitmapMapping = List[Dict[str, object]] | ||
113 | |||
114 | diff --git a/tests/qemu-iotests/tests/mirror-top-perms b/tests/qemu-iotests/tests/mirror-top-perms | ||
115 | index XXXXXXX..XXXXXXX 100755 | ||
116 | --- a/tests/qemu-iotests/tests/mirror-top-perms | ||
117 | +++ b/tests/qemu-iotests/tests/mirror-top-perms | ||
118 | @@ -XXX,XX +XXX,XX @@ | ||
119 | # | ||
120 | |||
121 | import os | ||
122 | -import iotests | ||
123 | -from iotests import qemu_img | ||
124 | |||
125 | -# Import qemu after iotests.py has amended sys.path | ||
126 | -# pylint: disable=wrong-import-order | ||
127 | import qemu | ||
128 | |||
129 | +import iotests | ||
130 | +from iotests import qemu_img | ||
131 | + | ||
132 | |||
133 | image_size = 1 * 1024 * 1024 | ||
134 | source = os.path.join(iotests.test_dir, 'source.img') | ||
135 | -- | ||
136 | 2.31.1 | ||
137 | |||
138 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: John Snow <jsnow@redhat.com> | ||
2 | 1 | ||
3 | We can circumvent the '__main__' redefinition problem by passing | ||
4 | --scripts-are-modules. Take mypy out of the loop per-filename and check | ||
5 | everything in one go: it's quite a bit faster. | ||
6 | |||
7 | Signed-off-by: John Snow <jsnow@redhat.com> | ||
8 | Reviewed-by: Hanna Reitz <hreitz@redhat.com> | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
11 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
12 | Message-Id: <20210923180715.4168522-4-jsnow@redhat.com> | ||
13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
14 | --- | ||
15 | tests/qemu-iotests/297 | 46 +++++++++++++++++++----------------------- | ||
16 | 1 file changed, 21 insertions(+), 25 deletions(-) | ||
17 | |||
18 | diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 | ||
19 | index XXXXXXX..XXXXXXX 100755 | ||
20 | --- a/tests/qemu-iotests/297 | ||
21 | +++ b/tests/qemu-iotests/297 | ||
22 | @@ -XXX,XX +XXX,XX @@ def run_linters(): | ||
23 | print('=== mypy ===') | ||
24 | sys.stdout.flush() | ||
25 | |||
26 | - # We have to call mypy separately for each file. Otherwise, it | ||
27 | - # will interpret all given files as belonging together (i.e., they | ||
28 | - # may not both define the same classes, etc.; most notably, they | ||
29 | - # must not both define the __main__ module). | ||
30 | env['MYPYPATH'] = env['PYTHONPATH'] | ||
31 | - for filename in files: | ||
32 | - p = subprocess.run(('mypy', | ||
33 | - '--warn-unused-configs', | ||
34 | - '--disallow-subclassing-any', | ||
35 | - '--disallow-any-generics', | ||
36 | - '--disallow-incomplete-defs', | ||
37 | - '--disallow-untyped-decorators', | ||
38 | - '--no-implicit-optional', | ||
39 | - '--warn-redundant-casts', | ||
40 | - '--warn-unused-ignores', | ||
41 | - '--no-implicit-reexport', | ||
42 | - '--namespace-packages', | ||
43 | - filename), | ||
44 | - env=env, | ||
45 | - check=False, | ||
46 | - stdout=subprocess.PIPE, | ||
47 | - stderr=subprocess.STDOUT, | ||
48 | - universal_newlines=True) | ||
49 | - | ||
50 | - if p.returncode != 0: | ||
51 | - print(p.stdout) | ||
52 | + p = subprocess.run(('mypy', | ||
53 | + '--warn-unused-configs', | ||
54 | + '--disallow-subclassing-any', | ||
55 | + '--disallow-any-generics', | ||
56 | + '--disallow-incomplete-defs', | ||
57 | + '--disallow-untyped-decorators', | ||
58 | + '--no-implicit-optional', | ||
59 | + '--warn-redundant-casts', | ||
60 | + '--warn-unused-ignores', | ||
61 | + '--no-implicit-reexport', | ||
62 | + '--namespace-packages', | ||
63 | + '--scripts-are-modules', | ||
64 | + *files), | ||
65 | + env=env, | ||
66 | + check=False, | ||
67 | + stdout=subprocess.PIPE, | ||
68 | + stderr=subprocess.STDOUT, | ||
69 | + universal_newlines=True) | ||
70 | + | ||
71 | + if p.returncode != 0: | ||
72 | + print(p.stdout) | ||
73 | |||
74 | |||
75 | for linter in ('pylint-3', 'mypy'): | ||
76 | -- | ||
77 | 2.31.1 | ||
78 | |||
79 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: John Snow <jsnow@redhat.com> | ||
2 | 1 | ||
3 | We need to import subpackages from the qemu namespace package; importing | ||
4 | the namespace package alone doesn't bring the subpackages with it -- | ||
5 | unless someone else (like iotests.py) imports them too. | ||
6 | |||
7 | Adjust the imports. | ||
8 | |||
9 | Signed-off-by: John Snow <jsnow@redhat.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
11 | Reviewed-by: Hanna Reitz <hreitz@redhat.com> | ||
12 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
13 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
14 | Message-Id: <20210923180715.4168522-5-jsnow@redhat.com> | ||
15 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
16 | --- | ||
17 | tests/qemu-iotests/tests/mirror-top-perms | 7 ++++--- | ||
18 | 1 file changed, 4 insertions(+), 3 deletions(-) | ||
19 | |||
20 | diff --git a/tests/qemu-iotests/tests/mirror-top-perms b/tests/qemu-iotests/tests/mirror-top-perms | ||
21 | index XXXXXXX..XXXXXXX 100755 | ||
22 | --- a/tests/qemu-iotests/tests/mirror-top-perms | ||
23 | +++ b/tests/qemu-iotests/tests/mirror-top-perms | ||
24 | @@ -XXX,XX +XXX,XX @@ | ||
25 | |||
26 | import os | ||
27 | |||
28 | -import qemu | ||
29 | +from qemu import qmp | ||
30 | +from qemu.machine import machine | ||
31 | |||
32 | import iotests | ||
33 | from iotests import qemu_img | ||
34 | @@ -XXX,XX +XXX,XX @@ class TestMirrorTopPerms(iotests.QMPTestCase): | ||
35 | def tearDown(self): | ||
36 | try: | ||
37 | self.vm.shutdown() | ||
38 | - except qemu.machine.machine.AbnormalShutdown: | ||
39 | + except machine.AbnormalShutdown: | ||
40 | pass | ||
41 | |||
42 | if self.vm_b is not None: | ||
43 | @@ -XXX,XX +XXX,XX @@ class TestMirrorTopPerms(iotests.QMPTestCase): | ||
44 | self.vm_b.launch() | ||
45 | print('ERROR: VM B launched successfully, this should not have ' | ||
46 | 'happened') | ||
47 | - except qemu.qmp.QMPConnectError: | ||
48 | + except qmp.QMPConnectError: | ||
49 | assert 'Is another process using the image' in self.vm_b.get_log() | ||
50 | |||
51 | result = self.vm.qmp('block-job-cancel', | ||
52 | -- | ||
53 | 2.31.1 | ||
54 | |||
55 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: John Snow <jsnow@redhat.com> | ||
2 | 1 | ||
3 | Mostly uninteresting stuff. Move the test injections under a function | ||
4 | named main() so that the variables used during that process aren't in | ||
5 | the global scope. | ||
6 | |||
7 | Signed-off-by: John Snow <jsnow@redhat.com> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Reviewed-by: Hanna Reitz <hreitz@redhat.com> | ||
10 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
11 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
12 | Message-Id: <20210923180715.4168522-6-jsnow@redhat.com> | ||
13 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
14 | --- | ||
15 | tests/qemu-iotests/tests/migrate-bitmaps-test | 50 +++++++++++-------- | ||
16 | 1 file changed, 28 insertions(+), 22 deletions(-) | ||
17 | |||
18 | diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-test b/tests/qemu-iotests/tests/migrate-bitmaps-test | ||
19 | index XXXXXXX..XXXXXXX 100755 | ||
20 | --- a/tests/qemu-iotests/tests/migrate-bitmaps-test | ||
21 | +++ b/tests/qemu-iotests/tests/migrate-bitmaps-test | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
24 | # | ||
25 | |||
26 | -import os | ||
27 | import itertools | ||
28 | import operator | ||
29 | +import os | ||
30 | import re | ||
31 | + | ||
32 | import iotests | ||
33 | from iotests import qemu_img, qemu_img_create, Timeout | ||
34 | |||
35 | @@ -XXX,XX +XXX,XX @@ def inject_test_case(klass, suffix, method, *args, **kwargs): | ||
36 | setattr(klass, 'test_' + method + suffix, lambda self: mc(self)) | ||
37 | |||
38 | |||
39 | -for cmb in list(itertools.product((True, False), repeat=5)): | ||
40 | - name = ('_' if cmb[0] else '_not_') + 'persistent_' | ||
41 | - name += ('_' if cmb[1] else '_not_') + 'migbitmap_' | ||
42 | - name += '_online' if cmb[2] else '_offline' | ||
43 | - name += '_shared' if cmb[3] else '_nonshared' | ||
44 | - if cmb[4]: | ||
45 | - name += '__pre_shutdown' | ||
46 | - | ||
47 | - inject_test_case(TestDirtyBitmapMigration, name, 'do_test_migration', | ||
48 | - *list(cmb)) | ||
49 | - | ||
50 | -for cmb in list(itertools.product((True, False), repeat=2)): | ||
51 | - name = ('_' if cmb[0] else '_not_') + 'persistent_' | ||
52 | - name += ('_' if cmb[1] else '_not_') + 'migbitmap' | ||
53 | - | ||
54 | - inject_test_case(TestDirtyBitmapMigration, name, | ||
55 | - 'do_test_migration_resume_source', *list(cmb)) | ||
56 | - | ||
57 | - | ||
58 | class TestDirtyBitmapBackingMigration(iotests.QMPTestCase): | ||
59 | def setUp(self): | ||
60 | qemu_img_create('-f', iotests.imgfmt, base_a, size) | ||
61 | @@ -XXX,XX +XXX,XX @@ class TestDirtyBitmapBackingMigration(iotests.QMPTestCase): | ||
62 | self.assert_qmp(result, 'return', {}) | ||
63 | |||
64 | |||
65 | +def main() -> None: | ||
66 | + for cmb in list(itertools.product((True, False), repeat=5)): | ||
67 | + name = ('_' if cmb[0] else '_not_') + 'persistent_' | ||
68 | + name += ('_' if cmb[1] else '_not_') + 'migbitmap_' | ||
69 | + name += '_online' if cmb[2] else '_offline' | ||
70 | + name += '_shared' if cmb[3] else '_nonshared' | ||
71 | + if cmb[4]: | ||
72 | + name += '__pre_shutdown' | ||
73 | + | ||
74 | + inject_test_case(TestDirtyBitmapMigration, name, 'do_test_migration', | ||
75 | + *list(cmb)) | ||
76 | + | ||
77 | + for cmb in list(itertools.product((True, False), repeat=2)): | ||
78 | + name = ('_' if cmb[0] else '_not_') + 'persistent_' | ||
79 | + name += ('_' if cmb[1] else '_not_') + 'migbitmap' | ||
80 | + | ||
81 | + inject_test_case(TestDirtyBitmapMigration, name, | ||
82 | + 'do_test_migration_resume_source', *list(cmb)) | ||
83 | + | ||
84 | + iotests.main( | ||
85 | + supported_fmts=['qcow2'], | ||
86 | + supported_protocols=['file'] | ||
87 | + ) | ||
88 | + | ||
89 | + | ||
90 | if __name__ == '__main__': | ||
91 | - iotests.main(supported_fmts=['qcow2'], | ||
92 | - supported_protocols=['file']) | ||
93 | + main() | ||
94 | -- | ||
95 | 2.31.1 | ||
96 | |||
97 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: John Snow <jsnow@redhat.com> | ||
2 | 1 | ||
3 | 1. Ignore the new f-strings warning, we're not interested in doing a | ||
4 | full conversion at this time. | ||
5 | |||
6 | 2. Just mute the unbalanced-tuple-unpacking warning, it's not a real | ||
7 | error in this case and muting the dozens of callsites is just not | ||
8 | worth it. | ||
9 | |||
10 | 3. Add encodings to read_text(). | ||
11 | |||
12 | Signed-off-by: John Snow <jsnow@redhat.com> | ||
13 | Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
14 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
15 | Message-Id: <20210923180715.4168522-7-jsnow@redhat.com> | ||
16 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
17 | --- | ||
18 | tests/qemu-iotests/testrunner.py | 7 ++++--- | ||
19 | tests/qemu-iotests/pylintrc | 6 +++++- | ||
20 | 2 files changed, 9 insertions(+), 4 deletions(-) | ||
21 | |||
22 | diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/tests/qemu-iotests/testrunner.py | ||
25 | +++ b/tests/qemu-iotests/testrunner.py | ||
26 | @@ -XXX,XX +XXX,XX @@ def do_run_test(self, test: str) -> TestResult: | ||
27 | diff=file_diff(str(f_reference), str(f_bad))) | ||
28 | |||
29 | if f_notrun.exists(): | ||
30 | - return TestResult(status='not run', | ||
31 | - description=f_notrun.read_text().strip()) | ||
32 | + return TestResult( | ||
33 | + status='not run', | ||
34 | + description=f_notrun.read_text(encoding='utf-8').strip()) | ||
35 | |||
36 | casenotrun = '' | ||
37 | if f_casenotrun.exists(): | ||
38 | - casenotrun = f_casenotrun.read_text() | ||
39 | + casenotrun = f_casenotrun.read_text(encoding='utf-8') | ||
40 | |||
41 | diff = file_diff(str(f_reference), str(f_bad)) | ||
42 | if diff: | ||
43 | diff --git a/tests/qemu-iotests/pylintrc b/tests/qemu-iotests/pylintrc | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/tests/qemu-iotests/pylintrc | ||
46 | +++ b/tests/qemu-iotests/pylintrc | ||
47 | @@ -XXX,XX +XXX,XX @@ disable=invalid-name, | ||
48 | too-many-public-methods, | ||
49 | # pylint warns about Optional[] etc. as unsubscriptable in 3.9 | ||
50 | unsubscriptable-object, | ||
51 | + # pylint's static analysis causes false positivies for file_path(); | ||
52 | + # If we really care to make it statically knowable, we'll use mypy. | ||
53 | + unbalanced-tuple-unpacking, | ||
54 | # Sometimes we need to disable a newly introduced pylint warning. | ||
55 | # Doing so should not produce a warning in older versions of pylint. | ||
56 | bad-option-value, | ||
57 | # These are temporary, and should be removed: | ||
58 | missing-docstring, | ||
59 | too-many-return-statements, | ||
60 | - too-many-statements | ||
61 | + too-many-statements, | ||
62 | + consider-using-f-string, | ||
63 | |||
64 | [FORMAT] | ||
65 | |||
66 | -- | ||
67 | 2.31.1 | ||
68 | |||
69 | diff view generated by jsdifflib |