1
The following changes since commit ee86981bda9ecd40c8daf81b7307b1d2aff68174:
1
The following changes since commit ec11dc41eec5142b4776db1296972c6323ba5847:
2
2
3
migration: Revert postcopy-blocktime commit set (2018-01-23 10:08:05 +0000)
3
Merge tag 'pull-misc-2022-05-11' of git://repo.or.cz/qemu/armbru into staging (2022-05-11 09:00:26 -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 8c0c5e636e6b11eaf0556be31fceb68e0baff310:
9
for you to fetch changes up to f70625299ecc9ba577c87f3d1d75012c747c7d88:
10
10
11
Merge remote-tracking branch 'mreitz/tags/pull-block-2018-01-23' into queue-block (2018-01-23 12:40:46 +0100)
11
qemu-iotests: inline common.config into common.rc (2022-05-12 15:42:49 +0200)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Block layer patches
14
Block layer patches
15
15
16
- coroutine: Fix crashes due to too large pool batch size
17
- fdc: Prevent end-of-track overrun
18
- nbd: MULTI_CONN for shared writable exports
19
- iotests test runner improvements
20
16
----------------------------------------------------------------
21
----------------------------------------------------------------
17
Daniel Henrique Barboza (1):
22
Daniel P. Berrangé (2):
18
tests/qemu-iotests: adding savevm/loadvm with postcopy flag test
23
tests/qemu-iotests: print intent to run a test in TAP mode
24
.gitlab-ci.d: export meson testlog.txt as an artifact
19
25
20
Eric Blake (1):
26
Eric Blake (2):
21
iotests: Split 177 into two parts for compat=0.10
27
qemu-nbd: Pass max connections to blockdev layer
28
nbd/server: Allow MULTI_CONN for shared writable exports
22
29
23
Fam Zheng (1):
30
Hanna Reitz (1):
24
osdep: Retry SETLK upon EINTR
31
iotests/testrunner: Flush after run_test()
25
26
Hikaru Nishida (1):
27
hw/block: Fix pin-based interrupt behaviour of NVMe
28
32
29
Kevin Wolf (2):
33
Kevin Wolf (2):
30
tests/.gitignore: Add test-bdrv-drain
34
coroutine: Rename qemu_coroutine_inc/dec_pool_size()
31
Merge remote-tracking branch 'mreitz/tags/pull-block-2018-01-23' into queue-block
35
coroutine: Revert to constant batch size
32
36
33
Max Reitz (24):
37
Paolo Bonzini (1):
34
qcow2: Repair unaligned preallocated zero clusters
38
qemu-iotests: inline common.config into common.rc
35
iotests: Make BD-{remove,insert}-medium use @id
36
tests/ahci: Switch tray and medium commands to @id
37
blockdev: Drop BD-{remove,insert}-medium's @device
38
blockdev: Mark BD-{remove,insert}-medium stable
39
qemu-iotests: Fix locking issue in 102
40
block/vmdk: Fix , instead of ; at end of line
41
qcow2: No persistent dirty bitmaps for compat=0.10
42
block/qcow: Add blkdebug events
43
block/vmdk: Add blkdebug events
44
iotests: Fix _img_info for backslashes
45
iotests: Drop format-specific in _filter_img_info
46
iotests: Forbid 020 for non-file protocols
47
iotests: Skip 103 for refcount_bits=1
48
iotests: Fix 020 for vmdk
49
iotests: Fix 051 for compat=0.10
50
iotests: Fix 059's reference output
51
iotests: Fix 067 for compat=0.10
52
iotests: Make 089 compatible with compat=0.10
53
iotests: Make 184 image-less
54
iotests: Make 191 work with qcow2 options
55
iotests: Filter compat-dependent info in 198
56
iotests: Make 059 pass on machines with little RAM
57
iotests: Disable some tests for compat=0.10
58
39
59
qapi/block-core.json | 42 ++----
40
Philippe Mathieu-Daudé (2):
60
hw/block/nvme.h | 1 +
41
hw/block/fdc: Prevent end-of-track overrun (CVE-2021-3507)
61
block/qcow.c | 16 ++
42
tests/qtest/fdc-test: Add a regression test for CVE-2021-3507
62
block/qcow2-bitmap.c | 10 ++
63
block/qcow2-refcount.c | 70 +++++++--
64
block/qcow2.c | 14 +-
65
block/vmdk.c | 18 ++-
66
blockdev.c | 30 +++-
67
hw/block/nvme.c | 39 ++++-
68
tests/ahci-test.c | 16 +-
69
util/osdep.c | 4 +-
70
tests/.gitignore | 1 +
71
tests/qemu-iotests/020 | 17 +--
72
tests/qemu-iotests/020.out | 6 +-
73
tests/qemu-iotests/051 | 2 +
74
tests/qemu-iotests/051.out | 1 +
75
tests/qemu-iotests/051.pc.out | 1 +
76
tests/qemu-iotests/059 | 4 +-
77
tests/qemu-iotests/059.out | 2 +-
78
tests/qemu-iotests/060 | 3 +-
79
tests/qemu-iotests/060.out | 9 ++
80
tests/qemu-iotests/067 | 3 +-
81
tests/qemu-iotests/067.out | 97 ++++--------
82
tests/qemu-iotests/080 | 5 +-
83
tests/qemu-iotests/089 | 4 +-
84
tests/qemu-iotests/089.out | 10 --
85
tests/qemu-iotests/093 | 6 +-
86
tests/qemu-iotests/102 | 7 +-
87
tests/qemu-iotests/102.out | 3 +-
88
tests/qemu-iotests/103 | 2 +
89
tests/qemu-iotests/118 | 184 +++++++++++------------
90
tests/qemu-iotests/130 | 2 +
91
tests/qemu-iotests/137 | 2 +
92
tests/qemu-iotests/139 | 2 +-
93
tests/qemu-iotests/155 | 60 ++++----
94
tests/qemu-iotests/176 | 2 +
95
tests/qemu-iotests/177 | 20 +--
96
tests/qemu-iotests/177.out | 22 +--
97
tests/qemu-iotests/184 | 25 +---
98
tests/qemu-iotests/184.out | 63 ++------
99
tests/qemu-iotests/191 | 5 +-
100
tests/qemu-iotests/191.out | 313 +++++++++++----------------------------
101
tests/qemu-iotests/198 | 8 +-
102
tests/qemu-iotests/198.out | 8 -
103
tests/qemu-iotests/201 | 120 +++++++++++++++
104
tests/qemu-iotests/201.out | 23 +++
105
tests/qemu-iotests/204 | 119 +++++++++++++++
106
tests/qemu-iotests/204.out | 63 ++++++++
107
tests/qemu-iotests/common.filter | 29 +++-
108
tests/qemu-iotests/common.rc | 2 +-
109
tests/qemu-iotests/group | 2 +
110
51 files changed, 870 insertions(+), 647 deletions(-)
111
create mode 100755 tests/qemu-iotests/201
112
create mode 100644 tests/qemu-iotests/201.out
113
create mode 100755 tests/qemu-iotests/204
114
create mode 100644 tests/qemu-iotests/204.out
115
43
44
qapi/block-export.json | 8 +-
45
docs/interop/nbd.txt | 1 +
46
docs/tools/qemu-nbd.rst | 3 +-
47
include/block/nbd.h | 5 +-
48
include/qemu/coroutine.h | 6 +-
49
blockdev-nbd.c | 13 +-
50
hw/block/fdc.c | 8 ++
51
hw/block/virtio-blk.c | 6 +-
52
nbd/server.c | 10 +-
53
qemu-nbd.c | 2 +-
54
tests/qtest/fdc-test.c | 21 ++++
55
util/qemu-coroutine.c | 26 ++--
56
tests/qemu-iotests/testrunner.py | 4 +
57
.gitlab-ci.d/buildtest-template.yml | 12 +-
58
MAINTAINERS | 1 +
59
tests/qemu-iotests/common.config | 41 -------
60
tests/qemu-iotests/common.rc | 31 +++--
61
tests/qemu-iotests/tests/nbd-multiconn | 145 +++++++++++++++++++++++
62
tests/qemu-iotests/tests/nbd-multiconn.out | 5 +
63
tests/qemu-iotests/tests/nbd-qemu-allocation.out | 2 +-
64
20 files changed, 261 insertions(+), 89 deletions(-)
65
delete mode 100644 tests/qemu-iotests/common.config
66
create mode 100755 tests/qemu-iotests/tests/nbd-multiconn
67
create mode 100644 tests/qemu-iotests/tests/nbd-multiconn.out
68
69
diff view generated by jsdifflib
1
From: Max Reitz <mreitz@redhat.com>
1
It's true that these functions currently affect the batch size in which
2
coroutines are reused (i.e. moved from the global release pool to the
3
allocation pool of a specific thread), but this is a bug and will be
4
fixed in a separate patch.
2
5
3
This is an incompatible change, which is fine as the commands are
6
In fact, the comment in the header file already just promises that it
4
experimental.
7
influences the pool size, so reflect this in the name of the functions.
8
As a nice side effect, the shorter function name makes some line
9
wrapping unnecessary.
5
10
6
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
Cc: qemu-stable@nongnu.org
7
Message-id: 20171110224302.14424-4-mreitz@redhat.com
12
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8
Reviewed-by: Alberto Garcia <berto@igalia.com>
13
Message-Id: <20220510151020.105528-2-kwolf@redhat.com>
9
Signed-off-by: Max Reitz <mreitz@redhat.com>
14
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
15
---
11
qapi/block-core.json | 10 ++--------
16
include/qemu/coroutine.h | 6 +++---
12
blockdev.c | 30 +++++++++++++++++++++++-------
17
hw/block/virtio-blk.c | 6 ++----
13
2 files changed, 25 insertions(+), 15 deletions(-)
18
util/qemu-coroutine.c | 4 ++--
19
3 files changed, 7 insertions(+), 9 deletions(-)
14
20
15
diff --git a/qapi/block-core.json b/qapi/block-core.json
21
diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h
16
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
17
--- a/qapi/block-core.json
23
--- a/include/qemu/coroutine.h
18
+++ b/qapi/block-core.json
24
+++ b/include/qemu/coroutine.h
19
@@ -XXX,XX +XXX,XX @@
25
@@ -XXX,XX +XXX,XX @@ void coroutine_fn yield_until_fd_readable(int fd);
20
#
26
/**
21
# If the tray is open and there is no medium inserted, this will be a no-op.
27
* Increase coroutine pool size
22
#
28
*/
23
-# @device: Block device name (deprecated, use @id instead)
29
-void qemu_coroutine_increase_pool_batch_size(unsigned int additional_pool_size);
24
-#
30
+void qemu_coroutine_inc_pool_size(unsigned int additional_pool_size);
25
# @id: The name or QOM path of the guest device (since: 2.8)
31
26
#
32
/**
27
# Note: This command is still a work in progress and is considered experimental.
33
- * Devcrease coroutine pool size
28
@@ -XXX,XX +XXX,XX @@
34
+ * Decrease coroutine pool size
29
#
35
*/
30
##
36
-void qemu_coroutine_decrease_pool_batch_size(unsigned int additional_pool_size);
31
{ 'command': 'x-blockdev-remove-medium',
37
+void qemu_coroutine_dec_pool_size(unsigned int additional_pool_size);
32
- 'data': { '*device': 'str',
38
33
- '*id': 'str' } }
39
#include "qemu/lockable.h"
34
+ 'data': { 'id': 'str' } }
40
35
41
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
36
##
37
# @x-blockdev-insert-medium:
38
@@ -XXX,XX +XXX,XX @@
39
# device's tray must currently be open (unless there is no attached guest
40
# device) and there must be no medium inserted already.
41
#
42
-# @device: Block device name (deprecated, use @id instead)
43
-#
44
# @id: The name or QOM path of the guest device (since: 2.8)
45
#
46
# @node-name: name of a node in the block driver state graph
47
@@ -XXX,XX +XXX,XX @@
48
#
49
##
50
{ 'command': 'x-blockdev-insert-medium',
51
- 'data': { '*device': 'str',
52
- '*id': 'str',
53
+ 'data': { 'id': 'str',
54
'node-name': 'str'} }
55
56
57
diff --git a/blockdev.c b/blockdev.c
58
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
59
--- a/blockdev.c
43
--- a/hw/block/virtio-blk.c
60
+++ b/blockdev.c
44
+++ b/hw/block/virtio-blk.c
61
@@ -XXX,XX +XXX,XX @@ static QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_states =
45
@@ -XXX,XX +XXX,XX @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
62
46
for (i = 0; i < conf->num_queues; i++) {
63
static int do_open_tray(const char *blk_name, const char *qdev_id,
47
virtio_add_queue(vdev, conf->queue_size, virtio_blk_handle_output);
64
bool force, Error **errp);
65
+static void blockdev_remove_medium(bool has_device, const char *device,
66
+ bool has_id, const char *id, Error **errp);
67
+static void blockdev_insert_medium(bool has_device, const char *device,
68
+ bool has_id, const char *id,
69
+ const char *node_name, Error **errp);
70
71
static const char *const if_name[IF_COUNT] = {
72
[IF_NONE] = "none",
73
@@ -XXX,XX +XXX,XX @@ void qmp_eject(bool has_device, const char *device,
74
}
48
}
75
error_free(local_err);
49
- qemu_coroutine_increase_pool_batch_size(conf->num_queues * conf->queue_size
76
50
- / 2);
77
- qmp_x_blockdev_remove_medium(has_device, device, has_id, id, errp);
51
+ qemu_coroutine_inc_pool_size(conf->num_queues * conf->queue_size / 2);
78
+ blockdev_remove_medium(has_device, device, has_id, id, errp);
52
virtio_blk_data_plane_create(vdev, conf, &s->dataplane, &err);
53
if (err != NULL) {
54
error_propagate(errp, err);
55
@@ -XXX,XX +XXX,XX @@ static void virtio_blk_device_unrealize(DeviceState *dev)
56
for (i = 0; i < conf->num_queues; i++) {
57
virtio_del_queue(vdev, i);
58
}
59
- qemu_coroutine_decrease_pool_batch_size(conf->num_queues * conf->queue_size
60
- / 2);
61
+ qemu_coroutine_dec_pool_size(conf->num_queues * conf->queue_size / 2);
62
qemu_del_vm_change_state_handler(s->change);
63
blockdev_mark_auto_del(s->blk);
64
virtio_cleanup(vdev);
65
diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
66
index XXXXXXX..XXXXXXX 100644
67
--- a/util/qemu-coroutine.c
68
+++ b/util/qemu-coroutine.c
69
@@ -XXX,XX +XXX,XX @@ AioContext *coroutine_fn qemu_coroutine_get_aio_context(Coroutine *co)
70
return co->ctx;
79
}
71
}
80
72
81
void qmp_block_passwd(bool has_device, const char *device,
73
-void qemu_coroutine_increase_pool_batch_size(unsigned int additional_pool_size)
82
@@ -XXX,XX +XXX,XX @@ void qmp_blockdev_close_tray(bool has_device, const char *device,
74
+void qemu_coroutine_inc_pool_size(unsigned int additional_pool_size)
83
}
75
{
76
qatomic_add(&pool_batch_size, additional_pool_size);
84
}
77
}
85
78
86
-void qmp_x_blockdev_remove_medium(bool has_device, const char *device,
79
-void qemu_coroutine_decrease_pool_batch_size(unsigned int removing_pool_size)
87
- bool has_id, const char *id, Error **errp)
80
+void qemu_coroutine_dec_pool_size(unsigned int removing_pool_size)
88
+static void blockdev_remove_medium(bool has_device, const char *device,
89
+ bool has_id, const char *id, Error **errp)
90
{
81
{
91
BlockBackend *blk;
82
qatomic_sub(&pool_batch_size, removing_pool_size);
92
BlockDriverState *bs;
93
@@ -XXX,XX +XXX,XX @@ out:
94
aio_context_release(aio_context);
95
}
83
}
96
97
+void qmp_x_blockdev_remove_medium(const char *id, Error **errp)
98
+{
99
+ blockdev_remove_medium(false, NULL, true, id, errp);
100
+}
101
+
102
static void qmp_blockdev_insert_anon_medium(BlockBackend *blk,
103
BlockDriverState *bs, Error **errp)
104
{
105
@@ -XXX,XX +XXX,XX @@ static void qmp_blockdev_insert_anon_medium(BlockBackend *blk,
106
}
107
}
108
109
-void qmp_x_blockdev_insert_medium(bool has_device, const char *device,
110
- bool has_id, const char *id,
111
- const char *node_name, Error **errp)
112
+static void blockdev_insert_medium(bool has_device, const char *device,
113
+ bool has_id, const char *id,
114
+ const char *node_name, Error **errp)
115
{
116
BlockBackend *blk;
117
BlockDriverState *bs;
118
@@ -XXX,XX +XXX,XX @@ void qmp_x_blockdev_insert_medium(bool has_device, const char *device,
119
qmp_blockdev_insert_anon_medium(blk, bs, errp);
120
}
121
122
+void qmp_x_blockdev_insert_medium(const char *id, const char *node_name,
123
+ Error **errp)
124
+{
125
+ blockdev_insert_medium(false, NULL, true, id, node_name, errp);
126
+}
127
+
128
void qmp_blockdev_change_medium(bool has_device, const char *device,
129
bool has_id, const char *id,
130
const char *filename,
131
@@ -XXX,XX +XXX,XX @@ void qmp_blockdev_change_medium(bool has_device, const char *device,
132
error_free(err);
133
err = NULL;
134
135
- qmp_x_blockdev_remove_medium(has_device, device, has_id, id, &err);
136
+ blockdev_remove_medium(has_device, device, has_id, id, &err);
137
if (err) {
138
error_propagate(errp, err);
139
goto fail;
140
--
84
--
141
2.13.6
85
2.35.3
142
143
diff view generated by jsdifflib
1
From: Fam Zheng <famz@redhat.com>
1
Commit 4c41c69e changed the way the coroutine pool is sized because for
2
virtio-blk devices with a large queue size and heavy I/O, it was just
3
too small and caused coroutines to be deleted and reallocated soon
4
afterwards. The change made the size dynamic based on the number of
5
queues and the queue size of virtio-blk devices.
2
6
3
We could hit lock failure if there is a signal that makes fcntl return
7
There are two important numbers here: Slightly simplified, when a
4
-1 and errno set to EINTR. In this case we should retry.
8
coroutine terminates, it is generally stored in the global release pool
9
up to a certain pool size, and if the pool is full, it is freed.
10
Conversely, when allocating a new coroutine, the coroutines in the
11
release pool are reused if the pool already has reached a certain
12
minimum size (the batch size), otherwise we allocate new coroutines.
13
14
The problem after commit 4c41c69e is that it not only increases the
15
maximum pool size (which is the intended effect), but also the batch
16
size for reusing coroutines (which is a bug). It means that in cases
17
with many devices and/or a large queue size (which defaults to the
18
number of vcpus for virtio-blk-pci), many thousand coroutines could be
19
sitting in the release pool without being reused.
20
21
This is not only a waste of memory and allocations, but it actually
22
makes the QEMU process likely to hit the vm.max_map_count limit on Linux
23
because each coroutine requires two mappings (its stack and the guard
24
page for the stack), causing it to abort() in qemu_alloc_stack() because
25
when the limit is hit, mprotect() starts to fail with ENOMEM.
26
27
In order to fix the problem, change the batch size back to 64 to avoid
28
uselessly accumulating coroutines in the release pool, but keep the
29
dynamic maximum pool size so that coroutines aren't freed too early
30
in heavy I/O scenarios.
31
32
Note that this fix doesn't strictly make it impossible to hit the limit,
33
but this would only happen if most of the coroutines are actually in use
34
at the same time, not just sitting in a pool. This is the same behaviour
35
as we already had before commit 4c41c69e. Fully preventing this would
36
require allowing qemu_coroutine_create() to return an error, but it
37
doesn't seem to be a scenario that people hit in practice.
5
38
6
Cc: qemu-stable@nongnu.org
39
Cc: qemu-stable@nongnu.org
7
Signed-off-by: Fam Zheng <famz@redhat.com>
40
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2079938
8
Reviewed-by: Eric Blake <eblake@redhat.com>
41
Fixes: 4c41c69e05fe28c0f95f8abd2ebf407e95a4f04b
42
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
43
Message-Id: <20220510151020.105528-3-kwolf@redhat.com>
44
Tested-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
45
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
46
---
11
util/osdep.c | 4 +++-
47
util/qemu-coroutine.c | 22 ++++++++++++++--------
12
1 file changed, 3 insertions(+), 1 deletion(-)
48
1 file changed, 14 insertions(+), 8 deletions(-)
13
49
14
diff --git a/util/osdep.c b/util/osdep.c
50
diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
15
index XXXXXXX..XXXXXXX 100644
51
index XXXXXXX..XXXXXXX 100644
16
--- a/util/osdep.c
52
--- a/util/qemu-coroutine.c
17
+++ b/util/osdep.c
53
+++ b/util/qemu-coroutine.c
18
@@ -XXX,XX +XXX,XX @@ static int qemu_lock_fcntl(int fd, int64_t start, int64_t len, int fl_type)
54
@@ -XXX,XX +XXX,XX @@
19
.l_type = fl_type,
55
#include "qemu/coroutine-tls.h"
20
};
56
#include "block/aio.h"
21
qemu_probe_lock_ops();
57
22
- ret = fcntl(fd, fcntl_op_setlk, &fl);
58
-/** Initial batch size is 64, and is increased on demand */
23
+ do {
59
+/**
24
+ ret = fcntl(fd, fcntl_op_setlk, &fl);
60
+ * The minimal batch size is always 64, coroutines from the release_pool are
25
+ } while (ret == -1 && errno == EINTR);
61
+ * reused as soon as there are 64 coroutines in it. The maximum pool size starts
26
return ret == -1 ? -errno : 0;
62
+ * with 64 and is increased on demand so that coroutines are not deleted even if
63
+ * they are not immediately reused.
64
+ */
65
enum {
66
- POOL_INITIAL_BATCH_SIZE = 64,
67
+ POOL_MIN_BATCH_SIZE = 64,
68
+ POOL_INITIAL_MAX_SIZE = 64,
69
};
70
71
/** Free list to speed up creation */
72
static QSLIST_HEAD(, Coroutine) release_pool = QSLIST_HEAD_INITIALIZER(pool);
73
-static unsigned int pool_batch_size = POOL_INITIAL_BATCH_SIZE;
74
+static unsigned int pool_max_size = POOL_INITIAL_MAX_SIZE;
75
static unsigned int release_pool_size;
76
77
typedef QSLIST_HEAD(, Coroutine) CoroutineQSList;
78
@@ -XXX,XX +XXX,XX @@ Coroutine *qemu_coroutine_create(CoroutineEntry *entry, void *opaque)
79
80
co = QSLIST_FIRST(alloc_pool);
81
if (!co) {
82
- if (release_pool_size > qatomic_read(&pool_batch_size)) {
83
+ if (release_pool_size > POOL_MIN_BATCH_SIZE) {
84
/* Slow path; a good place to register the destructor, too. */
85
Notifier *notifier = get_ptr_coroutine_pool_cleanup_notifier();
86
if (!notifier->notify) {
87
@@ -XXX,XX +XXX,XX @@ static void coroutine_delete(Coroutine *co)
88
co->caller = NULL;
89
90
if (CONFIG_COROUTINE_POOL) {
91
- if (release_pool_size < qatomic_read(&pool_batch_size) * 2) {
92
+ if (release_pool_size < qatomic_read(&pool_max_size) * 2) {
93
QSLIST_INSERT_HEAD_ATOMIC(&release_pool, co, pool_next);
94
qatomic_inc(&release_pool_size);
95
return;
96
}
97
- if (get_alloc_pool_size() < qatomic_read(&pool_batch_size)) {
98
+ if (get_alloc_pool_size() < qatomic_read(&pool_max_size)) {
99
QSLIST_INSERT_HEAD(get_ptr_alloc_pool(), co, pool_next);
100
set_alloc_pool_size(get_alloc_pool_size() + 1);
101
return;
102
@@ -XXX,XX +XXX,XX @@ AioContext *coroutine_fn qemu_coroutine_get_aio_context(Coroutine *co)
103
104
void qemu_coroutine_inc_pool_size(unsigned int additional_pool_size)
105
{
106
- qatomic_add(&pool_batch_size, additional_pool_size);
107
+ qatomic_add(&pool_max_size, additional_pool_size);
27
}
108
}
28
109
110
void qemu_coroutine_dec_pool_size(unsigned int removing_pool_size)
111
{
112
- qatomic_sub(&pool_batch_size, removing_pool_size);
113
+ qatomic_sub(&pool_max_size, removing_pool_size);
114
}
29
--
115
--
30
2.13.6
116
2.35.3
31
32
diff view generated by jsdifflib
1
Commit 881cfd17 added a new test binary, include it in .gitignore.
1
From: Hanna Reitz <hreitz@redhat.com>
2
2
3
Reported-by: Eric Blake <eblake@redhat.com>
3
When stdout is not a terminal, the buffer may not be flushed at each end
4
of line, so we should flush after each test is done. This is especially
5
apparent when run by check-block, in two ways:
6
7
First, when running make check-block -jX with X > 1, progress indication
8
was missing, even though testrunner.py does theoretically print each
9
test's status once it has been run, even in multi-processing mode.
10
Flushing after each test restores this progress indication.
11
12
Second, sometimes make check-block failed altogether, with an error
13
message that "too few tests [were] run". I presume that's because one
14
worker process in the job pool did not get to flush its stdout before
15
the main process exited, and so meson did not get to see that worker's
16
test results. In any case, by flushing at the end of run_test(), the
17
problem has disappeared for me.
18
19
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
20
Message-Id: <20220506134215.10086-1-hreitz@redhat.com>
21
Reviewed-by: Eric Blake <eblake@redhat.com>
4
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
22
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5
Reviewed-by: Eric Blake <eblake@redhat.com>
6
---
23
---
7
tests/.gitignore | 1 +
24
tests/qemu-iotests/testrunner.py | 1 +
8
1 file changed, 1 insertion(+)
25
1 file changed, 1 insertion(+)
9
26
10
diff --git a/tests/.gitignore b/tests/.gitignore
27
diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
11
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
12
--- a/tests/.gitignore
29
--- a/tests/qemu-iotests/testrunner.py
13
+++ b/tests/.gitignore
30
+++ b/tests/qemu-iotests/testrunner.py
14
@@ -XXX,XX +XXX,XX @@ test-aio
31
@@ -XXX,XX +XXX,XX @@ def run_test(self, test: str,
15
test-aio-multithread
32
else:
16
test-arm-mptimer
33
print(res.casenotrun)
17
test-base64
34
18
+test-bdrv-drain
35
+ sys.stdout.flush()
19
test-bitops
36
return res
20
test-bitcnt
37
21
test-blockjob
38
def run_tests(self, tests: List[str], jobs: int = 1) -> bool:
22
--
39
--
23
2.13.6
40
2.35.3
24
25
diff view generated by jsdifflib
1
From: Max Reitz <mreitz@redhat.com>
1
From: Daniel P. Berrangé <berrange@redhat.com>
2
2
3
We can easily repair unaligned preallocated zero clusters by discarding
3
When running I/O tests using TAP output mode, we get a single TAP test
4
them, so why not do it?
4
with a sub-test reported for each I/O test that is run. The output looks
5
something like this:
5
6
6
Signed-off-by: Max Reitz <mreitz@redhat.com>
7
1..123
7
Message-id: 20171110203759.14018-2-mreitz@redhat.com
8
ok qcow2 011
8
Reviewed-by: Eric Blake <eblake@redhat.com>
9
ok qcow2 012
9
Signed-off-by: Max Reitz <mreitz@redhat.com>
10
ok qcow2 013
11
ok qcow2 217
12
...
13
14
If everything runs or fails normally this is fine, but periodically we
15
have been seeing the test harness abort early before all 123 tests have
16
been run, just leaving a fairly useless message like
17
18
TAP parsing error: Too few tests run (expected 123, got 107)
19
20
we have no idea which tests were running at the time the test harness
21
abruptly exited. This change causes us to print a message about our
22
intent to run each test, so we have a record of what is active at the
23
time the harness exits abnormally.
24
25
1..123
26
# running qcow2 011
27
ok qcow2 011
28
# running qcow2 012
29
ok qcow2 012
30
# running qcow2 013
31
ok qcow2 013
32
# running qcow2 217
33
ok qcow2 217
34
...
35
36
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
37
Message-Id: <20220509124134.867431-2-berrange@redhat.com>
38
Reviewed-by: Thomas Huth <thuth@redhat.com>
39
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
40
---
11
block/qcow2-refcount.c | 70 ++++++++++++++++++++++++++++++++++++++--------
41
tests/qemu-iotests/testrunner.py | 3 +++
12
tests/qemu-iotests/060 | 3 +-
42
1 file changed, 3 insertions(+)
13
tests/qemu-iotests/060.out | 9 ++++++
14
3 files changed, 69 insertions(+), 13 deletions(-)
15
43
16
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
44
diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
17
index XXXXXXX..XXXXXXX 100644
45
index XXXXXXX..XXXXXXX 100644
18
--- a/block/qcow2-refcount.c
46
--- a/tests/qemu-iotests/testrunner.py
19
+++ b/block/qcow2-refcount.c
47
+++ b/tests/qemu-iotests/testrunner.py
20
@@ -XXX,XX +XXX,XX @@ enum {
48
@@ -XXX,XX +XXX,XX @@ def run_test(self, test: str,
21
static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res,
49
starttime=start,
22
void **refcount_table,
50
lasttime=last_el,
23
int64_t *refcount_table_size, int64_t l2_offset,
51
end = '\n' if mp else '\r')
24
- int flags)
52
+ else:
25
+ int flags, BdrvCheckMode fix)
53
+ testname = os.path.basename(test)
26
{
54
+ print(f'# running {self.env.imgfmt} {testname}')
27
BDRVQcow2State *s = bs->opaque;
55
28
uint64_t *l2_table, l2_entry;
56
res = self.do_run_test(test, mp)
29
@@ -XXX,XX +XXX,XX @@ static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res,
30
next_contiguous_offset = offset + s->cluster_size;
31
}
32
33
+ /* Correct offsets are cluster aligned */
34
+ if (offset_into_cluster(s, offset)) {
35
+ if (qcow2_get_cluster_type(l2_entry) ==
36
+ QCOW2_CLUSTER_ZERO_ALLOC)
37
+ {
38
+ fprintf(stderr, "%s offset=%" PRIx64 ": Preallocated zero "
39
+ "cluster is not properly aligned; L2 entry "
40
+ "corrupted.\n",
41
+ fix & BDRV_FIX_ERRORS ? "Repairing" : "ERROR",
42
+ offset);
43
+ if (fix & BDRV_FIX_ERRORS) {
44
+ uint64_t l2e_offset =
45
+ l2_offset + (uint64_t)i * sizeof(uint64_t);
46
+
47
+ l2_entry = QCOW_OFLAG_ZERO;
48
+ l2_table[i] = cpu_to_be64(l2_entry);
49
+ ret = qcow2_pre_write_overlap_check(bs,
50
+ QCOW2_OL_ACTIVE_L2 | QCOW2_OL_INACTIVE_L2,
51
+ l2e_offset, sizeof(uint64_t));
52
+ if (ret < 0) {
53
+ fprintf(stderr, "ERROR: Overlap check failed\n");
54
+ res->check_errors++;
55
+ /* Something is seriously wrong, so abort checking
56
+ * this L2 table */
57
+ goto fail;
58
+ }
59
+
60
+ ret = bdrv_pwrite_sync(bs->file, l2e_offset,
61
+ &l2_table[i], sizeof(uint64_t));
62
+ if (ret < 0) {
63
+ fprintf(stderr, "ERROR: Failed to overwrite L2 "
64
+ "table entry: %s\n", strerror(-ret));
65
+ res->check_errors++;
66
+ /* Do not abort, continue checking the rest of this
67
+ * L2 table's entries */
68
+ } else {
69
+ res->corruptions_fixed++;
70
+ /* Skip marking the cluster as used
71
+ * (it is unused now) */
72
+ continue;
73
+ }
74
+ } else {
75
+ res->corruptions++;
76
+ }
77
+ } else {
78
+ fprintf(stderr, "ERROR offset=%" PRIx64 ": Data cluster is "
79
+ "not properly aligned; L2 entry corrupted.\n", offset);
80
+ res->corruptions++;
81
+ }
82
+ }
83
+
84
/* Mark cluster as used */
85
ret = qcow2_inc_refcounts_imrt(bs, res,
86
refcount_table, refcount_table_size,
87
@@ -XXX,XX +XXX,XX @@ static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res,
88
if (ret < 0) {
89
goto fail;
90
}
91
-
92
- /* Correct offsets are cluster aligned */
93
- if (offset_into_cluster(s, offset)) {
94
- fprintf(stderr, "ERROR offset=%" PRIx64 ": Cluster is not "
95
- "properly aligned; L2 entry corrupted.\n", offset);
96
- res->corruptions++;
97
- }
98
break;
99
}
100
101
@@ -XXX,XX +XXX,XX @@ static int check_refcounts_l1(BlockDriverState *bs,
102
void **refcount_table,
103
int64_t *refcount_table_size,
104
int64_t l1_table_offset, int l1_size,
105
- int flags)
106
+ int flags, BdrvCheckMode fix)
107
{
108
BDRVQcow2State *s = bs->opaque;
109
uint64_t *l1_table = NULL, l2_offset, l1_size2;
110
@@ -XXX,XX +XXX,XX @@ static int check_refcounts_l1(BlockDriverState *bs,
111
112
/* Process and check L2 entries */
113
ret = check_refcounts_l2(bs, res, refcount_table,
114
- refcount_table_size, l2_offset, flags);
115
+ refcount_table_size, l2_offset, flags,
116
+ fix);
117
if (ret < 0) {
118
goto fail;
119
}
120
@@ -XXX,XX +XXX,XX @@ static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
121
122
/* current L1 table */
123
ret = check_refcounts_l1(bs, res, refcount_table, nb_clusters,
124
- s->l1_table_offset, s->l1_size, CHECK_FRAG_INFO);
125
+ s->l1_table_offset, s->l1_size, CHECK_FRAG_INFO,
126
+ fix);
127
if (ret < 0) {
128
return ret;
129
}
130
@@ -XXX,XX +XXX,XX @@ static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
131
for (i = 0; i < s->nb_snapshots; i++) {
132
sn = s->snapshots + i;
133
ret = check_refcounts_l1(bs, res, refcount_table, nb_clusters,
134
- sn->l1_table_offset, sn->l1_size, 0);
135
+ sn->l1_table_offset, sn->l1_size, 0, fix);
136
if (ret < 0) {
137
return ret;
138
}
139
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
140
index XXXXXXX..XXXXXXX 100755
141
--- a/tests/qemu-iotests/060
142
+++ b/tests/qemu-iotests/060
143
@@ -XXX,XX +XXX,XX @@ poke_file "$TEST_IMG" "$l2_offset" "\x80\x00\x00\x00\x00\x00\x2a\x01"
144
# Let's write to it!
145
$QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
146
147
-# Can't repair this yet (TODO: We can just deallocate the cluster)
148
+echo '--- Repairing ---'
149
+_check_test_img -r all
150
151
echo
152
echo '=== Discarding with an unaligned refblock ==='
153
diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out
154
index XXXXXXX..XXXXXXX 100644
155
--- a/tests/qemu-iotests/060.out
156
+++ b/tests/qemu-iotests/060.out
157
@@ -XXX,XX +XXX,XX @@ discard 65536/65536 bytes at offset 0
158
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
159
qcow2: Marking image as corrupt: Preallocated zero cluster offset 0x2a00 unaligned (guest offset: 0); further corruption events will be suppressed
160
write failed: Input/output error
161
+--- Repairing ---
162
+Repairing offset=2a00: Preallocated zero cluster is not properly aligned; L2 entry corrupted.
163
+The following inconsistencies were found and repaired:
164
+
165
+ 0 leaked clusters
166
+ 1 corruptions
167
+
168
+Double checking the fixed image now...
169
+No errors were found on the image.
170
171
=== Discarding with an unaligned refblock ===
172
57
173
--
58
--
174
2.13.6
59
2.35.3
175
60
176
61
diff view generated by jsdifflib
1
From: Max Reitz <mreitz@redhat.com>
1
From: Daniel P. Berrangé <berrange@redhat.com>
2
2
3
Tests 080, 130, 137, and 176 simply do not work with compat=0.10 for the
3
When running 'make check' we only get a summary of progress on the
4
reasons stated there.
4
console. Fortunately meson/ninja have saved the raw test output to a
5
logfile. Exposing this log will make it easier to debug failures that
6
happen in CI.
5
7
6
Signed-off-by: Max Reitz <mreitz@redhat.com>
8
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7
Message-Id: <20171123020832.8165-10-mreitz@redhat.com>
9
Message-Id: <20220509124134.867431-3-berrange@redhat.com>
8
[eblake: fix 177 in a separate commit]
10
Reviewed-by: Thomas Huth <thuth@redhat.com>
9
Signed-off-by: Eric Blake <eblake@redhat.com>
11
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Message-id: 20180117165420.15946-3-eblake@redhat.com
12
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11
Signed-off-by: Max Reitz <mreitz@redhat.com>
12
---
13
---
13
tests/qemu-iotests/080 | 5 +++--
14
.gitlab-ci.d/buildtest-template.yml | 12 ++++++++++--
14
tests/qemu-iotests/130 | 2 ++
15
1 file changed, 10 insertions(+), 2 deletions(-)
15
tests/qemu-iotests/137 | 2 ++
16
tests/qemu-iotests/176 | 2 ++
17
4 files changed, 9 insertions(+), 2 deletions(-)
18
16
19
diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080
17
diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml
20
index XXXXXXX..XXXXXXX 100755
18
index XXXXXXX..XXXXXXX 100644
21
--- a/tests/qemu-iotests/080
19
--- a/.gitlab-ci.d/buildtest-template.yml
22
+++ b/tests/qemu-iotests/080
20
+++ b/.gitlab-ci.d/buildtest-template.yml
23
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
21
@@ -XXX,XX +XXX,XX @@
24
_supported_fmt qcow2
22
make -j"$JOBS" $MAKE_CHECK_ARGS ;
25
_supported_proto file
23
fi
26
_supported_os Linux
24
27
-# Internal snapshots are (currently) impossible with refcount_bits=1
25
-.native_test_job_template:
28
-_unsupported_imgopts 'refcount_bits=1[^0-9]'
26
+.common_test_job_template:
29
+# - Internal snapshots are (currently) impossible with refcount_bits=1
27
stage: test
30
+# - This is generally a test for compat=1.1 images
28
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
31
+_unsupported_imgopts 'refcount_bits=1[^0-9]' 'compat=0.10'
29
script:
32
30
@@ -XXX,XX +XXX,XX @@
33
header_size=104
31
# Avoid recompiling by hiding ninja with NINJA=":"
34
32
- make NINJA=":" $MAKE_CHECK_ARGS
35
diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130
33
36
index XXXXXXX..XXXXXXX 100755
34
+.native_test_job_template:
37
--- a/tests/qemu-iotests/130
35
+ extends: .common_test_job_template
38
+++ b/tests/qemu-iotests/130
36
+ artifacts:
39
@@ -XXX,XX +XXX,XX @@ _supported_fmt qcow2
37
+ name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
40
_supported_proto generic
38
+ expire_in: 7 days
41
_unsupported_proto vxhs
39
+ paths:
42
_supported_os Linux
40
+ - build/meson-logs/testlog.txt
43
+# We are going to use lazy-refcounts
41
+
44
+_unsupported_imgopts 'compat=0.10'
42
.avocado_test_job_template:
45
43
- extends: .native_test_job_template
46
qemu_comm_method="monitor"
44
+ extends: .common_test_job_template
47
45
cache:
48
diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137
46
key: "${CI_JOB_NAME}-cache"
49
index XXXXXXX..XXXXXXX 100755
47
paths:
50
--- a/tests/qemu-iotests/137
51
+++ b/tests/qemu-iotests/137
52
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
53
_supported_fmt qcow2
54
_supported_proto file
55
_supported_os Linux
56
+# We are going to use lazy-refcounts
57
+_unsupported_imgopts 'compat=0.10'
58
59
60
_make_test_img 64M
61
diff --git a/tests/qemu-iotests/176 b/tests/qemu-iotests/176
62
index XXXXXXX..XXXXXXX 100755
63
--- a/tests/qemu-iotests/176
64
+++ b/tests/qemu-iotests/176
65
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
66
_supported_fmt qcow2
67
_supported_proto file
68
_supported_os Linux
69
+# Persistent dirty bitmaps require compat=1.1
70
+_unsupported_imgopts 'compat=0.10'
71
72
function run_qemu()
73
{
74
--
48
--
75
2.13.6
49
2.35.3
76
50
77
51
diff view generated by jsdifflib
1
From: Max Reitz <mreitz@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
Signed-off-by: Max Reitz <mreitz@redhat.com>
3
Per the 82078 datasheet, if the end-of-track (EOT byte in
4
Message-id: 20171129192411.6637-1-mreitz@redhat.com
4
the FIFO) is more than the number of sectors per side, the
5
Reviewed-by: John Snow <jsnow@redhat.com>
5
command is terminated unsuccessfully:
6
Signed-off-by: Max Reitz <mreitz@redhat.com>
6
7
* 5.2.5 DATA TRANSFER TERMINATION
8
9
The 82078 supports terminal count explicitly through
10
the TC pin and implicitly through the underrun/over-
11
run and end-of-track (EOT) functions. For full sector
12
transfers, the EOT parameter can define the last
13
sector to be transferred in a single or multisector
14
transfer. If the last sector to be transferred is a par-
15
tial sector, the host can stop transferring the data in
16
mid-sector, and the 82078 will continue to complete
17
the sector as if a hardware TC was received. The
18
only difference between these implicit functions and
19
TC is that they return "abnormal termination" result
20
status. Such status indications can be ignored if they
21
were expected.
22
23
* 6.1.3 READ TRACK
24
25
This command terminates when the EOT specified
26
number of sectors have been read. If the 82078
27
does not find an I D Address Mark on the diskette
28
after the second· occurrence of a pulse on the
29
INDX# pin, then it sets the IC code in Status Regis-
30
ter 0 to "01" (Abnormal termination), sets the MA bit
31
in Status Register 1 to "1", and terminates the com-
32
mand.
33
34
* 6.1.6 VERIFY
35
36
Refer to Table 6-6 and Table 6-7 for information
37
concerning the values of MT and EC versus SC and
38
EOT value.
39
40
* Table 6·6. Result Phase Table
41
42
* Table 6-7. Verify Command Result Phase Table
43
44
Fix by aborting the transfer when EOT > # Sectors Per Side.
45
46
Cc: qemu-stable@nongnu.org
47
Cc: Hervé Poussineau <hpoussin@reactos.org>
48
Fixes: baca51faff0 ("floppy driver: disk geometry auto detect")
49
Reported-by: Alexander Bulekov <alxndr@bu.edu>
50
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/339
51
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
52
Message-Id: <20211118115733.4038610-2-philmd@redhat.com>
53
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
54
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7
---
55
---
8
tests/qemu-iotests/059 | 4 +++-
56
hw/block/fdc.c | 8 ++++++++
9
1 file changed, 3 insertions(+), 1 deletion(-)
57
1 file changed, 8 insertions(+)
10
58
11
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
59
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
12
index XXXXXXX..XXXXXXX 100755
60
index XXXXXXX..XXXXXXX 100644
13
--- a/tests/qemu-iotests/059
61
--- a/hw/block/fdc.c
14
+++ b/tests/qemu-iotests/059
62
+++ b/hw/block/fdc.c
15
@@ -XXX,XX +XXX,XX @@ done
63
@@ -XXX,XX +XXX,XX @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction)
16
echo
64
int tmp;
17
echo "=== Testing afl image with a very large capacity ==="
65
fdctrl->data_len = 128 << (fdctrl->fifo[5] > 7 ? 7 : fdctrl->fifo[5]);
18
_use_sample_img afl9.vmdk.bz2
66
tmp = (fdctrl->fifo[6] - ks + 1);
19
-_img_info
67
+ if (tmp < 0) {
20
+# The sed makes this test pass on machines with little RAM
68
+ FLOPPY_DPRINTF("invalid EOT: %d\n", tmp);
21
+# (and also with 32 bit builds)
69
+ fdctrl_stop_transfer(fdctrl, FD_SR0_ABNTERM, FD_SR1_MA, 0x00);
22
+_img_info | sed -e 's/Cannot allocate memory/Invalid argument/'
70
+ fdctrl->fifo[3] = kt;
23
_cleanup_test_img
71
+ fdctrl->fifo[4] = kh;
24
72
+ fdctrl->fifo[5] = ks;
25
# success, all done
73
+ return;
74
+ }
75
if (fdctrl->fifo[0] & 0x80)
76
tmp += fdctrl->fifo[6];
77
fdctrl->data_len *= tmp;
26
--
78
--
27
2.13.6
79
2.35.3
28
80
29
81
diff view generated by jsdifflib
1
From: Hikaru Nishida <hikarupsp@gmail.com>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
Pin-based interrupt of NVMe controller did not work properly
3
Add the reproducer from https://gitlab.com/qemu-project/qemu/-/issues/339
4
because using an obsolated function pci_irq_pulse().
5
To fix this, change to use pci_irq_assert() / pci_irq_deassert()
6
instead of pci_irq_pulse().
7
4
8
Signed-off-by: Hikaru Nishida <hikarupsp@gmail.com>
5
Without the previous commit, when running 'make check-qtest-i386'
9
Reviewed-by: Keith Busch <keith.busch@intel.com>
6
with QEMU configured with '--enable-sanitizers' we get:
7
8
==4028352==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x619000062a00 at pc 0x5626d03c491a bp 0x7ffdb4199410 sp 0x7ffdb4198bc0
9
READ of size 786432 at 0x619000062a00 thread T0
10
#0 0x5626d03c4919 in __asan_memcpy (qemu-system-i386+0x1e65919)
11
#1 0x5626d1c023cc in flatview_write_continue softmmu/physmem.c:2787:13
12
#2 0x5626d1bf0c0f in flatview_write softmmu/physmem.c:2822:14
13
#3 0x5626d1bf0798 in address_space_write softmmu/physmem.c:2914:18
14
#4 0x5626d1bf0f37 in address_space_rw softmmu/physmem.c:2924:16
15
#5 0x5626d1bf14c8 in cpu_physical_memory_rw softmmu/physmem.c:2933:5
16
#6 0x5626d0bd5649 in cpu_physical_memory_write include/exec/cpu-common.h:82:5
17
#7 0x5626d0bd0a07 in i8257_dma_write_memory hw/dma/i8257.c:452:9
18
#8 0x5626d09f825d in fdctrl_transfer_handler hw/block/fdc.c:1616:13
19
#9 0x5626d0a048b4 in fdctrl_start_transfer hw/block/fdc.c:1539:13
20
#10 0x5626d09f4c3e in fdctrl_write_data hw/block/fdc.c:2266:13
21
#11 0x5626d09f22f7 in fdctrl_write hw/block/fdc.c:829:9
22
#12 0x5626d1c20bc5 in portio_write softmmu/ioport.c:207:17
23
24
0x619000062a00 is located 0 bytes to the right of 512-byte region [0x619000062800,0x619000062a00)
25
allocated by thread T0 here:
26
#0 0x5626d03c66ec in posix_memalign (qemu-system-i386+0x1e676ec)
27
#1 0x5626d2b988d4 in qemu_try_memalign util/oslib-posix.c:210:11
28
#2 0x5626d2b98b0c in qemu_memalign util/oslib-posix.c:226:27
29
#3 0x5626d09fbaf0 in fdctrl_realize_common hw/block/fdc.c:2341:20
30
#4 0x5626d0a150ed in isabus_fdc_realize hw/block/fdc-isa.c:113:5
31
#5 0x5626d2367935 in device_set_realized hw/core/qdev.c:531:13
32
33
SUMMARY: AddressSanitizer: heap-buffer-overflow (qemu-system-i386+0x1e65919) in __asan_memcpy
34
Shadow bytes around the buggy address:
35
0x0c32800044f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
36
0x0c3280004500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
37
0x0c3280004510: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
38
0x0c3280004520: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
39
0x0c3280004530: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
40
=>0x0c3280004540:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
41
0x0c3280004550: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
42
0x0c3280004560: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
43
0x0c3280004570: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
44
0x0c3280004580: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
45
0x0c3280004590: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
46
Shadow byte legend (one shadow byte represents 8 application bytes):
47
Addressable: 00
48
Heap left redzone: fa
49
Freed heap region: fd
50
==4028352==ABORTING
51
52
[ kwolf: Added snapshot=on to prevent write file lock failure ]
53
54
Reported-by: Alexander Bulekov <alxndr@bu.edu>
55
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
56
Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
10
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
57
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11
---
58
---
12
hw/block/nvme.h | 1 +
59
tests/qtest/fdc-test.c | 21 +++++++++++++++++++++
13
hw/block/nvme.c | 39 ++++++++++++++++++++++++++++++++++-----
60
1 file changed, 21 insertions(+)
14
2 files changed, 35 insertions(+), 5 deletions(-)
15
61
16
diff --git a/hw/block/nvme.h b/hw/block/nvme.h
62
diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c
17
index XXXXXXX..XXXXXXX 100644
63
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/block/nvme.h
64
--- a/tests/qtest/fdc-test.c
19
+++ b/hw/block/nvme.h
65
+++ b/tests/qtest/fdc-test.c
20
@@ -XXX,XX +XXX,XX @@ typedef struct NvmeCtrl {
66
@@ -XXX,XX +XXX,XX @@ static void test_cve_2021_20196(void)
21
uint32_t cmbsz;
67
qtest_quit(s);
22
uint32_t cmbloc;
23
uint8_t *cmbuf;
24
+ uint64_t irq_status;
25
26
char *serial;
27
NvmeNamespace *namespaces;
28
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/hw/block/nvme.c
31
+++ b/hw/block/nvme.c
32
@@ -XXX,XX +XXX,XX @@ static uint8_t nvme_sq_empty(NvmeSQueue *sq)
33
return sq->head == sq->tail;
34
}
68
}
35
69
36
-static void nvme_isr_notify(NvmeCtrl *n, NvmeCQueue *cq)
70
+static void test_cve_2021_3507(void)
37
+static void nvme_irq_check(NvmeCtrl *n)
38
+{
71
+{
39
+ if (msix_enabled(&(n->parent_obj))) {
72
+ QTestState *s;
40
+ return;
73
+
41
+ }
74
+ s = qtest_initf("-nographic -m 32M -nodefaults "
42
+ if (~n->bar.intms & n->irq_status) {
75
+ "-drive file=%s,format=raw,if=floppy,snapshot=on",
43
+ pci_irq_assert(&n->parent_obj);
76
+ test_image);
44
+ } else {
77
+ qtest_outl(s, 0x9, 0x0a0206);
45
+ pci_irq_deassert(&n->parent_obj);
78
+ qtest_outw(s, 0x3f4, 0x1600);
46
+ }
79
+ qtest_outw(s, 0x3f4, 0x0000);
80
+ qtest_outw(s, 0x3f4, 0x0000);
81
+ qtest_outw(s, 0x3f4, 0x0000);
82
+ qtest_outw(s, 0x3f4, 0x0200);
83
+ qtest_outw(s, 0x3f4, 0x0200);
84
+ qtest_outw(s, 0x3f4, 0x0000);
85
+ qtest_outw(s, 0x3f4, 0x0000);
86
+ qtest_outw(s, 0x3f4, 0x0000);
87
+ qtest_quit(s);
47
+}
88
+}
48
+
89
+
49
+static void nvme_irq_assert(NvmeCtrl *n, NvmeCQueue *cq)
90
int main(int argc, char **argv)
50
{
91
{
51
if (cq->irq_enabled) {
92
int fd;
52
if (msix_enabled(&(n->parent_obj))) {
93
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
53
@@ -XXX,XX +XXX,XX @@ static void nvme_isr_notify(NvmeCtrl *n, NvmeCQueue *cq)
94
qtest_add_func("/fdc/read_no_dma_19", test_read_no_dma_19);
54
msix_notify(&(n->parent_obj), cq->vector);
95
qtest_add_func("/fdc/fuzz-registers", fuzz_registers);
55
} else {
96
qtest_add_func("/fdc/fuzz/cve_2021_20196", test_cve_2021_20196);
56
trace_nvme_irq_pin();
97
+ qtest_add_func("/fdc/fuzz/cve_2021_3507", test_cve_2021_3507);
57
- pci_irq_pulse(&n->parent_obj);
98
58
+ assert(cq->cqid < 64);
99
ret = g_test_run();
59
+ n->irq_status |= 1 << cq->cqid;
100
60
+ nvme_irq_check(n);
61
}
62
} else {
63
trace_nvme_irq_masked();
64
}
65
}
66
67
+static void nvme_irq_deassert(NvmeCtrl *n, NvmeCQueue *cq)
68
+{
69
+ if (cq->irq_enabled) {
70
+ if (msix_enabled(&(n->parent_obj))) {
71
+ return;
72
+ } else {
73
+ assert(cq->cqid < 64);
74
+ n->irq_status &= ~(1 << cq->cqid);
75
+ nvme_irq_check(n);
76
+ }
77
+ }
78
+}
79
+
80
static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1,
81
uint64_t prp2, uint32_t len, NvmeCtrl *n)
82
{
83
@@ -XXX,XX +XXX,XX @@ static void nvme_post_cqes(void *opaque)
84
sizeof(req->cqe));
85
QTAILQ_INSERT_TAIL(&sq->req_list, req, entry);
86
}
87
- nvme_isr_notify(n, cq);
88
+ nvme_irq_assert(n, cq);
89
}
90
91
static void nvme_enqueue_req_completion(NvmeCQueue *cq, NvmeRequest *req)
92
@@ -XXX,XX +XXX,XX @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data,
93
n->bar.intmc = n->bar.intms;
94
trace_nvme_mmio_intm_set(data & 0xffffffff,
95
n->bar.intmc);
96
+ nvme_irq_check(n);
97
break;
98
case 0x10: /* INTMC */
99
if (unlikely(msix_enabled(&(n->parent_obj)))) {
100
@@ -XXX,XX +XXX,XX @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data,
101
n->bar.intmc = n->bar.intms;
102
trace_nvme_mmio_intm_clr(data & 0xffffffff,
103
n->bar.intmc);
104
+ nvme_irq_check(n);
105
break;
106
case 0x14: /* CC */
107
trace_nvme_mmio_cfg(data & 0xffffffff);
108
@@ -XXX,XX +XXX,XX @@ static void nvme_process_db(NvmeCtrl *n, hwaddr addr, int val)
109
timer_mod(cq->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 500);
110
}
111
112
- if (cq->tail != cq->head) {
113
- nvme_isr_notify(n, cq);
114
+ if (cq->tail == cq->head) {
115
+ nvme_irq_deassert(n, cq);
116
}
117
} else {
118
/* Submission queue doorbell write */
119
--
101
--
120
2.13.6
102
2.35.3
121
103
122
104
diff view generated by jsdifflib
1
From: Eric Blake <eblake@redhat.com>
1
From: Eric Blake <eblake@redhat.com>
2
2
3
When originally written, test 177 explicitly took care to run
3
The next patch wants to adjust whether the NBD server code advertises
4
with compat=0.10. Then I botched my own test in commit
4
MULTI_CONN based on whether it is known if the server limits to
5
81c219ac and f0a9c18f, by adding additional actions that require
5
exactly one client. For a server started by QMP, this information is
6
v3 images. Split out the new code into a new v3-only test, 204,
6
obtained through nbd_server_start (which can support more than one
7
and revert 177 back to its original state other than a new comment.
7
export); but for qemu-nbd (which supports exactly one export), it is
8
controlled only by the command-line option -e/--shared. Since we
9
already have a hook function used by qemu-nbd, it's easiest to just
10
alter its signature to fit our needs.
8
11
9
Reported-by: Max Reitz <mreitz@redhat.com>
10
Signed-off-by: Eric Blake <eblake@redhat.com>
12
Signed-off-by: Eric Blake <eblake@redhat.com>
11
Message-id: 20180117165420.15946-2-eblake@redhat.com
13
Message-Id: <20220512004924.417153-2-eblake@redhat.com>
12
Signed-off-by: Max Reitz <mreitz@redhat.com>
14
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13
---
15
---
14
tests/qemu-iotests/177 | 20 +++-----
16
include/block/nbd.h | 2 +-
15
tests/qemu-iotests/177.out | 22 ++-------
17
blockdev-nbd.c | 8 ++++----
16
tests/qemu-iotests/204 | 119 +++++++++++++++++++++++++++++++++++++++++++++
18
qemu-nbd.c | 2 +-
17
tests/qemu-iotests/204.out | 63 ++++++++++++++++++++++++
19
3 files changed, 6 insertions(+), 6 deletions(-)
18
tests/qemu-iotests/group | 1 +
19
5 files changed, 193 insertions(+), 32 deletions(-)
20
create mode 100755 tests/qemu-iotests/204
21
create mode 100644 tests/qemu-iotests/204.out
22
20
23
diff --git a/tests/qemu-iotests/177 b/tests/qemu-iotests/177
21
diff --git a/include/block/nbd.h b/include/block/nbd.h
24
index XXXXXXX..XXXXXXX 100755
22
index XXXXXXX..XXXXXXX 100644
25
--- a/tests/qemu-iotests/177
23
--- a/include/block/nbd.h
26
+++ b/tests/qemu-iotests/177
24
+++ b/include/block/nbd.h
27
@@ -XXX,XX +XXX,XX @@
25
@@ -XXX,XX +XXX,XX @@ void nbd_client_new(QIOChannelSocket *sioc,
28
#
26
void nbd_client_get(NBDClient *client);
29
# Test corner cases with unusual block geometries
27
void nbd_client_put(NBDClient *client);
30
#
28
31
-# Copyright (C) 2016-2017 Red Hat, Inc.
29
-void nbd_server_is_qemu_nbd(bool value);
32
+# Copyright (C) 2016-2018 Red Hat, Inc.
30
+void nbd_server_is_qemu_nbd(int max_connections);
33
#
31
bool nbd_server_is_running(void);
34
# This program is free software; you can redistribute it and/or modify
32
void nbd_server_start(SocketAddress *addr, const char *tls_creds,
35
# it under the terms of the GNU General Public License as published by
33
const char *tls_authz, uint32_t max_connections,
36
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
34
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
37
. ./common.rc
35
index XXXXXXX..XXXXXXX 100644
38
. ./common.filter
36
--- a/blockdev-nbd.c
39
37
+++ b/blockdev-nbd.c
40
+# This test is runnable under compat=0.10; see test 204 for additional
38
@@ -XXX,XX +XXX,XX @@ typedef struct NBDServerData {
41
+# tests specific to compat=1.1.
39
} NBDServerData;
42
+
40
43
_supported_fmt qcow2
41
static NBDServerData *nbd_server;
44
_supported_proto file
42
-static bool is_qemu_nbd;
45
43
+static int qemu_nbd_connections = -1; /* Non-negative if this is qemu-nbd */
46
CLUSTER_SIZE=1M
44
47
size=128M
45
static void nbd_update_server_watch(NBDServerData *s);
48
options=driver=blkdebug,image.driver=qcow2
46
49
-nested_opts=image.file.driver=file,image.file.filename=$TEST_IMG
47
-void nbd_server_is_qemu_nbd(bool value)
50
48
+void nbd_server_is_qemu_nbd(int max_connections)
51
echo
49
{
52
echo "== setting up files =="
50
- is_qemu_nbd = value;
53
@@ -XXX,XX +XXX,XX @@ echo "== setting up files =="
51
+ qemu_nbd_connections = max_connections;
54
TEST_IMG="$TEST_IMG.base" _make_test_img $size
55
$QEMU_IO -c "write -P 11 0 $size" "$TEST_IMG.base" | _filter_qemu_io
56
_make_test_img -b "$TEST_IMG.base"
57
-$QEMU_IO -c "write -P 22 0 110M" "$TEST_IMG" | _filter_qemu_io
58
+$QEMU_IO -c "write -P 22 0 $size" "$TEST_IMG" | _filter_qemu_io
59
60
# Limited to 64k max-transfer
61
echo
62
@@ -XXX,XX +XXX,XX @@ $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
63
-c "discard 80000001 30M" | _filter_qemu_io
64
65
echo
66
-echo "== block status smaller than alignment =="
67
-limits=align=4k
68
-$QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
69
-     -c "alloc 1 1" -c "alloc 0x6dffff0 1000" -c "alloc 127m 5P" \
70
-     -c map | _filter_qemu_io
71
-
72
-echo
73
echo "== verify image content =="
74
75
function verify_io()
76
@@ -XXX,XX +XXX,XX @@ function verify_io()
77
echo read -P 0 32M 32M
78
echo read -P 22 64M 13M
79
echo read -P $discarded 77M 29M
80
- echo read -P 22 106M 4M
81
- echo read -P 11 110M 18M
82
+ echo read -P 22 106M 22M
83
}
52
}
84
53
85
verify_io | $QEMU_IO -r "$TEST_IMG" | _filter_qemu_io
54
bool nbd_server_is_running(void)
86
-$QEMU_IMG map --image-opts "$options,$nested_opts,align=4k" \
55
{
87
- | _filter_qemu_img_map
56
- return nbd_server || is_qemu_nbd;
88
57
+ return nbd_server || qemu_nbd_connections >= 0;
89
_check_test_img
58
}
90
59
91
diff --git a/tests/qemu-iotests/177.out b/tests/qemu-iotests/177.out
60
static void nbd_blockdev_client_closed(NBDClient *client, bool ignored)
61
diff --git a/qemu-nbd.c b/qemu-nbd.c
92
index XXXXXXX..XXXXXXX 100644
62
index XXXXXXX..XXXXXXX 100644
93
--- a/tests/qemu-iotests/177.out
63
--- a/qemu-nbd.c
94
+++ b/tests/qemu-iotests/177.out
64
+++ b/qemu-nbd.c
95
@@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728
65
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
96
wrote 134217728/134217728 bytes at offset 0
66
97
128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
67
bs->detect_zeroes = detect_zeroes;
98
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/t.IMGFMT.base
68
99
-wrote 115343360/115343360 bytes at offset 0
69
- nbd_server_is_qemu_nbd(true);
100
-110 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
70
+ nbd_server_is_qemu_nbd(shared);
101
+wrote 134217728/134217728 bytes at offset 0
71
102
+128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
72
export_opts = g_new(BlockExportOptions, 1);
103
73
*export_opts = (BlockExportOptions) {
104
== constrained alignment and max-transfer ==
105
wrote 131072/131072 bytes at offset 1000
106
@@ -XXX,XX +XXX,XX @@ wrote 33554432/33554432 bytes at offset 33554432
107
discard 31457280/31457280 bytes at offset 80000001
108
30 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
109
110
-== block status smaller than alignment ==
111
-1/1 bytes allocated at offset 1 bytes
112
-16/1000 bytes allocated at offset 110 MiB
113
-0/1048576 bytes allocated at offset 127 MiB
114
-110 MiB (0x6e00000) bytes allocated at offset 0 bytes (0x0)
115
-18 MiB (0x1200000) bytes not allocated at offset 110 MiB (0x6e00000)
116
-
117
== verify image content ==
118
read 1000/1000 bytes at offset 0
119
1000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
120
@@ -XXX,XX +XXX,XX @@ read 13631488/13631488 bytes at offset 67108864
121
13 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
122
read 30408704/30408704 bytes at offset 80740352
123
29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
124
-read 4194304/4194304 bytes at offset 111149056
125
-4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
126
-read 18874368/18874368 bytes at offset 115343360
127
-18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
128
-Offset Length File
129
-0 0x800000 TEST_DIR/t.IMGFMT
130
-0x900000 0x2400000 TEST_DIR/t.IMGFMT
131
-0x3c00000 0x1100000 TEST_DIR/t.IMGFMT
132
-0x6a00000 0x400000 TEST_DIR/t.IMGFMT
133
+read 23068672/23068672 bytes at offset 111149056
134
+22 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
135
No errors were found on the image.
136
*** done
137
diff --git a/tests/qemu-iotests/204 b/tests/qemu-iotests/204
138
new file mode 100755
139
index XXXXXXX..XXXXXXX
140
--- /dev/null
141
+++ b/tests/qemu-iotests/204
142
@@ -XXX,XX +XXX,XX @@
143
+#!/bin/bash
144
+#
145
+# Test corner cases with unusual block geometries
146
+#
147
+# Copyright (C) 2016-2018 Red Hat, Inc.
148
+#
149
+# This program is free software; you can redistribute it and/or modify
150
+# it under the terms of the GNU General Public License as published by
151
+# the Free Software Foundation; either version 2 of the License, or
152
+# (at your option) any later version.
153
+#
154
+# This program is distributed in the hope that it will be useful,
155
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
156
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
157
+# GNU General Public License for more details.
158
+#
159
+# You should have received a copy of the GNU General Public License
160
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
161
+#
162
+
163
+# creator
164
+owner=eblake@redhat.com
165
+
166
+seq=`basename $0`
167
+echo "QA output created by $seq"
168
+
169
+here=`pwd`
170
+status=1    # failure is the default!
171
+
172
+_cleanup()
173
+{
174
+    _cleanup_test_img
175
+}
176
+trap "_cleanup; exit \$status" 0 1 2 3 15
177
+
178
+# get standard environment, filters and checks
179
+. ./common.rc
180
+. ./common.filter
181
+
182
+_supported_fmt qcow2
183
+_supported_proto file
184
+# This test assumes that discard leaves zero clusters; see test 177 for
185
+# other tests that also work in older images
186
+_unsupported_imgopts 'compat=0.10'
187
+
188
+CLUSTER_SIZE=1M
189
+size=128M
190
+options=driver=blkdebug,image.driver=qcow2
191
+nested_opts=image.file.driver=file,image.file.filename=$TEST_IMG
192
+
193
+echo
194
+echo "== setting up files =="
195
+
196
+TEST_IMG="$TEST_IMG.base" _make_test_img $size
197
+$QEMU_IO -c "write -P 11 0 $size" "$TEST_IMG.base" | _filter_qemu_io
198
+_make_test_img -b "$TEST_IMG.base"
199
+$QEMU_IO -c "write -P 22 0 110M" "$TEST_IMG" | _filter_qemu_io
200
+
201
+# Limited to 64k max-transfer
202
+echo
203
+echo "== constrained alignment and max-transfer =="
204
+limits=align=4k,max-transfer=64k
205
+$QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
206
+ -c "write -P 33 1000 128k" -c "read -P 33 1000 128k" | _filter_qemu_io
207
+
208
+echo
209
+echo "== write zero with constrained max-transfer =="
210
+limits=align=512,max-transfer=64k,opt-write-zero=$CLUSTER_SIZE
211
+$QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
212
+ -c "write -z 8003584 2093056" | _filter_qemu_io
213
+
214
+# non-power-of-2 write-zero/discard alignments
215
+echo
216
+echo "== non-power-of-2 write zeroes limits =="
217
+
218
+limits=align=512,opt-write-zero=15M,max-write-zero=15M,opt-discard=15M,max-discard=15M
219
+$QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
220
+ -c "write -z 32M 32M" | _filter_qemu_io
221
+
222
+echo
223
+echo "== non-power-of-2 discard limits =="
224
+
225
+limits=align=512,opt-write-zero=15M,max-write-zero=15M,opt-discard=15M,max-discard=15M
226
+$QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
227
+ -c "discard 80000001 30M" | _filter_qemu_io
228
+
229
+echo
230
+echo "== block status smaller than alignment =="
231
+limits=align=4k
232
+$QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
233
+     -c "alloc 1 1" -c "alloc 0x6dffff0 1000" -c "alloc 127m 5P" \
234
+     -c map | _filter_qemu_io
235
+
236
+echo
237
+echo "== verify image content =="
238
+
239
+function verify_io()
240
+{
241
+ echo read -P 22 0 1000
242
+ echo read -P 33 1000 128k
243
+ echo read -P 22 132072 7871512
244
+ echo read -P 0 8003584 2093056
245
+ echo read -P 22 10096640 23457792
246
+ echo read -P 0 32M 32M
247
+ echo read -P 22 64M 13M
248
+ echo read -P 0 77M 29M
249
+ echo read -P 22 106M 4M
250
+ echo read -P 11 110M 18M
251
+}
252
+
253
+verify_io | $QEMU_IO -r "$TEST_IMG" | _filter_qemu_io
254
+$QEMU_IMG map --image-opts "$options,$nested_opts,align=4k" \
255
+ | _filter_qemu_img_map
256
+
257
+_check_test_img
258
+
259
+# success, all done
260
+echo "*** done"
261
+status=0
262
diff --git a/tests/qemu-iotests/204.out b/tests/qemu-iotests/204.out
263
new file mode 100644
264
index XXXXXXX..XXXXXXX
265
--- /dev/null
266
+++ b/tests/qemu-iotests/204.out
267
@@ -XXX,XX +XXX,XX @@
268
+QA output created by 204
269
+
270
+== setting up files ==
271
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728
272
+wrote 134217728/134217728 bytes at offset 0
273
+128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
274
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/t.IMGFMT.base
275
+wrote 115343360/115343360 bytes at offset 0
276
+110 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
277
+
278
+== constrained alignment and max-transfer ==
279
+wrote 131072/131072 bytes at offset 1000
280
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
281
+read 131072/131072 bytes at offset 1000
282
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
283
+
284
+== write zero with constrained max-transfer ==
285
+wrote 2093056/2093056 bytes at offset 8003584
286
+1.996 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
287
+
288
+== non-power-of-2 write zeroes limits ==
289
+wrote 33554432/33554432 bytes at offset 33554432
290
+32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
291
+
292
+== non-power-of-2 discard limits ==
293
+discard 31457280/31457280 bytes at offset 80000001
294
+30 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
295
+
296
+== block status smaller than alignment ==
297
+1/1 bytes allocated at offset 1 bytes
298
+16/1000 bytes allocated at offset 110 MiB
299
+0/1048576 bytes allocated at offset 127 MiB
300
+110 MiB (0x6e00000) bytes allocated at offset 0 bytes (0x0)
301
+18 MiB (0x1200000) bytes not allocated at offset 110 MiB (0x6e00000)
302
+
303
+== verify image content ==
304
+read 1000/1000 bytes at offset 0
305
+1000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
306
+read 131072/131072 bytes at offset 1000
307
+128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
308
+read 7871512/7871512 bytes at offset 132072
309
+7.507 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
310
+read 2093056/2093056 bytes at offset 8003584
311
+1.996 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
312
+read 23457792/23457792 bytes at offset 10096640
313
+22.371 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
314
+read 33554432/33554432 bytes at offset 33554432
315
+32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
316
+read 13631488/13631488 bytes at offset 67108864
317
+13 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
318
+read 30408704/30408704 bytes at offset 80740352
319
+29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
320
+read 4194304/4194304 bytes at offset 111149056
321
+4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
322
+read 18874368/18874368 bytes at offset 115343360
323
+18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
324
+Offset Length File
325
+0 0x800000 TEST_DIR/t.IMGFMT
326
+0x900000 0x2400000 TEST_DIR/t.IMGFMT
327
+0x3c00000 0x1100000 TEST_DIR/t.IMGFMT
328
+0x6a00000 0x400000 TEST_DIR/t.IMGFMT
329
+No errors were found on the image.
330
+*** done
331
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
332
index XXXXXXX..XXXXXXX 100644
333
--- a/tests/qemu-iotests/group
334
+++ b/tests/qemu-iotests/group
335
@@ -XXX,XX +XXX,XX @@
336
201 rw auto migration
337
202 rw auto quick
338
203 rw auto
339
+204 rw auto quick
340
--
74
--
341
2.13.6
75
2.35.3
342
343
diff view generated by jsdifflib
1
From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
1
From: Eric Blake <eblake@redhat.com>
2
2
3
This patch implements a test case for the scenario that was failing
3
According to the NBD spec, a server that advertises
4
prior to the patch "migration/ram.c: do not set 'postcopy_running' in
4
NBD_FLAG_CAN_MULTI_CONN promises that multiple client connections will
5
POSTCOPY_INCOMING_END", commit acab30b85d.
5
not see any cache inconsistencies: when properly separated by a single
6
6
flush, actions performed by one client will be visible to another
7
This new test file 201 was derived from the test file 181 authored
7
client, regardless of which client did the flush.
8
by Kevin Wolf.
8
9
9
We always satisfy these conditions in qemu - even when we support
10
CC: Kevin Wolf <kwolf@redhat.com>
10
multiple clients, ALL clients go through a single point of reference
11
CC: Max Reitz <mreitz@redhat.com>
11
into the block layer, with no local caching. The effect of one client
12
CC: Cleber Rosa <crosa@redhat.com>
12
is instantly visible to the next client. Even if our backend were a
13
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
13
network device, we argue that any multi-path caching effects that
14
would cause inconsistencies in back-to-back actions not seeing the
15
effect of previous actions would be a bug in that backend, and not the
16
fault of caching in qemu. As such, it is safe to unconditionally
17
advertise CAN_MULTI_CONN for any qemu NBD server situation that
18
supports parallel clients.
19
20
Note, however, that we don't want to advertise CAN_MULTI_CONN when we
21
know that a second client cannot connect (for historical reasons,
22
qemu-nbd defaults to a single connection while nbd-server-add and QMP
23
commands default to unlimited connections; but we already have
24
existing means to let either style of NBD server creation alter those
25
defaults). This is visible by no longer advertising MULTI_CONN for
26
'qemu-nbd -r' without -e, as in the iotest nbd-qemu-allocation.
27
28
The harder part of this patch is setting up an iotest to demonstrate
29
behavior of multiple NBD clients to a single server. It might be
30
possible with parallel qemu-io processes, but I found it easier to do
31
in python with the help of libnbd, and help from Nir and Vladimir in
32
writing the test.
33
34
Signed-off-by: Eric Blake <eblake@redhat.com>
35
Suggested-by: Nir Soffer <nsoffer@redhat.com>
36
Suggested-by: Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>
37
Message-Id: <20220512004924.417153-3-eblake@redhat.com>
14
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
38
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
15
---
39
---
16
tests/qemu-iotests/201 | 120 +++++++++++++++++++++++++++++++++++++++++++++
40
qapi/block-export.json | 8 +-
17
tests/qemu-iotests/201.out | 23 +++++++++
41
docs/interop/nbd.txt | 1 +
18
tests/qemu-iotests/group | 1 +
42
docs/tools/qemu-nbd.rst | 3 +-
19
3 files changed, 144 insertions(+)
43
include/block/nbd.h | 3 +-
20
create mode 100755 tests/qemu-iotests/201
44
blockdev-nbd.c | 5 +
21
create mode 100644 tests/qemu-iotests/201.out
45
nbd/server.c | 10 +-
22
46
MAINTAINERS | 1 +
23
diff --git a/tests/qemu-iotests/201 b/tests/qemu-iotests/201
47
tests/qemu-iotests/tests/nbd-multiconn | 145 ++++++++++++++++++
48
tests/qemu-iotests/tests/nbd-multiconn.out | 5 +
49
.../tests/nbd-qemu-allocation.out | 2 +-
50
10 files changed, 172 insertions(+), 11 deletions(-)
51
create mode 100755 tests/qemu-iotests/tests/nbd-multiconn
52
create mode 100644 tests/qemu-iotests/tests/nbd-multiconn.out
53
54
diff --git a/qapi/block-export.json b/qapi/block-export.json
55
index XXXXXXX..XXXXXXX 100644
56
--- a/qapi/block-export.json
57
+++ b/qapi/block-export.json
58
@@ -XXX,XX +XXX,XX @@
59
# recreated on the fly while the NBD server is active.
60
# If missing, it will default to denying access (since 4.0).
61
# @max-connections: The maximum number of connections to allow at the same
62
-# time, 0 for unlimited. (since 5.2; default: 0)
63
+# time, 0 for unlimited. Setting this to 1 also stops
64
+# the server from advertising multiple client support
65
+# (since 5.2; default: 0)
66
#
67
# Since: 4.2
68
##
69
@@ -XXX,XX +XXX,XX @@
70
# recreated on the fly while the NBD server is active.
71
# If missing, it will default to denying access (since 4.0).
72
# @max-connections: The maximum number of connections to allow at the same
73
-# time, 0 for unlimited. (since 5.2; default: 0)
74
+# time, 0 for unlimited. Setting this to 1 also stops
75
+# the server from advertising multiple client support
76
+# (since 5.2; default: 0).
77
#
78
# Returns: error if the server is already running.
79
#
80
diff --git a/docs/interop/nbd.txt b/docs/interop/nbd.txt
81
index XXXXXXX..XXXXXXX 100644
82
--- a/docs/interop/nbd.txt
83
+++ b/docs/interop/nbd.txt
84
@@ -XXX,XX +XXX,XX @@ NBD_CMD_BLOCK_STATUS for "qemu:dirty-bitmap:", NBD_CMD_CACHE
85
* 4.2: NBD_FLAG_CAN_MULTI_CONN for shareable read-only exports,
86
NBD_CMD_FLAG_FAST_ZERO
87
* 5.2: NBD_CMD_BLOCK_STATUS for "qemu:allocation-depth"
88
+* 7.1: NBD_FLAG_CAN_MULTI_CONN for shareable writable exports
89
diff --git a/docs/tools/qemu-nbd.rst b/docs/tools/qemu-nbd.rst
90
index XXXXXXX..XXXXXXX 100644
91
--- a/docs/tools/qemu-nbd.rst
92
+++ b/docs/tools/qemu-nbd.rst
93
@@ -XXX,XX +XXX,XX @@ driver options if :option:`--image-opts` is specified.
94
.. option:: -e, --shared=NUM
95
96
Allow up to *NUM* clients to share the device (default
97
- ``1``), 0 for unlimited. Safe for readers, but for now,
98
- consistency is not guaranteed between multiple writers.
99
+ ``1``), 0 for unlimited.
100
101
.. option:: -t, --persistent
102
103
diff --git a/include/block/nbd.h b/include/block/nbd.h
104
index XXXXXXX..XXXXXXX 100644
105
--- a/include/block/nbd.h
106
+++ b/include/block/nbd.h
107
@@ -XXX,XX +XXX,XX @@
108
/*
109
- * Copyright (C) 2016-2020 Red Hat, Inc.
110
+ * Copyright (C) 2016-2022 Red Hat, Inc.
111
* Copyright (C) 2005 Anthony Liguori <anthony@codemonkey.ws>
112
*
113
* Network Block Device
114
@@ -XXX,XX +XXX,XX @@ void nbd_client_put(NBDClient *client);
115
116
void nbd_server_is_qemu_nbd(int max_connections);
117
bool nbd_server_is_running(void);
118
+int nbd_server_max_connections(void);
119
void nbd_server_start(SocketAddress *addr, const char *tls_creds,
120
const char *tls_authz, uint32_t max_connections,
121
Error **errp);
122
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
123
index XXXXXXX..XXXXXXX 100644
124
--- a/blockdev-nbd.c
125
+++ b/blockdev-nbd.c
126
@@ -XXX,XX +XXX,XX @@ bool nbd_server_is_running(void)
127
return nbd_server || qemu_nbd_connections >= 0;
128
}
129
130
+int nbd_server_max_connections(void)
131
+{
132
+ return nbd_server ? nbd_server->max_connections : qemu_nbd_connections;
133
+}
134
+
135
static void nbd_blockdev_client_closed(NBDClient *client, bool ignored)
136
{
137
nbd_client_put(client);
138
diff --git a/nbd/server.c b/nbd/server.c
139
index XXXXXXX..XXXXXXX 100644
140
--- a/nbd/server.c
141
+++ b/nbd/server.c
142
@@ -XXX,XX +XXX,XX @@
143
/*
144
- * Copyright (C) 2016-2021 Red Hat, Inc.
145
+ * Copyright (C) 2016-2022 Red Hat, Inc.
146
* Copyright (C) 2005 Anthony Liguori <anthony@codemonkey.ws>
147
*
148
* Network Block Device Server Side
149
@@ -XXX,XX +XXX,XX @@ static int nbd_export_create(BlockExport *blk_exp, BlockExportOptions *exp_args,
150
int64_t size;
151
uint64_t perm, shared_perm;
152
bool readonly = !exp_args->writable;
153
- bool shared = !exp_args->writable;
154
BlockDirtyBitmapOrStrList *bitmaps;
155
size_t i;
156
int ret;
157
@@ -XXX,XX +XXX,XX @@ static int nbd_export_create(BlockExport *blk_exp, BlockExportOptions *exp_args,
158
exp->description = g_strdup(arg->description);
159
exp->nbdflags = (NBD_FLAG_HAS_FLAGS | NBD_FLAG_SEND_FLUSH |
160
NBD_FLAG_SEND_FUA | NBD_FLAG_SEND_CACHE);
161
+
162
+ if (nbd_server_max_connections() != 1) {
163
+ exp->nbdflags |= NBD_FLAG_CAN_MULTI_CONN;
164
+ }
165
if (readonly) {
166
exp->nbdflags |= NBD_FLAG_READ_ONLY;
167
- if (shared) {
168
- exp->nbdflags |= NBD_FLAG_CAN_MULTI_CONN;
169
- }
170
} else {
171
exp->nbdflags |= (NBD_FLAG_SEND_TRIM | NBD_FLAG_SEND_WRITE_ZEROES |
172
NBD_FLAG_SEND_FAST_ZERO);
173
diff --git a/MAINTAINERS b/MAINTAINERS
174
index XXXXXXX..XXXXXXX 100644
175
--- a/MAINTAINERS
176
+++ b/MAINTAINERS
177
@@ -XXX,XX +XXX,XX @@ F: qemu-nbd.*
178
F: blockdev-nbd.c
179
F: docs/interop/nbd.txt
180
F: docs/tools/qemu-nbd.rst
181
+F: tests/qemu-iotests/tests/*nbd*
182
T: git https://repo.or.cz/qemu/ericb.git nbd
183
T: git https://src.openvz.org/scm/~vsementsov/qemu.git nbd
184
185
diff --git a/tests/qemu-iotests/tests/nbd-multiconn b/tests/qemu-iotests/tests/nbd-multiconn
24
new file mode 100755
186
new file mode 100755
25
index XXXXXXX..XXXXXXX
187
index XXXXXXX..XXXXXXX
26
--- /dev/null
188
--- /dev/null
27
+++ b/tests/qemu-iotests/201
189
+++ b/tests/qemu-iotests/tests/nbd-multiconn
28
@@ -XXX,XX +XXX,XX @@
190
@@ -XXX,XX +XXX,XX @@
29
+#!/bin/bash
191
+#!/usr/bin/env python3
30
+#
192
+# group: rw auto quick
31
+# Test savevm and loadvm after live migration with postcopy flag
193
+#
32
+#
194
+# Test cases for NBD multi-conn advertisement
33
+# Copyright (C) 2017, IBM Corporation.
195
+#
34
+#
196
+# Copyright (C) 2022 Red Hat, Inc.
35
+# This file is derived from tests/qemu-iotests/181 by Kevin Wolf
36
+#
197
+#
37
+# This program is free software; you can redistribute it and/or modify
198
+# This program is free software; you can redistribute it and/or modify
38
+# it under the terms of the GNU General Public License as published by
199
+# it under the terms of the GNU General Public License as published by
39
+# the Free Software Foundation; either version 2 of the License, or
200
+# the Free Software Foundation; either version 2 of the License, or
40
+# (at your option) any later version.
201
+# (at your option) any later version.
...
...
45
+# GNU General Public License for more details.
206
+# GNU General Public License for more details.
46
+#
207
+#
47
+# You should have received a copy of the GNU General Public License
208
+# You should have received a copy of the GNU General Public License
48
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
209
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
49
+
210
+
50
+seq=`basename $0`
211
+import os
51
+echo "QA output created by $seq"
212
+from contextlib import contextmanager
52
+
213
+import iotests
53
+status=1    # failure is the default!
214
+from iotests import qemu_img_create, qemu_io
54
+
215
+
55
+MIG_SOCKET="${TEST_DIR}/migrate"
216
+
56
+
217
+disk = os.path.join(iotests.test_dir, 'disk')
57
+# get standard environment, filters and checks
218
+size = '4M'
58
+. ./common.rc
219
+nbd_sock = os.path.join(iotests.sock_dir, 'nbd_sock')
59
+. ./common.filter
220
+nbd_uri = 'nbd+unix:///{}?socket=' + nbd_sock
60
+. ./common.qemu
221
+
61
+
222
+
62
+_cleanup()
223
+@contextmanager
63
+{
224
+def open_nbd(export_name):
64
+ rm -f "${MIG_SOCKET}"
225
+ h = nbd.NBD()
65
+ _cleanup_test_img
226
+ try:
66
+ _cleanup_qemu
227
+ h.connect_uri(nbd_uri.format(export_name))
67
+}
228
+ yield h
68
+trap "_cleanup; exit \$status" 0 1 2 3 15
229
+ finally:
69
+
230
+ h.shutdown()
70
+_supported_fmt qcow2
231
+
71
+_supported_proto generic
232
+class TestNbdMulticonn(iotests.QMPTestCase):
72
+_supported_os Linux
233
+ def setUp(self):
73
+
234
+ qemu_img_create('-f', iotests.imgfmt, disk, size)
74
+# Internal snapshots are (currently) impossible with refcount_bits=1
235
+ qemu_io('-c', 'w -P 1 0 2M', '-c', 'w -P 2 2M 2M', disk)
75
+# This was taken from test 080
236
+
76
+_unsupported_imgopts 'refcount_bits=1[^0-9]'
237
+ self.vm = iotests.VM()
77
+
238
+ self.vm.launch()
78
+size=64M
239
+ result = self.vm.qmp('blockdev-add', {
79
+_make_test_img $size
240
+ 'driver': 'qcow2',
80
+
241
+ 'node-name': 'n',
81
+echo
242
+ 'file': {'driver': 'file', 'filename': disk}
82
+echo === Starting VMs ===
243
+ })
83
+echo
244
+ self.assert_qmp(result, 'return', {})
84
+
245
+
85
+qemu_comm_method="monitor"
246
+ def tearDown(self):
86
+
247
+ self.vm.shutdown()
87
+if [ "$IMGOPTSSYNTAX" = "true" ]; then
248
+ os.remove(disk)
88
+ _launch_qemu \
249
+ try:
89
+ -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk
250
+ os.remove(nbd_sock)
90
+else
251
+ except OSError:
91
+ _launch_qemu \
252
+ pass
92
+ -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk
253
+
93
+fi
254
+ @contextmanager
94
+src=$QEMU_HANDLE
255
+ def run_server(self, max_connections=None):
95
+
256
+ args = {
96
+if [ "$IMGOPTSSYNTAX" = "true" ]; then
257
+ 'addr': {
97
+ _launch_qemu \
258
+ 'type': 'unix',
98
+ -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \
259
+ 'data': {'path': nbd_sock}
99
+ -incoming "unix:${MIG_SOCKET}"
260
+ }
100
+else
261
+ }
101
+ _launch_qemu \
262
+ if max_connections is not None:
102
+ -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \
263
+ args['max-connections'] = max_connections
103
+ -incoming "unix:${MIG_SOCKET}"
264
+
104
+fi
265
+ result = self.vm.qmp('nbd-server-start', args)
105
+dest=$QEMU_HANDLE
266
+ self.assert_qmp(result, 'return', {})
106
+
267
+ yield
107
+echo
268
+
108
+echo === Set \'migrate_set_capability postcopy-ram on\' and migrate ===
269
+ result = self.vm.qmp('nbd-server-stop')
109
+echo
270
+ self.assert_qmp(result, 'return', {})
110
+
271
+
111
+silent=yes
272
+ def add_export(self, name, writable=None):
112
+_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)"
273
+ args = {
113
+_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)"
274
+ 'type': 'nbd',
114
+_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)"
275
+ 'id': name,
115
+
276
+ 'node-name': 'n',
116
+QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \
277
+ 'name': name,
117
+ _send_qemu_cmd $src "info migrate" "completed\|failed"
278
+ }
118
+silent=yes _send_qemu_cmd $src "" "(qemu)"
279
+ if writable is not None:
119
+
280
+ args['writable'] = writable
120
+echo
281
+
121
+echo === Check if migration was successful ===
282
+ result = self.vm.qmp('block-export-add', args)
122
+echo
283
+ self.assert_qmp(result, 'return', {})
123
+
284
+
124
+QEMU_COMM_TIMEOUT=1 silent=yes \
285
+ def test_default_settings(self):
125
+ _send_qemu_cmd $src "info migrate" "completed"
286
+ with self.run_server():
126
+silent=yes _send_qemu_cmd $src "" "(qemu)"
287
+ self.add_export('r')
127
+
288
+ self.add_export('w', writable=True)
128
+echo
289
+ with open_nbd('r') as h:
129
+echo === On destination, execute savevm and loadvm ===
290
+ self.assertTrue(h.can_multi_conn())
130
+echo
291
+ with open_nbd('w') as h:
131
+
292
+ self.assertTrue(h.can_multi_conn())
132
+silent=
293
+
133
+_send_qemu_cmd $dest 'savevm state1' "(qemu)"
294
+ def test_limited_connections(self):
134
+_send_qemu_cmd $dest 'loadvm state1' "(qemu)"
295
+ with self.run_server(max_connections=1):
135
+
296
+ self.add_export('r')
136
+echo
297
+ self.add_export('w', writable=True)
137
+echo === Shut down and check image ===
298
+ with open_nbd('r') as h:
138
+echo
299
+ self.assertFalse(h.can_multi_conn())
139
+
300
+ with open_nbd('w') as h:
140
+_send_qemu_cmd $src 'quit' ""
301
+ self.assertFalse(h.can_multi_conn())
141
+_send_qemu_cmd $dest 'quit' ""
302
+
142
+wait=1 _cleanup_qemu
303
+ def test_parallel_writes(self):
143
+
304
+ with self.run_server():
144
+_check_test_img
305
+ self.add_export('w', writable=True)
145
+
306
+
146
+# success, all done
307
+ clients = [nbd.NBD() for _ in range(3)]
147
+echo "*** done"
308
+ for c in clients:
148
+status=0
309
+ c.connect_uri(nbd_uri.format('w'))
149
diff --git a/tests/qemu-iotests/201.out b/tests/qemu-iotests/201.out
310
+ self.assertTrue(c.can_multi_conn())
311
+
312
+ initial_data = clients[0].pread(1024 * 1024, 0)
313
+ self.assertEqual(initial_data, b'\x01' * 1024 * 1024)
314
+
315
+ updated_data = b'\x03' * 1024 * 1024
316
+ clients[1].pwrite(updated_data, 0)
317
+ clients[2].flush()
318
+ current_data = clients[0].pread(1024 * 1024, 0)
319
+
320
+ self.assertEqual(updated_data, current_data)
321
+
322
+ for i in range(3):
323
+ clients[i].shutdown()
324
+
325
+
326
+if __name__ == '__main__':
327
+ try:
328
+ # Easier to use libnbd than to try and set up parallel
329
+ # 'qemu-nbd --list' or 'qemu-io' processes, but not all systems
330
+ # have libnbd installed.
331
+ import nbd # type: ignore
332
+
333
+ iotests.main(supported_fmts=['qcow2'])
334
+ except ImportError:
335
+ iotests.notrun('libnbd not installed')
336
diff --git a/tests/qemu-iotests/tests/nbd-multiconn.out b/tests/qemu-iotests/tests/nbd-multiconn.out
150
new file mode 100644
337
new file mode 100644
151
index XXXXXXX..XXXXXXX
338
index XXXXXXX..XXXXXXX
152
--- /dev/null
339
--- /dev/null
153
+++ b/tests/qemu-iotests/201.out
340
+++ b/tests/qemu-iotests/tests/nbd-multiconn.out
154
@@ -XXX,XX +XXX,XX @@
341
@@ -XXX,XX +XXX,XX @@
155
+QA output created by 201
342
+...
156
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
343
+----------------------------------------------------------------------
157
+
344
+Ran 3 tests
158
+=== Starting VMs ===
345
+
159
+
346
+OK
160
+
347
diff --git a/tests/qemu-iotests/tests/nbd-qemu-allocation.out b/tests/qemu-iotests/tests/nbd-qemu-allocation.out
161
+=== Set 'migrate_set_capability postcopy-ram on' and migrate ===
348
index XXXXXXX..XXXXXXX 100644
162
+
349
--- a/tests/qemu-iotests/tests/nbd-qemu-allocation.out
163
+
350
+++ b/tests/qemu-iotests/tests/nbd-qemu-allocation.out
164
+=== Check if migration was successful ===
351
@@ -XXX,XX +XXX,XX @@ wrote 2097152/2097152 bytes at offset 1048576
165
+
352
exports available: 1
166
+
353
export: ''
167
+=== On destination, execute savevm and loadvm ===
354
size: 4194304
168
+
355
- flags: 0x58f ( readonly flush fua df multi cache )
169
+(qemu) savevm state1
356
+ flags: 0x48f ( readonly flush fua df cache )
170
+(qemu) loadvm state1
357
min block: 1
171
+
358
opt block: 4096
172
+=== Shut down and check image ===
359
max block: 33554432
173
+
174
+(qemu) quit
175
+(qemu) quit
176
+No errors were found on the image.
177
+*** done
178
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
179
index XXXXXXX..XXXXXXX 100644
180
--- a/tests/qemu-iotests/group
181
+++ b/tests/qemu-iotests/group
182
@@ -XXX,XX +XXX,XX @@
183
197 rw auto quick
184
198 rw auto
185
200 rw auto
186
+201 rw auto migration
187
202 rw auto quick
188
203 rw auto
189
--
360
--
190
2.13.6
361
2.35.3
191
192
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
In some cases, these commands still use the deprecated @device
4
parameter. Fix that so we can later drop that parameter from their
5
interface.
6
7
Signed-off-by: Max Reitz <mreitz@redhat.com>
8
Message-id: 20171110224302.14424-2-mreitz@redhat.com
9
Reviewed-by: Alberto Garcia <berto@igalia.com>
10
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
---
12
tests/qemu-iotests/118 | 184 +++++++++++++++++++++++--------------------------
13
tests/qemu-iotests/155 | 60 ++++++++--------
14
2 files changed, 113 insertions(+), 131 deletions(-)
15
16
diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118
17
index XXXXXXX..XXXXXXX 100755
18
--- a/tests/qemu-iotests/118
19
+++ b/tests/qemu-iotests/118
20
@@ -XXX,XX +XXX,XX @@ from iotests import qemu_img
21
old_img = os.path.join(iotests.test_dir, 'test0.img')
22
new_img = os.path.join(iotests.test_dir, 'test1.img')
23
24
+def interface_to_device_name(interface):
25
+ if interface == 'ide':
26
+ return 'ide-cd'
27
+ elif interface == 'floppy':
28
+ return 'floppy'
29
+ else:
30
+ return None
31
+
32
class ChangeBaseClass(iotests.QMPTestCase):
33
has_opened = False
34
has_closed = False
35
@@ -XXX,XX +XXX,XX @@ class ChangeBaseClass(iotests.QMPTestCase):
36
37
class GeneralChangeTestsBaseClass(ChangeBaseClass):
38
39
- device_name = None
40
+ device_name = 'qdev0'
41
42
def test_change(self):
43
result = self.vm.qmp('change', device='drive0', target=new_img,
44
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
45
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
46
47
def test_blockdev_change_medium(self):
48
- if self.device_name is not None:
49
- result = self.vm.qmp('blockdev-change-medium',
50
- id=self.device_name, filename=new_img,
51
- format=iotests.imgfmt)
52
- else:
53
- result = self.vm.qmp('blockdev-change-medium',
54
- device='drive0', filename=new_img,
55
- format=iotests.imgfmt)
56
+ result = self.vm.qmp('blockdev-change-medium',
57
+ id=self.device_name, filename=new_img,
58
+ format=iotests.imgfmt)
59
60
self.assert_qmp(result, 'return', {})
61
62
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
63
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
64
65
def test_eject(self):
66
- if self.device_name is not None:
67
- result = self.vm.qmp('eject', id=self.device_name, force=True)
68
- else:
69
- result = self.vm.qmp('eject', device='drive0', force=True)
70
+ result = self.vm.qmp('eject', id=self.device_name, force=True)
71
self.assert_qmp(result, 'return', {})
72
73
self.wait_for_open()
74
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
75
self.assert_qmp_absent(result, 'return[0]/inserted')
76
77
def test_tray_eject_change(self):
78
- if self.device_name is not None:
79
- result = self.vm.qmp('eject', id=self.device_name, force=True)
80
- else:
81
- result = self.vm.qmp('eject', device='drive0', force=True)
82
+ result = self.vm.qmp('eject', id=self.device_name, force=True)
83
self.assert_qmp(result, 'return', {})
84
85
self.wait_for_open()
86
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
87
self.assert_qmp(result, 'return[0]/tray_open', True)
88
self.assert_qmp_absent(result, 'return[0]/inserted')
89
90
- if self.device_name is not None:
91
- result = self.vm.qmp('blockdev-change-medium', id=self.device_name,
92
- filename=new_img, format=iotests.imgfmt)
93
- else:
94
- result = self.vm.qmp('blockdev-change-medium', device='drive0',
95
- filename=new_img, format=iotests.imgfmt)
96
+ result = self.vm.qmp('blockdev-change-medium', id=self.device_name,
97
+ filename=new_img, format=iotests.imgfmt)
98
self.assert_qmp(result, 'return', {})
99
100
self.wait_for_close()
101
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
102
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
103
104
def test_tray_open_close(self):
105
- if self.device_name is not None:
106
- result = self.vm.qmp('blockdev-open-tray',
107
- id=self.device_name, force=True)
108
- else:
109
- result = self.vm.qmp('blockdev-open-tray',
110
- device='drive0', force=True)
111
+ result = self.vm.qmp('blockdev-open-tray',
112
+ id=self.device_name, force=True)
113
self.assert_qmp(result, 'return', {})
114
115
self.wait_for_open()
116
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
117
else:
118
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
119
120
- if self.device_name is not None:
121
- result = self.vm.qmp('blockdev-close-tray', id=self.device_name)
122
- else:
123
- result = self.vm.qmp('blockdev-close-tray', device='drive0')
124
+ result = self.vm.qmp('blockdev-close-tray', id=self.device_name)
125
self.assert_qmp(result, 'return', {})
126
127
if self.has_real_tray or not self.was_empty:
128
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
129
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
130
131
def test_tray_eject_close(self):
132
- result = self.vm.qmp('eject', device='drive0', force=True)
133
+ result = self.vm.qmp('eject', id=self.device_name, force=True)
134
self.assert_qmp(result, 'return', {})
135
136
self.wait_for_open()
137
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
138
self.assert_qmp(result, 'return[0]/tray_open', True)
139
self.assert_qmp_absent(result, 'return[0]/inserted')
140
141
- if self.device_name is not None:
142
- result = self.vm.qmp('blockdev-close-tray', id=self.device_name)
143
- else:
144
- result = self.vm.qmp('blockdev-close-tray', device='drive0')
145
+ result = self.vm.qmp('blockdev-close-tray', id=self.device_name)
146
self.assert_qmp(result, 'return', {})
147
148
self.wait_for_close()
149
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
150
self.assert_qmp_absent(result, 'return[0]/inserted')
151
152
def test_tray_open_change(self):
153
- result = self.vm.qmp('blockdev-open-tray', device='drive0', force=True)
154
+ result = self.vm.qmp('blockdev-open-tray', id=self.device_name,
155
+ force=True)
156
self.assert_qmp(result, 'return', {})
157
158
self.wait_for_open()
159
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
160
else:
161
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
162
163
- result = self.vm.qmp('blockdev-change-medium', device='drive0',
164
+ result = self.vm.qmp('blockdev-change-medium', id=self.device_name,
165
filename=new_img,
166
format=iotests.imgfmt)
167
self.assert_qmp(result, 'return', {})
168
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
169
'driver': 'file'})
170
self.assert_qmp(result, 'return', {})
171
172
- if self.device_name is not None:
173
- result = self.vm.qmp('blockdev-open-tray',
174
- id=self.device_name, force=True)
175
- else:
176
- result = self.vm.qmp('blockdev-open-tray',
177
- device='drive0', force=True)
178
+ result = self.vm.qmp('blockdev-open-tray',
179
+ id=self.device_name, force=True)
180
self.assert_qmp(result, 'return', {})
181
182
self.wait_for_open()
183
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
184
else:
185
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
186
187
- if self.device_name is not None:
188
- result = self.vm.qmp('x-blockdev-remove-medium',
189
- id=self.device_name)
190
- else:
191
- result = self.vm.qmp('x-blockdev-remove-medium', device='drive0')
192
+ result = self.vm.qmp('x-blockdev-remove-medium',
193
+ id=self.device_name)
194
self.assert_qmp(result, 'return', {})
195
196
result = self.vm.qmp('query-block')
197
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
198
self.assert_qmp(result, 'return[0]/tray_open', True)
199
self.assert_qmp_absent(result, 'return[0]/inserted')
200
201
- if self.device_name is not None:
202
- result = self.vm.qmp('x-blockdev-insert-medium',
203
- id=self.device_name, node_name='new')
204
- else:
205
- result = self.vm.qmp('x-blockdev-insert-medium',
206
- device='drive0', node_name='new')
207
+ result = self.vm.qmp('x-blockdev-insert-medium',
208
+ id=self.device_name, node_name='new')
209
self.assert_qmp(result, 'return', {})
210
211
result = self.vm.qmp('query-block')
212
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
213
self.assert_qmp(result, 'return[0]/tray_open', True)
214
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
215
216
- if self.device_name is not None:
217
- result = self.vm.qmp('blockdev-close-tray', id=self.device_name)
218
- else:
219
- result = self.vm.qmp('blockdev-close-tray', device='drive0')
220
+ result = self.vm.qmp('blockdev-close-tray', id=self.device_name)
221
self.assert_qmp(result, 'return', {})
222
223
self.wait_for_close()
224
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
225
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
226
227
def test_close_on_closed(self):
228
- result = self.vm.qmp('blockdev-close-tray', device='drive0')
229
+ result = self.vm.qmp('blockdev-close-tray', id=self.device_name)
230
# Should be a no-op
231
self.assert_qmp(result, 'return', {})
232
self.assertEquals(self.vm.get_qmp_events(wait=False), [])
233
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
234
if not self.has_real_tray:
235
return
236
237
- result = self.vm.qmp('x-blockdev-remove-medium', device='drive0')
238
+ result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
239
self.assert_qmp(result, 'error/class', 'GenericError')
240
241
def test_insert_on_closed(self):
242
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
243
'driver': 'file'})
244
self.assert_qmp(result, 'return', {})
245
246
- result = self.vm.qmp('x-blockdev-insert-medium', device='drive0',
247
+ result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
248
node_name='new')
249
self.assert_qmp(result, 'error/class', 'GenericError')
250
251
@@ -XXX,XX +XXX,XX @@ class TestInitiallyFilled(GeneralChangeTestsBaseClass):
252
qemu_img('create', '-f', iotests.imgfmt, old_img, '1440k')
253
qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k')
254
self.vm = iotests.VM()
255
- if interface == 'ide':
256
- self.device_name = 'qdev0'
257
- self.vm.add_drive(old_img, 'media=%s' % media, 'none')
258
- self.vm.add_device('ide-cd,drive=drive0,id=%s' % self.device_name)
259
- else:
260
- self.vm.add_drive(old_img, 'media=%s' % media, interface)
261
+ self.vm.add_drive(old_img, 'media=%s' % media, 'none')
262
+ self.vm.add_device('%s,drive=drive0,id=%s' %
263
+ (interface_to_device_name(interface),
264
+ self.device_name))
265
self.vm.launch()
266
267
def tearDown(self):
268
@@ -XXX,XX +XXX,XX @@ class TestInitiallyFilled(GeneralChangeTestsBaseClass):
269
'driver': 'file'})
270
self.assert_qmp(result, 'return', {})
271
272
- result = self.vm.qmp('blockdev-open-tray', device='drive0')
273
+ result = self.vm.qmp('blockdev-open-tray', id=self.device_name)
274
self.assert_qmp(result, 'return', {})
275
276
self.wait_for_open()
277
278
- result = self.vm.qmp('x-blockdev-insert-medium', device='drive0',
279
+ result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
280
node_name='new')
281
self.assert_qmp(result, 'error/class', 'GenericError')
282
283
@@ -XXX,XX +XXX,XX @@ class TestInitiallyEmpty(GeneralChangeTestsBaseClass):
284
285
def setUp(self, media, interface):
286
qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k')
287
- self.vm = iotests.VM().add_drive(None, 'media=%s' % media, interface)
288
+ self.vm = iotests.VM().add_drive(None, 'media=%s' % media, 'none')
289
+ self.vm.add_device('%s,drive=drive0,id=%s' %
290
+ (interface_to_device_name(interface),
291
+ self.device_name))
292
self.vm.launch()
293
294
def tearDown(self):
295
@@ -XXX,XX +XXX,XX @@ class TestInitiallyEmpty(GeneralChangeTestsBaseClass):
296
os.remove(new_img)
297
298
def test_remove_on_empty(self):
299
- result = self.vm.qmp('blockdev-open-tray', device='drive0')
300
+ result = self.vm.qmp('blockdev-open-tray', id=self.device_name)
301
self.assert_qmp(result, 'return', {})
302
303
self.wait_for_open()
304
305
- result = self.vm.qmp('x-blockdev-remove-medium', device='drive0')
306
+ result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
307
# Should be a no-op
308
self.assert_qmp(result, 'return', {})
309
310
@@ -XXX,XX +XXX,XX @@ class TestFloppyInitiallyEmpty(TestInitiallyEmpty):
311
self.has_opened = True
312
313
class TestChangeReadOnly(ChangeBaseClass):
314
+ device_name = 'qdev0'
315
+
316
def setUp(self):
317
qemu_img('create', '-f', iotests.imgfmt, old_img, '1440k')
318
qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k')
319
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
320
def test_ro_ro_retain(self):
321
os.chmod(old_img, 0444)
322
os.chmod(new_img, 0444)
323
- self.vm.add_drive(old_img, 'media=disk,read-only=on', 'floppy')
324
+ self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
325
+ self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
326
self.vm.launch()
327
328
result = self.vm.qmp('query-block')
329
self.assert_qmp(result, 'return[0]/inserted/ro', True)
330
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
331
332
- result = self.vm.qmp('blockdev-change-medium', device='drive0',
333
+ result = self.vm.qmp('blockdev-change-medium', id=self.device_name,
334
filename=new_img,
335
format=iotests.imgfmt,
336
read_only_mode='retain')
337
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
338
339
def test_ro_rw_retain(self):
340
os.chmod(old_img, 0444)
341
- self.vm.add_drive(old_img, 'media=disk,read-only=on', 'floppy')
342
+ self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
343
+ self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
344
self.vm.launch()
345
346
result = self.vm.qmp('query-block')
347
self.assert_qmp(result, 'return[0]/inserted/ro', True)
348
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
349
350
- result = self.vm.qmp('blockdev-change-medium', device='drive0',
351
+ result = self.vm.qmp('blockdev-change-medium', id=self.device_name,
352
filename=new_img,
353
format=iotests.imgfmt,
354
read_only_mode='retain')
355
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
356
357
def test_rw_ro_retain(self):
358
os.chmod(new_img, 0444)
359
- self.vm.add_drive(old_img, 'media=disk', 'floppy')
360
+ self.vm.add_drive(old_img, 'media=disk', 'none')
361
+ self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
362
self.vm.launch()
363
364
result = self.vm.qmp('query-block')
365
self.assert_qmp(result, 'return[0]/inserted/ro', False)
366
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
367
368
- result = self.vm.qmp('blockdev-change-medium', device='drive0',
369
+ result = self.vm.qmp('blockdev-change-medium', id=self.device_name,
370
filename=new_img,
371
format=iotests.imgfmt,
372
read_only_mode='retain')
373
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
374
375
def test_ro_rw(self):
376
os.chmod(old_img, 0444)
377
- self.vm.add_drive(old_img, 'media=disk,read-only=on', 'floppy')
378
+ self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
379
+ self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
380
self.vm.launch()
381
382
result = self.vm.qmp('query-block')
383
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
384
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
385
386
result = self.vm.qmp('blockdev-change-medium',
387
- device='drive0',
388
+ id=self.device_name,
389
filename=new_img,
390
format=iotests.imgfmt,
391
read_only_mode='read-write')
392
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
393
394
def test_rw_ro(self):
395
os.chmod(new_img, 0444)
396
- self.vm.add_drive(old_img, 'media=disk', 'floppy')
397
+ self.vm.add_drive(old_img, 'media=disk', 'none')
398
+ self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
399
self.vm.launch()
400
401
result = self.vm.qmp('query-block')
402
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
403
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
404
405
result = self.vm.qmp('blockdev-change-medium',
406
- device='drive0',
407
+ id=self.device_name,
408
filename=new_img,
409
format=iotests.imgfmt,
410
read_only_mode='read-only')
411
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
412
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
413
414
def test_make_rw_ro(self):
415
- self.vm.add_drive(old_img, 'media=disk', 'floppy')
416
+ self.vm.add_drive(old_img, 'media=disk', 'none')
417
+ self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
418
self.vm.launch()
419
420
result = self.vm.qmp('query-block')
421
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
422
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
423
424
result = self.vm.qmp('blockdev-change-medium',
425
- device='drive0',
426
+ id=self.device_name,
427
filename=new_img,
428
format=iotests.imgfmt,
429
read_only_mode='read-only')
430
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
431
432
def test_make_ro_rw(self):
433
os.chmod(new_img, 0444)
434
- self.vm.add_drive(old_img, 'media=disk', 'floppy')
435
+ self.vm.add_drive(old_img, 'media=disk', 'none')
436
+ self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
437
self.vm.launch()
438
439
result = self.vm.qmp('query-block')
440
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
441
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
442
443
result = self.vm.qmp('blockdev-change-medium',
444
- device='drive0',
445
+ id=self.device_name,
446
filename=new_img,
447
format=iotests.imgfmt,
448
read_only_mode='read-write')
449
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
450
451
def test_make_rw_ro_by_retain(self):
452
os.chmod(old_img, 0444)
453
- self.vm.add_drive(old_img, 'media=disk,read-only=on', 'floppy')
454
+ self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
455
+ self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
456
self.vm.launch()
457
458
result = self.vm.qmp('query-block')
459
self.assert_qmp(result, 'return[0]/inserted/ro', True)
460
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
461
462
- result = self.vm.qmp('blockdev-change-medium', device='drive0',
463
+ result = self.vm.qmp('blockdev-change-medium', id=self.device_name,
464
filename=new_img,
465
format=iotests.imgfmt,
466
read_only_mode='retain')
467
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
468
469
def test_make_ro_rw_by_retain(self):
470
os.chmod(new_img, 0444)
471
- self.vm.add_drive(old_img, 'media=disk', 'floppy')
472
+ self.vm.add_drive(old_img, 'media=disk', 'none')
473
+ self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
474
self.vm.launch()
475
476
result = self.vm.qmp('query-block')
477
self.assert_qmp(result, 'return[0]/inserted/ro', False)
478
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
479
480
- result = self.vm.qmp('blockdev-change-medium', device='drive0',
481
+ result = self.vm.qmp('blockdev-change-medium', id=self.device_name,
482
filename=new_img,
483
format=iotests.imgfmt,
484
read_only_mode='retain')
485
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
486
487
def test_rw_ro_cycle(self):
488
os.chmod(new_img, 0444)
489
- self.vm.add_drive(old_img, 'media=disk', 'floppy')
490
+ self.vm.add_drive(old_img, 'media=disk', 'none')
491
+ self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
492
self.vm.launch()
493
494
result = self.vm.qmp('query-block')
495
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
496
self.assert_qmp(result, 'return[0]/inserted/ro', False)
497
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
498
499
- result = self.vm.qmp('x-blockdev-remove-medium', device='drive0')
500
+ result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
501
self.assert_qmp(result, 'return', {})
502
503
result = self.vm.qmp('query-block')
504
self.assert_qmp_absent(result, 'return[0]/inserted')
505
506
- result = self.vm.qmp('x-blockdev-insert-medium', device='drive0',
507
+ result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
508
node_name='new')
509
self.assert_qmp(result, 'return', {})
510
511
@@ -XXX,XX +XXX,XX @@ TestInitiallyEmpty = None
512
513
514
class TestBlockJobsAfterCycle(ChangeBaseClass):
515
+ device_name = 'qdev0'
516
+
517
def setUp(self):
518
- qemu_img('create', '-f', iotests.imgfmt, old_img, '1M')
519
+ qemu_img('create', '-f', iotests.imgfmt, old_img, '1440K')
520
521
self.vm = iotests.VM()
522
self.vm.add_drive_raw("id=drive0,driver=null-co,if=none")
523
+ self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
524
self.vm.launch()
525
526
result = self.vm.qmp('query-block')
527
@@ -XXX,XX +XXX,XX @@ class TestBlockJobsAfterCycle(ChangeBaseClass):
528
529
# For device-less BBs, calling blockdev-open-tray or blockdev-close-tray
530
# is not necessary
531
- result = self.vm.qmp('x-blockdev-remove-medium', device='drive0')
532
+ result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
533
self.assert_qmp(result, 'return', {})
534
535
result = self.vm.qmp('query-block')
536
@@ -XXX,XX +XXX,XX @@ class TestBlockJobsAfterCycle(ChangeBaseClass):
537
'driver': 'file'})
538
self.assert_qmp(result, 'return', {})
539
540
- result = self.vm.qmp('x-blockdev-insert-medium', device='drive0',
541
+ result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
542
node_name='node0')
543
self.assert_qmp(result, 'return', {})
544
545
diff --git a/tests/qemu-iotests/155 b/tests/qemu-iotests/155
546
index XXXXXXX..XXXXXXX 100755
547
--- a/tests/qemu-iotests/155
548
+++ b/tests/qemu-iotests/155
549
@@ -XXX,XX +XXX,XX @@ class BaseClass(iotests.QMPTestCase):
550
target_real_backing = None
551
552
def setUp(self):
553
- qemu_img('create', '-f', iotests.imgfmt, back0_img, '1M')
554
+ qemu_img('create', '-f', iotests.imgfmt, back0_img, '1440K')
555
qemu_img('create', '-f', iotests.imgfmt, '-b', back0_img, back1_img)
556
qemu_img('create', '-f', iotests.imgfmt, '-b', back1_img, back2_img)
557
qemu_img('create', '-f', iotests.imgfmt, '-b', back2_img, source_img)
558
559
self.vm = iotests.VM()
560
- self.vm.add_drive(None, '', 'none')
561
- self.vm.launch()
562
-
563
# Add the BDS via blockdev-add so it stays around after the mirror block
564
# job has been completed
565
- result = self.vm.qmp('blockdev-add',
566
- node_name='source',
567
- driver=iotests.imgfmt,
568
- file={'driver': 'file',
569
- 'filename': source_img})
570
- self.assert_qmp(result, 'return', {})
571
-
572
- result = self.vm.qmp('x-blockdev-insert-medium',
573
- device='drive0', node_name='source')
574
- self.assert_qmp(result, 'return', {})
575
+ blockdev = {'node-name': 'source',
576
+ 'driver': iotests.imgfmt,
577
+ 'file': {'driver': 'file',
578
+ 'filename': source_img}}
579
+ self.vm.add_blockdev(self.qmp_to_opts(blockdev))
580
+ self.vm.add_device('floppy,id=qdev0,drive=source')
581
+ self.vm.launch()
582
583
self.assertIntactSourceBackingChain()
584
585
if self.existing:
586
if self.target_backing:
587
qemu_img('create', '-f', iotests.imgfmt,
588
- '-b', self.target_backing, target_img, '1M')
589
+ '-b', self.target_backing, target_img, '1440K')
590
else:
591
- qemu_img('create', '-f', iotests.imgfmt, target_img, '1M')
592
+ qemu_img('create', '-f', iotests.imgfmt, target_img, '1440K')
593
594
if self.cmd == 'blockdev-mirror':
595
options = { 'node-name': 'target',
596
@@ -XXX,XX +XXX,XX @@ class BaseClass(iotests.QMPTestCase):
597
except OSError:
598
pass
599
600
- def findBlockNode(self, node_name, id=None):
601
- if id:
602
+ def findBlockNode(self, node_name, qdev=None):
603
+ if qdev:
604
result = self.vm.qmp('query-block')
605
for device in result['return']:
606
- if device['device'] == id:
607
+ if device['qdev'] == qdev:
608
if node_name:
609
self.assert_qmp(device, 'inserted/node-name', node_name)
610
return device['inserted']
611
@@ -XXX,XX +XXX,XX @@ class BaseClass(iotests.QMPTestCase):
612
if node['node-name'] == node_name:
613
return node
614
615
- self.fail('Cannot find node %s/%s' % (id, node_name))
616
+ self.fail('Cannot find node %s/%s' % (qdev, node_name))
617
618
def assertIntactSourceBackingChain(self):
619
node = self.findBlockNode('source')
620
@@ -XXX,XX +XXX,XX @@ class BaseClass(iotests.QMPTestCase):
621
class MirrorBaseClass(BaseClass):
622
def runMirror(self, sync):
623
if self.cmd == 'blockdev-mirror':
624
- result = self.vm.qmp(self.cmd, device='drive0', sync=sync,
625
- target='target')
626
+ result = self.vm.qmp(self.cmd, job_id='mirror-job', device='source',
627
+ sync=sync, target='target')
628
else:
629
if self.existing:
630
mode = 'existing'
631
else:
632
mode = 'absolute-paths'
633
- result = self.vm.qmp(self.cmd, device='drive0', sync=sync,
634
- target=target_img, format=iotests.imgfmt,
635
- mode=mode, node_name='target')
636
+ result = self.vm.qmp(self.cmd, job_id='mirror-job', device='source',
637
+ sync=sync, target=target_img,
638
+ format=iotests.imgfmt, mode=mode,
639
+ node_name='target')
640
641
self.assert_qmp(result, 'return', {})
642
643
self.vm.event_wait('BLOCK_JOB_READY')
644
645
- result = self.vm.qmp('block-job-complete', device='drive0')
646
+ result = self.vm.qmp('block-job-complete', device='mirror-job')
647
self.assert_qmp(result, 'return', {})
648
649
self.vm.event_wait('BLOCK_JOB_COMPLETED')
650
@@ -XXX,XX +XXX,XX @@ class MirrorBaseClass(BaseClass):
651
def testFull(self):
652
self.runMirror('full')
653
654
- node = self.findBlockNode('target', 'drive0')
655
+ node = self.findBlockNode('target', 'qdev0')
656
self.assertCorrectBackingImage(node, None)
657
self.assertIntactSourceBackingChain()
658
659
def testTop(self):
660
self.runMirror('top')
661
662
- node = self.findBlockNode('target', 'drive0')
663
+ node = self.findBlockNode('target', 'qdev0')
664
self.assertCorrectBackingImage(node, back2_img)
665
self.assertIntactSourceBackingChain()
666
667
def testNone(self):
668
self.runMirror('none')
669
670
- node = self.findBlockNode('target', 'drive0')
671
+ node = self.findBlockNode('target', 'qdev0')
672
self.assertCorrectBackingImage(node, source_img)
673
self.assertIntactSourceBackingChain()
674
675
@@ -XXX,XX +XXX,XX @@ class TestCommit(BaseClass):
676
existing = False
677
678
def testCommit(self):
679
- result = self.vm.qmp('block-commit', device='drive0', base=back1_img)
680
+ result = self.vm.qmp('block-commit', job_id='commit-job',
681
+ device='source', base=back1_img)
682
self.assert_qmp(result, 'return', {})
683
684
self.vm.event_wait('BLOCK_JOB_READY')
685
686
- result = self.vm.qmp('block-job-complete', device='drive0')
687
+ result = self.vm.qmp('block-job-complete', device='commit-job')
688
self.assert_qmp(result, 'return', {})
689
690
self.vm.event_wait('BLOCK_JOB_COMPLETED')
691
692
- node = self.findBlockNode(None, 'drive0')
693
+ node = self.findBlockNode(None, 'qdev0')
694
self.assert_qmp(node, 'image' + '/backing-image' * 0 + '/filename',
695
back1_img)
696
self.assert_qmp(node, 'image' + '/backing-image' * 1 + '/filename',
697
--
698
2.13.6
699
700
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
Currently, the tray and medium commands in the AHCI test use the
4
deprecated @device parameter. This patch switches all invocations over
5
to use @id.
6
7
Signed-off-by: Max Reitz <mreitz@redhat.com>
8
Message-id: 20171110224302.14424-3-mreitz@redhat.com
9
Reviewed-by: Alberto Garcia <berto@igalia.com>
10
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
---
12
tests/ahci-test.c | 12 ++++++------
13
1 file changed, 6 insertions(+), 6 deletions(-)
14
15
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/tests/ahci-test.c
18
+++ b/tests/ahci-test.c
19
@@ -XXX,XX +XXX,XX @@ static void test_atapi_tray(void)
20
QDict *rsp;
21
22
fd = prepare_iso(iso_size, &tx, &iso);
23
- ahci = ahci_boot_and_enable("-drive if=none,id=drive0,file=%s,format=raw "
24
+ ahci = ahci_boot_and_enable("-blockdev node-name=drive0,driver=file,filename=%s "
25
"-M q35 "
26
- "-device ide-cd,drive=drive0 ", iso);
27
+ "-device ide-cd,id=cd0,drive=drive0 ", iso);
28
port = ahci_port_select(ahci);
29
30
ahci_atapi_eject(ahci, port);
31
@@ -XXX,XX +XXX,XX @@ static void test_atapi_tray(void)
32
33
/* Remove media */
34
qmp_async("{'execute': 'blockdev-open-tray', "
35
- "'arguments': {'device': 'drive0'}}");
36
+ "'arguments': {'id': 'cd0'}}");
37
atapi_wait_tray(true);
38
rsp = qmp_receive();
39
QDECREF(rsp);
40
41
qmp_discard_response("{'execute': 'x-blockdev-remove-medium', "
42
- "'arguments': {'device': 'drive0'}}");
43
+ "'arguments': {'id': 'cd0'}}");
44
45
/* Test the tray without a medium */
46
ahci_atapi_load(ahci, port);
47
@@ -XXX,XX +XXX,XX @@ static void test_atapi_tray(void)
48
"'file': { 'driver': 'file', "
49
"'filename': %s }}}", iso);
50
qmp_discard_response("{'execute': 'x-blockdev-insert-medium',"
51
- "'arguments': { 'device': 'drive0', "
52
+ "'arguments': { 'id': 'cd0', "
53
"'node-name': 'node0' }}");
54
55
/* Again, the event shows up first */
56
qmp_async("{'execute': 'blockdev-close-tray', "
57
- "'arguments': {'device': 'drive0'}}");
58
+ "'arguments': {'id': 'cd0'}}");
59
atapi_wait_tray(false);
60
rsp = qmp_receive();
61
QDECREF(rsp);
62
--
63
2.13.6
64
65
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
Now that iotest 093 test proves that the throttling configuration
4
survives a blockdev-remove-medium/blockdev-insert-medium pair, the
5
original reason for declaring these commands experimental is gone
6
(see commit 6e0abc251dd4f8eba1f53656dfede12e5840e83b).
7
8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9
Message-id: 20171110224302.14424-5-mreitz@redhat.com
10
Reviewed-by: Alberto Garcia <berto@igalia.com>
11
Signed-off-by: Max Reitz <mreitz@redhat.com>
12
---
13
qapi/block-core.json | 32 +++++++++++++-------------------
14
blockdev.c | 6 +++---
15
tests/ahci-test.c | 4 ++--
16
tests/qemu-iotests/093 | 6 +++---
17
tests/qemu-iotests/118 | 20 ++++++++++----------
18
tests/qemu-iotests/139 | 2 +-
19
6 files changed, 32 insertions(+), 38 deletions(-)
20
21
diff --git a/qapi/block-core.json b/qapi/block-core.json
22
index XXXXXXX..XXXXXXX 100644
23
--- a/qapi/block-core.json
24
+++ b/qapi/block-core.json
25
@@ -XXX,XX +XXX,XX @@
26
'*id': 'str' } }
27
28
##
29
-# @x-blockdev-remove-medium:
30
+# @blockdev-remove-medium:
31
#
32
# Removes a medium (a block driver state tree) from a block device. That block
33
# device's tray must currently be open (unless there is no attached guest
34
@@ -XXX,XX +XXX,XX @@
35
#
36
# If the tray is open and there is no medium inserted, this will be a no-op.
37
#
38
-# @id: The name or QOM path of the guest device (since: 2.8)
39
-#
40
-# Note: This command is still a work in progress and is considered experimental.
41
-# Stay away from it unless you want to help with its development.
42
+# @id: The name or QOM path of the guest device
43
#
44
-# Since: 2.5
45
+# Since: 2.12
46
#
47
# Example:
48
#
49
-# -> { "execute": "x-blockdev-remove-medium",
50
+# -> { "execute": "blockdev-remove-medium",
51
# "arguments": { "id": "ide0-1-0" } }
52
#
53
# <- { "error": { "class": "GenericError",
54
@@ -XXX,XX +XXX,XX @@
55
#
56
# <- { "return": {} }
57
#
58
-# -> { "execute": "x-blockdev-remove-medium",
59
+# -> { "execute": "blockdev-remove-medium",
60
# "arguments": { "id": "ide0-1-0" } }
61
#
62
# <- { "return": {} }
63
#
64
##
65
-{ 'command': 'x-blockdev-remove-medium',
66
+{ 'command': 'blockdev-remove-medium',
67
'data': { 'id': 'str' } }
68
69
##
70
-# @x-blockdev-insert-medium:
71
+# @blockdev-insert-medium:
72
#
73
# Inserts a medium (a block driver state tree) into a block device. That block
74
# device's tray must currently be open (unless there is no attached guest
75
# device) and there must be no medium inserted already.
76
#
77
-# @id: The name or QOM path of the guest device (since: 2.8)
78
+# @id: The name or QOM path of the guest device
79
#
80
# @node-name: name of a node in the block driver state graph
81
#
82
-# Note: This command is still a work in progress and is considered experimental.
83
-# Stay away from it unless you want to help with its development.
84
-#
85
-# Since: 2.5
86
+# Since: 2.12
87
#
88
# Example:
89
#
90
@@ -XXX,XX +XXX,XX @@
91
# "filename": "fedora.iso" } } }
92
# <- { "return": {} }
93
#
94
-# -> { "execute": "x-blockdev-insert-medium",
95
+# -> { "execute": "blockdev-insert-medium",
96
# "arguments": { "id": "ide0-1-0",
97
# "node-name": "node0" } }
98
#
99
# <- { "return": {} }
100
#
101
##
102
-{ 'command': 'x-blockdev-insert-medium',
103
+{ 'command': 'blockdev-insert-medium',
104
'data': { 'id': 'str',
105
'node-name': 'str'} }
106
107
@@ -XXX,XX +XXX,XX @@
108
#
109
# Changes the medium inserted into a block device by ejecting the current medium
110
# and loading a new image file which is inserted as the new medium (this command
111
-# combines blockdev-open-tray, x-blockdev-remove-medium,
112
-# x-blockdev-insert-medium and blockdev-close-tray).
113
+# combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
114
+# and blockdev-close-tray).
115
#
116
# @device: Block device name (deprecated, use @id instead)
117
#
118
diff --git a/blockdev.c b/blockdev.c
119
index XXXXXXX..XXXXXXX 100644
120
--- a/blockdev.c
121
+++ b/blockdev.c
122
@@ -XXX,XX +XXX,XX @@ out:
123
aio_context_release(aio_context);
124
}
125
126
-void qmp_x_blockdev_remove_medium(const char *id, Error **errp)
127
+void qmp_blockdev_remove_medium(const char *id, Error **errp)
128
{
129
blockdev_remove_medium(false, NULL, true, id, errp);
130
}
131
@@ -XXX,XX +XXX,XX @@ static void blockdev_insert_medium(bool has_device, const char *device,
132
qmp_blockdev_insert_anon_medium(blk, bs, errp);
133
}
134
135
-void qmp_x_blockdev_insert_medium(const char *id, const char *node_name,
136
- Error **errp)
137
+void qmp_blockdev_insert_medium(const char *id, const char *node_name,
138
+ Error **errp)
139
{
140
blockdev_insert_medium(false, NULL, true, id, node_name, errp);
141
}
142
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
143
index XXXXXXX..XXXXXXX 100644
144
--- a/tests/ahci-test.c
145
+++ b/tests/ahci-test.c
146
@@ -XXX,XX +XXX,XX @@ static void test_atapi_tray(void)
147
rsp = qmp_receive();
148
QDECREF(rsp);
149
150
- qmp_discard_response("{'execute': 'x-blockdev-remove-medium', "
151
+ qmp_discard_response("{'execute': 'blockdev-remove-medium', "
152
"'arguments': {'id': 'cd0'}}");
153
154
/* Test the tray without a medium */
155
@@ -XXX,XX +XXX,XX @@ static void test_atapi_tray(void)
156
"'driver': 'raw', "
157
"'file': { 'driver': 'file', "
158
"'filename': %s }}}", iso);
159
- qmp_discard_response("{'execute': 'x-blockdev-insert-medium',"
160
+ qmp_discard_response("{'execute': 'blockdev-insert-medium',"
161
"'arguments': { 'id': 'cd0', "
162
"'node-name': 'node0' }}");
163
164
diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093
165
index XXXXXXX..XXXXXXX 100755
166
--- a/tests/qemu-iotests/093
167
+++ b/tests/qemu-iotests/093
168
@@ -XXX,XX +XXX,XX @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase):
169
# Now eject cd0 and insert cd1
170
result = self.vm.qmp("blockdev-open-tray", id='dev0')
171
self.assert_qmp(result, 'return', {})
172
- result = self.vm.qmp("x-blockdev-remove-medium", id='dev0')
173
+ result = self.vm.qmp("blockdev-remove-medium", id='dev0')
174
self.assert_qmp(result, 'return', {})
175
- result = self.vm.qmp("x-blockdev-insert-medium", id='dev0', node_name='cd1')
176
+ result = self.vm.qmp("blockdev-insert-medium", id='dev0', node_name='cd1')
177
self.assert_qmp(result, 'return', {})
178
179
# Check that the I/O limits are still the same
180
@@ -XXX,XX +XXX,XX @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase):
181
self.assert_qmp(result, 'return[0]/inserted/bps', 50)
182
183
# Eject cd1
184
- result = self.vm.qmp("x-blockdev-remove-medium", id='dev0')
185
+ result = self.vm.qmp("blockdev-remove-medium", id='dev0')
186
self.assert_qmp(result, 'return', {})
187
188
# Check that we can't set limits if the device has no medium
189
diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118
190
index XXXXXXX..XXXXXXX 100755
191
--- a/tests/qemu-iotests/118
192
+++ b/tests/qemu-iotests/118
193
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
194
else:
195
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
196
197
- result = self.vm.qmp('x-blockdev-remove-medium',
198
+ result = self.vm.qmp('blockdev-remove-medium',
199
id=self.device_name)
200
self.assert_qmp(result, 'return', {})
201
202
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
203
self.assert_qmp(result, 'return[0]/tray_open', True)
204
self.assert_qmp_absent(result, 'return[0]/inserted')
205
206
- result = self.vm.qmp('x-blockdev-insert-medium',
207
+ result = self.vm.qmp('blockdev-insert-medium',
208
id=self.device_name, node_name='new')
209
self.assert_qmp(result, 'return', {})
210
211
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
212
if not self.has_real_tray:
213
return
214
215
- result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
216
+ result = self.vm.qmp('blockdev-remove-medium', id=self.device_name)
217
self.assert_qmp(result, 'error/class', 'GenericError')
218
219
def test_insert_on_closed(self):
220
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
221
'driver': 'file'})
222
self.assert_qmp(result, 'return', {})
223
224
- result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
225
+ result = self.vm.qmp('blockdev-insert-medium', id=self.device_name,
226
node_name='new')
227
self.assert_qmp(result, 'error/class', 'GenericError')
228
229
@@ -XXX,XX +XXX,XX @@ class TestInitiallyFilled(GeneralChangeTestsBaseClass):
230
231
self.wait_for_open()
232
233
- result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
234
+ result = self.vm.qmp('blockdev-insert-medium', id=self.device_name,
235
node_name='new')
236
self.assert_qmp(result, 'error/class', 'GenericError')
237
238
@@ -XXX,XX +XXX,XX @@ class TestInitiallyEmpty(GeneralChangeTestsBaseClass):
239
240
self.wait_for_open()
241
242
- result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
243
+ result = self.vm.qmp('blockdev-remove-medium', id=self.device_name)
244
# Should be a no-op
245
self.assert_qmp(result, 'return', {})
246
247
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
248
self.assert_qmp(result, 'return[0]/inserted/ro', False)
249
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
250
251
- result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
252
+ result = self.vm.qmp('blockdev-remove-medium', id=self.device_name)
253
self.assert_qmp(result, 'return', {})
254
255
result = self.vm.qmp('query-block')
256
self.assert_qmp_absent(result, 'return[0]/inserted')
257
258
- result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
259
+ result = self.vm.qmp('blockdev-insert-medium', id=self.device_name,
260
node_name='new')
261
self.assert_qmp(result, 'return', {})
262
263
@@ -XXX,XX +XXX,XX @@ class TestBlockJobsAfterCycle(ChangeBaseClass):
264
265
# For device-less BBs, calling blockdev-open-tray or blockdev-close-tray
266
# is not necessary
267
- result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
268
+ result = self.vm.qmp('blockdev-remove-medium', id=self.device_name)
269
self.assert_qmp(result, 'return', {})
270
271
result = self.vm.qmp('query-block')
272
@@ -XXX,XX +XXX,XX @@ class TestBlockJobsAfterCycle(ChangeBaseClass):
273
'driver': 'file'})
274
self.assert_qmp(result, 'return', {})
275
276
- result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
277
+ result = self.vm.qmp('blockdev-insert-medium', id=self.device_name,
278
node_name='node0')
279
self.assert_qmp(result, 'return', {})
280
281
diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139
282
index XXXXXXX..XXXXXXX 100644
283
--- a/tests/qemu-iotests/139
284
+++ b/tests/qemu-iotests/139
285
@@ -XXX,XX +XXX,XX @@ class TestBlockdevDel(iotests.QMPTestCase):
286
# Insert a BlockDriverState
287
def insertDrive(self, device, node):
288
self.checkBlockDriverState(node)
289
- result = self.vm.qmp('x-blockdev-insert-medium',
290
+ result = self.vm.qmp('blockdev-insert-medium',
291
id = device, node_name = node)
292
self.assert_qmp(result, 'return', {})
293
self.checkBlockDriverState(node)
294
--
295
2.13.6
296
297
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
102 truncates a qcow2 file (the raw file) on purpose while a VM is
4
running. However, image locking will usually prevent exactly this.
5
6
The fact that most people have not noticed until now (I suppose you may
7
have seen sporadic failures, but not taken them too seriously, like me)
8
further shows that this truncation is actually not really done
9
concurrently, but that the VM is still starting up by this point and has
10
not yet opened the image. Remedy this by waiting for the monitor shell
11
to appear before the qemu-img invocation so we know the VM is up.
12
13
Signed-off-by: Max Reitz <mreitz@redhat.com>
14
Message-id: 20171129185102.29390-1-mreitz@redhat.com
15
Reviewed-by: Eric Blake <eblake@redhat.com>
16
Signed-off-by: Max Reitz <mreitz@redhat.com>
17
---
18
tests/qemu-iotests/102 | 7 ++++++-
19
tests/qemu-iotests/102.out | 3 ++-
20
2 files changed, 8 insertions(+), 2 deletions(-)
21
22
diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102
23
index XXXXXXX..XXXXXXX 100755
24
--- a/tests/qemu-iotests/102
25
+++ b/tests/qemu-iotests/102
26
@@ -XXX,XX +XXX,XX @@ $QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io
27
28
qemu_comm_method=monitor _launch_qemu -drive if=none,file="$TEST_IMG",id=drv0
29
30
-$QEMU_IMG resize -f raw --shrink "$TEST_IMG" $((5 * 64 * 1024))
31
+# Wait for a prompt to appear (so we know qemu has opened the image)
32
+_send_qemu_cmd '' '(qemu)'
33
+
34
+$QEMU_IMG resize --shrink --image-opts \
35
+ "driver=raw,file.driver=file,file.filename=$TEST_IMG,file.locking=off" \
36
+ $((5 * 64 * 1024))
37
38
_send_qemu_cmd $QEMU_HANDLE 'qemu-io drv0 map' 'allocated' \
39
| sed -e 's/^(qemu).*qemu-io drv0 map...$/(qemu) qemu-io drv0 map/'
40
diff --git a/tests/qemu-iotests/102.out b/tests/qemu-iotests/102.out
41
index XXXXXXX..XXXXXXX 100644
42
--- a/tests/qemu-iotests/102.out
43
+++ b/tests/qemu-iotests/102.out
44
@@ -XXX,XX +XXX,XX @@ Offset Length Mapped to File
45
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536
46
wrote 65536/65536 bytes at offset 0
47
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
48
-Image resized.
49
QEMU X.Y.Z monitor - type 'help' for more information
50
+Image resized.
51
+(qemu)
52
(qemu) qemu-io drv0 map
53
64 KiB (0x10000) bytes allocated at offset 0 bytes (0x0)
54
*** done
55
--
56
2.13.6
57
58
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
Signed-off-by: Max Reitz <mreitz@redhat.com>
4
Message-id: 20171123020832.8165-2-mreitz@redhat.com
5
Reviewed-by: Eric Blake <eblake@redhat.com>
6
Reviewed-by: Fam Zheng <famz@redhat.com>
7
Signed-off-by: Max Reitz <mreitz@redhat.com>
8
---
9
block/vmdk.c | 2 +-
10
1 file changed, 1 insertion(+), 1 deletion(-)
11
12
diff --git a/block/vmdk.c b/block/vmdk.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/block/vmdk.c
15
+++ b/block/vmdk.c
16
@@ -XXX,XX +XXX,XX @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset,
17
qemu_iovec_concat(&local_qiov, qiov, qiov_offset, n_bytes);
18
}
19
20
- write_offset = cluster_offset + offset_in_cluster,
21
+ write_offset = cluster_offset + offset_in_cluster;
22
ret = bdrv_co_pwritev(extent->file, write_offset, n_bytes,
23
&local_qiov, 0);
24
25
--
26
2.13.6
27
28
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
Persistent dirty bitmaps require a properly functioning
4
autoclear_features field, or we cannot track when an unsupporting
5
program might overwrite them. Therefore, we cannot support them for
6
compat=0.10 images.
7
8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9
Message-id: 20171123020832.8165-3-mreitz@redhat.com
10
Reviewed-by: Eric Blake <eblake@redhat.com>
11
Signed-off-by: Max Reitz <mreitz@redhat.com>
12
---
13
block/qcow2-bitmap.c | 10 ++++++++++
14
block/qcow2.c | 14 +++++++++++---
15
2 files changed, 21 insertions(+), 3 deletions(-)
16
17
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/block/qcow2-bitmap.c
20
+++ b/block/qcow2-bitmap.c
21
@@ -XXX,XX +XXX,XX @@ bool qcow2_can_store_new_dirty_bitmap(BlockDriverState *bs,
22
bool found;
23
Qcow2BitmapList *bm_list;
24
25
+ if (s->qcow_version < 3) {
26
+ /* Without autoclear_features, we would always have to assume
27
+ * that a program without persistent dirty bitmap support has
28
+ * accessed this qcow2 file when opening it, and would thus
29
+ * have to drop all dirty bitmaps (defeating their purpose).
30
+ */
31
+ error_setg(errp, "Cannot store dirty bitmaps in qcow2 v2 files");
32
+ goto fail;
33
+ }
34
+
35
if (check_constraints_on_bitmap(bs, name, granularity, errp) != 0) {
36
goto fail;
37
}
38
diff --git a/block/qcow2.c b/block/qcow2.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/block/qcow2.c
41
+++ b/block/qcow2.c
42
@@ -XXX,XX +XXX,XX @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
43
}
44
45
if (!(s->autoclear_features & QCOW2_AUTOCLEAR_BITMAPS)) {
46
- warn_report("a program lacking bitmap support "
47
- "modified this file, so all bitmaps are now "
48
- "considered inconsistent");
49
+ if (s->qcow_version < 3) {
50
+ /* Let's be a bit more specific */
51
+ warn_report("This qcow2 v2 image contains bitmaps, but "
52
+ "they may have been modified by a program "
53
+ "without persistent bitmap support; so now "
54
+ "they must all be considered inconsistent");
55
+ } else {
56
+ warn_report("a program lacking bitmap support "
57
+ "modified this file, so all bitmaps are now "
58
+ "considered inconsistent");
59
+ }
60
error_printf("Some clusters may be leaked, "
61
"run 'qemu-img check -r' on the image "
62
"file to fix.");
63
--
64
2.13.6
65
66
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
This is not necessarily complete, but it should include the most
4
important places.
5
6
Signed-off-by: Max Reitz <mreitz@redhat.com>
7
Message-id: 20171123020832.8165-4-mreitz@redhat.com
8
Reviewed-by: Eric Blake <eblake@redhat.com>
9
Signed-off-by: Max Reitz <mreitz@redhat.com>
10
---
11
block/qcow.c | 16 ++++++++++++++++
12
1 file changed, 16 insertions(+)
13
14
diff --git a/block/qcow.c b/block/qcow.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/block/qcow.c
17
+++ b/block/qcow.c
18
@@ -XXX,XX +XXX,XX @@ static int get_cluster_offset(BlockDriverState *bs,
19
/* update the L1 entry */
20
s->l1_table[l1_index] = l2_offset;
21
tmp = cpu_to_be64(l2_offset);
22
+ BLKDBG_EVENT(bs->file, BLKDBG_L1_UPDATE);
23
ret = bdrv_pwrite_sync(bs->file,
24
s->l1_table_offset + l1_index * sizeof(tmp),
25
&tmp, sizeof(tmp));
26
@@ -XXX,XX +XXX,XX @@ static int get_cluster_offset(BlockDriverState *bs,
27
}
28
}
29
l2_table = s->l2_cache + (min_index << s->l2_bits);
30
+ BLKDBG_EVENT(bs->file, BLKDBG_L2_LOAD);
31
if (new_l2_table) {
32
memset(l2_table, 0, s->l2_size * sizeof(uint64_t));
33
ret = bdrv_pwrite_sync(bs->file, l2_offset, l2_table,
34
@@ -XXX,XX +XXX,XX @@ static int get_cluster_offset(BlockDriverState *bs,
35
((cluster_offset & QCOW_OFLAG_COMPRESSED) && allocate == 1)) {
36
if (!allocate)
37
return 0;
38
+ BLKDBG_EVENT(bs->file, BLKDBG_CLUSTER_ALLOC);
39
/* allocate a new cluster */
40
if ((cluster_offset & QCOW_OFLAG_COMPRESSED) &&
41
(n_end - n_start) < s->cluster_sectors) {
42
@@ -XXX,XX +XXX,XX @@ static int get_cluster_offset(BlockDriverState *bs,
43
}
44
cluster_offset = QEMU_ALIGN_UP(cluster_offset, s->cluster_size);
45
/* write the cluster content */
46
+ BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO);
47
ret = bdrv_pwrite(bs->file, cluster_offset, s->cluster_cache,
48
s->cluster_size);
49
if (ret < 0) {
50
@@ -XXX,XX +XXX,XX @@ static int get_cluster_offset(BlockDriverState *bs,
51
NULL) < 0) {
52
return -EIO;
53
}
54
+ BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO);
55
ret = bdrv_pwrite(bs->file,
56
cluster_offset + i * 512,
57
s->cluster_data, 512);
58
@@ -XXX,XX +XXX,XX @@ static int get_cluster_offset(BlockDriverState *bs,
59
/* update L2 table */
60
tmp = cpu_to_be64(cluster_offset);
61
l2_table[l2_index] = tmp;
62
+ if (allocate == 2) {
63
+ BLKDBG_EVENT(bs->file, BLKDBG_L2_UPDATE_COMPRESSED);
64
+ } else {
65
+ BLKDBG_EVENT(bs->file, BLKDBG_L2_UPDATE);
66
+ }
67
ret = bdrv_pwrite_sync(bs->file, l2_offset + l2_index * sizeof(tmp),
68
&tmp, sizeof(tmp));
69
if (ret < 0) {
70
@@ -XXX,XX +XXX,XX @@ static int decompress_cluster(BlockDriverState *bs, uint64_t cluster_offset)
71
if (s->cluster_cache_offset != coffset) {
72
csize = cluster_offset >> (63 - s->cluster_bits);
73
csize &= (s->cluster_size - 1);
74
+ BLKDBG_EVENT(bs->file, BLKDBG_READ_COMPRESSED);
75
ret = bdrv_pread(bs->file, coffset, s->cluster_data, csize);
76
if (ret != csize)
77
return -1;
78
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_readv(BlockDriverState *bs, int64_t sector_num,
79
hd_iov.iov_len = n * 512;
80
qemu_iovec_init_external(&hd_qiov, &hd_iov, 1);
81
qemu_co_mutex_unlock(&s->lock);
82
+ /* qcow2 emits this on bs->file instead of bs->backing */
83
+ BLKDBG_EVENT(bs->file, BLKDBG_READ_BACKING_AIO);
84
ret = bdrv_co_readv(bs->backing, sector_num, n, &hd_qiov);
85
qemu_co_mutex_lock(&s->lock);
86
if (ret < 0) {
87
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_readv(BlockDriverState *bs, int64_t sector_num,
88
hd_iov.iov_len = n * 512;
89
qemu_iovec_init_external(&hd_qiov, &hd_iov, 1);
90
qemu_co_mutex_unlock(&s->lock);
91
+ BLKDBG_EVENT(bs->file, BLKDBG_READ_AIO);
92
ret = bdrv_co_readv(bs->file,
93
(cluster_offset >> 9) + index_in_cluster,
94
n, &hd_qiov);
95
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int qcow_co_writev(BlockDriverState *bs, int64_t sector_num,
96
hd_iov.iov_len = n * 512;
97
qemu_iovec_init_external(&hd_qiov, &hd_iov, 1);
98
qemu_co_mutex_unlock(&s->lock);
99
+ BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO);
100
ret = bdrv_co_writev(bs->file,
101
(cluster_offset >> 9) + index_in_cluster,
102
n, &hd_qiov);
103
@@ -XXX,XX +XXX,XX @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset,
104
.iov_len = out_len,
105
};
106
qemu_iovec_init_external(&hd_qiov, &iov, 1);
107
+ BLKDBG_EVENT(bs->file, BLKDBG_WRITE_COMPRESSED);
108
ret = bdrv_co_pwritev(bs->file, cluster_offset, out_len, &hd_qiov, 0);
109
if (ret < 0) {
110
goto fail;
111
--
112
2.13.6
113
114
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
This is certainly not complete, but it includes at least write_aio and
4
read_aio.
5
6
Signed-off-by: Max Reitz <mreitz@redhat.com>
7
Message-id: 20171123020832.8165-5-mreitz@redhat.com
8
Reviewed-by: Fam Zheng <famz@redhat.com>
9
Signed-off-by: Max Reitz <mreitz@redhat.com>
10
---
11
block/vmdk.c | 16 ++++++++++++++++
12
1 file changed, 16 insertions(+)
13
14
diff --git a/block/vmdk.c b/block/vmdk.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/block/vmdk.c
17
+++ b/block/vmdk.c
18
@@ -XXX,XX +XXX,XX @@ static int get_whole_cluster(BlockDriverState *bs,
19
/* Read backing data before skip range */
20
if (skip_start_bytes > 0) {
21
if (bs->backing) {
22
+ /* qcow2 emits this on bs->file instead of bs->backing */
23
+ BLKDBG_EVENT(extent->file, BLKDBG_COW_READ);
24
ret = bdrv_pread(bs->backing, offset, whole_grain,
25
skip_start_bytes);
26
if (ret < 0) {
27
@@ -XXX,XX +XXX,XX @@ static int get_whole_cluster(BlockDriverState *bs,
28
goto exit;
29
}
30
}
31
+ BLKDBG_EVENT(extent->file, BLKDBG_COW_WRITE);
32
ret = bdrv_pwrite(extent->file, cluster_offset, whole_grain,
33
skip_start_bytes);
34
if (ret < 0) {
35
@@ -XXX,XX +XXX,XX @@ static int get_whole_cluster(BlockDriverState *bs,
36
/* Read backing data after skip range */
37
if (skip_end_bytes < cluster_bytes) {
38
if (bs->backing) {
39
+ /* qcow2 emits this on bs->file instead of bs->backing */
40
+ BLKDBG_EVENT(extent->file, BLKDBG_COW_READ);
41
ret = bdrv_pread(bs->backing, offset + skip_end_bytes,
42
whole_grain + skip_end_bytes,
43
cluster_bytes - skip_end_bytes);
44
@@ -XXX,XX +XXX,XX @@ static int get_whole_cluster(BlockDriverState *bs,
45
goto exit;
46
}
47
}
48
+ BLKDBG_EVENT(extent->file, BLKDBG_COW_WRITE);
49
ret = bdrv_pwrite(extent->file, cluster_offset + skip_end_bytes,
50
whole_grain + skip_end_bytes,
51
cluster_bytes - skip_end_bytes);
52
@@ -XXX,XX +XXX,XX @@ static int vmdk_L2update(VmdkExtent *extent, VmdkMetaData *m_data,
53
{
54
offset = cpu_to_le32(offset);
55
/* update L2 table */
56
+ BLKDBG_EVENT(extent->file, BLKDBG_L2_UPDATE);
57
if (bdrv_pwrite_sync(extent->file,
58
((int64_t)m_data->l2_offset * 512)
59
+ (m_data->l2_index * sizeof(offset)),
60
@@ -XXX,XX +XXX,XX @@ static int get_cluster_offset(BlockDriverState *bs,
61
}
62
}
63
l2_table = extent->l2_cache + (min_index * extent->l2_size);
64
+ BLKDBG_EVENT(extent->file, BLKDBG_L2_LOAD);
65
if (bdrv_pread(extent->file,
66
(int64_t)l2_offset * 512,
67
l2_table,
68
@@ -XXX,XX +XXX,XX @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset,
69
.iov_len = n_bytes,
70
};
71
qemu_iovec_init_external(&local_qiov, &iov, 1);
72
+
73
+ BLKDBG_EVENT(extent->file, BLKDBG_WRITE_COMPRESSED);
74
} else {
75
qemu_iovec_init(&local_qiov, qiov->niov);
76
qemu_iovec_concat(&local_qiov, qiov, qiov_offset, n_bytes);
77
+
78
+ BLKDBG_EVENT(extent->file, BLKDBG_WRITE_AIO);
79
}
80
81
write_offset = cluster_offset + offset_in_cluster;
82
@@ -XXX,XX +XXX,XX @@ static int vmdk_read_extent(VmdkExtent *extent, int64_t cluster_offset,
83
84
85
if (!extent->compressed) {
86
+ BLKDBG_EVENT(extent->file, BLKDBG_READ_AIO);
87
ret = bdrv_co_preadv(extent->file,
88
cluster_offset + offset_in_cluster, bytes,
89
qiov, 0);
90
@@ -XXX,XX +XXX,XX @@ static int vmdk_read_extent(VmdkExtent *extent, int64_t cluster_offset,
91
buf_bytes = cluster_bytes * 2;
92
cluster_buf = g_malloc(buf_bytes);
93
uncomp_buf = g_malloc(cluster_bytes);
94
+ BLKDBG_EVENT(extent->file, BLKDBG_READ_COMPRESSED);
95
ret = bdrv_pread(extent->file,
96
cluster_offset,
97
cluster_buf, buf_bytes);
98
@@ -XXX,XX +XXX,XX @@ vmdk_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
99
qemu_iovec_reset(&local_qiov);
100
qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes);
101
102
+ /* qcow2 emits this on bs->file instead of bs->backing */
103
+ BLKDBG_EVENT(bs->file, BLKDBG_READ_BACKING_AIO);
104
ret = bdrv_co_preadv(bs->backing, offset, n_bytes,
105
&local_qiov, 0);
106
if (ret < 0) {
107
--
108
2.13.6
109
110
diff view generated by jsdifflib
1
From: Max Reitz <mreitz@redhat.com>
1
From: Paolo Bonzini <pbonzini@redhat.com>
2
2
3
read without -r eats backslashes.
3
common.rc has some complicated logic to find the common.config that
4
dates back to xfstests and is completely unnecessary now. Just include
5
the contents of the file.
4
6
5
Signed-off-by: Max Reitz <mreitz@redhat.com>
7
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6
Message-id: 20171123020832.8165-6-mreitz@redhat.com
8
Message-Id: <20220505094723.732116-1-pbonzini@redhat.com>
7
Reviewed-by: Fam Zheng <famz@redhat.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9
---
10
---
10
tests/qemu-iotests/common.rc | 2 +-
11
tests/qemu-iotests/common.config | 41 --------------------------------
11
1 file changed, 1 insertion(+), 1 deletion(-)
12
tests/qemu-iotests/common.rc | 31 ++++++++++++++----------
13
2 files changed, 19 insertions(+), 53 deletions(-)
14
delete mode 100644 tests/qemu-iotests/common.config
12
15
16
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
17
deleted file mode 100644
18
index XXXXXXX..XXXXXXX
19
--- a/tests/qemu-iotests/common.config
20
+++ /dev/null
21
@@ -XXX,XX +XXX,XX @@
22
-#!/usr/bin/env bash
23
-#
24
-# Copyright (C) 2009 Red Hat, Inc.
25
-# Copyright (c) 2000-2003,2006 Silicon Graphics, Inc. All Rights Reserved.
26
-#
27
-# This program is free software; you can redistribute it and/or
28
-# modify it under the terms of the GNU General Public License as
29
-# published by the Free Software Foundation.
30
-#
31
-# This program is distributed in the hope that it would be useful,
32
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
33
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34
-# GNU General Public License for more details.
35
-#
36
-# You should have received a copy of the GNU General Public License
37
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
38
-#
39
-# all tests should use a common language setting to prevent golden
40
-# output mismatches.
41
-export LANG=C
42
-
43
-PATH=".:$PATH"
44
-
45
-HOSTOS=$(uname -s)
46
-arch=$(uname -m)
47
-[[ "$arch" =~ "ppc64" ]] && qemu_arch=ppc64 || qemu_arch="$arch"
48
-
49
-# make sure we have a standard umask
50
-umask 022
51
-
52
-_optstr_add()
53
-{
54
- if [ -n "$1" ]; then
55
- echo "$1,$2"
56
- else
57
- echo "$2"
58
- fi
59
-}
60
-
61
-# make sure this script returns success
62
-true
13
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
63
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
14
index XXXXXXX..XXXXXXX 100644
64
index XXXXXXX..XXXXXXX 100644
15
--- a/tests/qemu-iotests/common.rc
65
--- a/tests/qemu-iotests/common.rc
16
+++ b/tests/qemu-iotests/common.rc
66
+++ b/tests/qemu-iotests/common.rc
17
@@ -XXX,XX +XXX,XX @@ _img_info()
67
@@ -XXX,XX +XXX,XX @@
18
-e "s#$IMGFMT#IMGFMT#g" \
68
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
-e "/^disk size:/ D" \
69
#
20
-e "/actual-size/ D" | \
70
21
- while IFS='' read line; do
71
+export LANG=C
22
+ while IFS='' read -r line; do
72
+
23
if [[ $format_specific == 1 ]]; then
73
+PATH=".:$PATH"
24
discard=0
74
+
25
elif [[ $line == "Format specific information:" ]]; then
75
+HOSTOS=$(uname -s)
76
+arch=$(uname -m)
77
+[[ "$arch" =~ "ppc64" ]] && qemu_arch=ppc64 || qemu_arch="$arch"
78
+
79
+# make sure we have a standard umask
80
+umask 022
81
+
82
# bail out, setting up .notrun file
83
_notrun()
84
{
85
@@ -XXX,XX +XXX,XX @@ peek_file_raw()
86
dd if="$1" bs=1 skip="$2" count="$3" status=none
87
}
88
89
-config=common.config
90
-test -f $config || config=../common.config
91
-if ! test -f $config
92
-then
93
- echo "$0: failed to find common.config"
94
- exit 1
95
-fi
96
-if ! . $config
97
- then
98
- echo "$0: failed to source common.config"
99
- exit 1
100
-fi
101
+_optstr_add()
102
+{
103
+ if [ -n "$1" ]; then
104
+ echo "$1,$2"
105
+ else
106
+ echo "$2"
107
+ fi
108
+}
109
110
# Set the variables to the empty string to turn Valgrind off
111
# for specific processes, e.g.
26
--
112
--
27
2.13.6
113
2.35.3
28
29
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
_filter_img_info should remove format-specific information, too. We
4
already have such a filter in _img_info, and it is very useful for
5
query-block-named-block-nodes (etc.), too.
6
7
However, in 198 we need that information (but we still want the rest of
8
the filter), so make that filtering optional. Note that "the rest of
9
the filter" includes filtering of the test directory, so we can drop the
10
_filter_testdir from 198 at the same time.
11
12
Signed-off-by: Max Reitz <mreitz@redhat.com>
13
Message-id: 20171123020832.8165-7-mreitz@redhat.com
14
Reviewed-by: Eric Blake <eblake@redhat.com>
15
Reviewed-by: Fam Zheng <famz@redhat.com>
16
Signed-off-by: Max Reitz <mreitz@redhat.com>
17
---
18
tests/qemu-iotests/198 | 6 ++++--
19
tests/qemu-iotests/common.filter | 29 ++++++++++++++++++++++++++++-
20
2 files changed, 32 insertions(+), 3 deletions(-)
21
22
diff --git a/tests/qemu-iotests/198 b/tests/qemu-iotests/198
23
index XXXXXXX..XXXXXXX 100755
24
--- a/tests/qemu-iotests/198
25
+++ b/tests/qemu-iotests/198
26
@@ -XXX,XX +XXX,XX @@ $QEMU_IO --object $SECRET0 --object $SECRET1 -c "read -P 0x9 0 $size" --image-op
27
28
echo
29
echo "== checking image base =="
30
-$QEMU_IMG info --image-opts $IMGSPECBASE | _filter_img_info | _filter_testdir | sed -e "/^disk size:/ D"
31
+$QEMU_IMG info --image-opts $IMGSPECBASE | _filter_img_info --format-specific \
32
+ | sed -e "/^disk size:/ D"
33
34
echo
35
echo "== checking image layer =="
36
-$QEMU_IMG info --image-opts $IMGSPECLAYER | _filter_img_info | _filter_testdir | sed -e "/^disk size:/ D"
37
+$QEMU_IMG info --image-opts $IMGSPECLAYER | _filter_img_info --format-specific \
38
+ | sed -e "/^disk size:/ D"
39
40
41
# success, all done
42
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
43
index XXXXXXX..XXXXXXX 100644
44
--- a/tests/qemu-iotests/common.filter
45
+++ b/tests/qemu-iotests/common.filter
46
@@ -XXX,XX +XXX,XX @@ _filter_img_create()
47
48
_filter_img_info()
49
{
50
+ if [[ "$1" == "--format-specific" ]]; then
51
+ local format_specific=1
52
+ shift
53
+ else
54
+ local format_specific=0
55
+ fi
56
+
57
+ discard=0
58
+ regex_json_spec_start='^ *"format-specific": \{'
59
sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
60
-e "s#$TEST_DIR#TEST_DIR#g" \
61
-e "s#$IMGFMT#IMGFMT#g" \
62
@@ -XXX,XX +XXX,XX @@ _filter_img_info()
63
-e "/block_state_zero: \\(on\\|off\\)/d" \
64
-e "/log_size: [0-9]\\+/d" \
65
-e "s/iters: [0-9]\\+/iters: 1024/" \
66
- -e "s/uuid: [-a-f0-9]\\+/uuid: 00000000-0000-0000-0000-000000000000/"
67
+ -e "s/uuid: [-a-f0-9]\\+/uuid: 00000000-0000-0000-0000-000000000000/" | \
68
+ while IFS='' read -r line; do
69
+ if [[ $format_specific == 1 ]]; then
70
+ discard=0
71
+ elif [[ $line == "Format specific information:" ]]; then
72
+ discard=1
73
+ elif [[ $line =~ $regex_json_spec_start ]]; then
74
+ discard=2
75
+ regex_json_spec_end="^${line%%[^ ]*}\\},? *$"
76
+ fi
77
+ if [[ $discard == 0 ]]; then
78
+ echo "$line"
79
+ elif [[ $discard == 1 && ! $line ]]; then
80
+ echo
81
+ discard=0
82
+ elif [[ $discard == 2 && $line =~ $regex_json_spec_end ]]; then
83
+ discard=0
84
+ fi
85
+ done
86
}
87
88
# filter out offsets and file names from qemu-img map; good for both
89
--
90
2.13.6
91
92
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
This test does funny things like TEST_IMG="TEST_IMG.base" _make_test_img
4
that usually only work with the file protocol. More specifically, they
5
do not work with the most interesting non-file protocols, so we might as
6
well skip this for anything but file.
7
8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9
Message-id: 20171123020832.8165-8-mreitz@redhat.com
10
Reviewed-by: Fam Zheng <famz@redhat.com>
11
Signed-off-by: Max Reitz <mreitz@redhat.com>
12
---
13
tests/qemu-iotests/020 | 8 +-------
14
1 file changed, 1 insertion(+), 7 deletions(-)
15
16
diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
17
index XXXXXXX..XXXXXXX 100755
18
--- a/tests/qemu-iotests/020
19
+++ b/tests/qemu-iotests/020
20
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
21
22
# Any format supporting backing files
23
_supported_fmt qcow qcow2 vmdk qed
24
-_supported_proto generic
25
-_unsupported_proto vxhs
26
+_supported_proto file
27
_supported_os Linux
28
_unsupported_imgopts "subformat=monolithicFlat" \
29
"subformat=twoGbMaxExtentFlat" \
30
"subformat=twoGbMaxExtentSparse"
31
32
-# NFS does not support bdrv_reopen_prepare thus qemu-img commit fails.
33
-if [ "$IMGPROTO" = "nfs" ]; then
34
- _notrun "image protocol $IMGPROTO does not support bdrv_commit"
35
-fi
36
-
37
TEST_OFFSETS="0 4294967296"
38
39
TEST_IMG_SAVE="$TEST_IMG"
40
--
41
2.13.6
42
43
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
Signed-off-by: Max Reitz <mreitz@redhat.com>
4
Message-id: 20171123020832.8165-9-mreitz@redhat.com
5
Reviewed-by: John Snow <jsnow@redhat.com>
6
Signed-off-by: Max Reitz <mreitz@redhat.com>
7
---
8
tests/qemu-iotests/103 | 2 ++
9
1 file changed, 2 insertions(+)
10
11
diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103
12
index XXXXXXX..XXXXXXX 100755
13
--- a/tests/qemu-iotests/103
14
+++ b/tests/qemu-iotests/103
15
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
16
_supported_fmt qcow2
17
_supported_proto file nfs
18
_supported_os Linux
19
+# Internal snapshots are (currently) impossible with refcount_bits=1
20
+_unsupported_imgopts 'refcount_bits=1[^0-9]'
21
22
IMG_SIZE=64K
23
24
--
25
2.13.6
26
27
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
vmdk cannot work with anything but vmdk backing files, so make the
4
backing file be the same format as the overlay.
5
6
Reported-by: John Snow <jsnow@redhat.com>
7
Signed-off-by: Max Reitz <mreitz@redhat.com>
8
Message-id: 20171123020832.8165-11-mreitz@redhat.com
9
Reviewed-by: John Snow <jsnow@redhat.com>
10
Reviewed-by: Fam Zheng <famz@redhat.com>
11
Signed-off-by: Max Reitz <mreitz@redhat.com>
12
---
13
tests/qemu-iotests/020 | 9 ++++++---
14
tests/qemu-iotests/020.out | 6 ++++--
15
2 files changed, 10 insertions(+), 5 deletions(-)
16
17
diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
18
index XXXXXXX..XXXXXXX 100755
19
--- a/tests/qemu-iotests/020
20
+++ b/tests/qemu-iotests/020
21
@@ -XXX,XX +XXX,XX @@ echo
22
echo 'Testing failing commit'
23
echo
24
25
+TEST_IMG="$TEST_IMG.base" _make_test_img 1M
26
+
27
# Create an image with a null backing file to which committing will fail (with
28
# ENOSPC so we can distinguish the result from some generic EIO which may be
29
# generated anywhere in the block layer)
30
-_make_test_img -b "json:{'driver': 'raw',
31
+_make_test_img -b "json:{'driver': '$IMGFMT',
32
'file': {
33
'driver': 'blkdebug',
34
'inject-error': [{
35
@@ -XXX,XX +XXX,XX @@ _make_test_img -b "json:{'driver': 'raw',
36
'once': true
37
}],
38
'image': {
39
- 'driver': 'null-co'
40
+ 'driver': 'file',
41
+ 'filename': '$TEST_IMG.base'
42
}}}"
43
44
# Just write anything so committing will not be a no-op
45
$QEMU_IO -c 'writev 0 64k' "$TEST_IMG" | _filter_qemu_io
46
47
$QEMU_IMG commit "$TEST_IMG"
48
-_cleanup_test_img
49
+_cleanup
50
51
# success, all done
52
echo "*** done"
53
diff --git a/tests/qemu-iotests/020.out b/tests/qemu-iotests/020.out
54
index XXXXXXX..XXXXXXX 100644
55
--- a/tests/qemu-iotests/020.out
56
+++ b/tests/qemu-iotests/020.out
57
@@ -XXX,XX +XXX,XX @@ No errors were found on the image.
58
59
Testing failing commit
60
61
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 backing_file=json:{'driver': 'raw',,
62
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=1048576
63
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=json:{'driver': 'IMGFMT',,
64
'file': {
65
'driver': 'blkdebug',,
66
'inject-error': [{
67
@@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 backing_file=json:{'d
68
'once': true
69
}],,
70
'image': {
71
- 'driver': 'null-co'
72
+ 'driver': 'file',,
73
+ 'filename': 'TEST_DIR/t.IMGFMT.base'
74
}}}
75
wrote 65536/65536 bytes at offset 0
76
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
77
--
78
2.13.6
79
80
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
051 has both compat=1.1 and compat=0.10 tests (once it uses
4
lazy_refcounts, once it tests that setting them does not work).
5
For the compat=0.10 tests, it already explicitly creates a suitable
6
image. So let's just ignore the user-specified compat level for the
7
lazy_refcounts test and explicitly create a compat=1.1 image there, too.
8
9
Signed-off-by: Max Reitz <mreitz@redhat.com>
10
Message-id: 20171123020832.8165-12-mreitz@redhat.com
11
Signed-off-by: Max Reitz <mreitz@redhat.com>
12
---
13
tests/qemu-iotests/051 | 2 ++
14
tests/qemu-iotests/051.out | 1 +
15
tests/qemu-iotests/051.pc.out | 1 +
16
3 files changed, 4 insertions(+)
17
18
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
19
index XXXXXXX..XXXXXXX 100755
20
--- a/tests/qemu-iotests/051
21
+++ b/tests/qemu-iotests/051
22
@@ -XXX,XX +XXX,XX @@ echo
23
echo === Enable and disable lazy refcounting on the command line, plus some invalid values ===
24
echo
25
26
+_make_test_img -o compat=1.1 "$size"
27
+
28
run_qemu -drive file="$TEST_IMG",format=qcow2,lazy-refcounts=on
29
run_qemu -drive file="$TEST_IMG",format=qcow2,lazy-refcounts=off
30
run_qemu -drive file="$TEST_IMG",format=qcow2,lazy-refcounts=
31
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
32
index XXXXXXX..XXXXXXX 100644
33
--- a/tests/qemu-iotests/051.out
34
+++ b/tests/qemu-iotests/051.out
35
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.backing.driver=qcow2,file.backing.f
36
37
=== Enable and disable lazy refcounting on the command line, plus some invalid values ===
38
39
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
40
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
41
QEMU X.Y.Z monitor - type 'help' for more information
42
(qemu) quit
43
diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out
44
index XXXXXXX..XXXXXXX 100644
45
--- a/tests/qemu-iotests/051.pc.out
46
+++ b/tests/qemu-iotests/051.pc.out
47
@@ -XXX,XX +XXX,XX @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.backing.driver=qcow2,file.backing.f
48
49
=== Enable and disable lazy refcounting on the command line, plus some invalid values ===
50
51
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
52
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
53
QEMU X.Y.Z monitor - type 'help' for more information
54
(qemu) quit
55
--
56
2.13.6
57
58
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
As of commit 9877860e7bd1e26ee70ab9bb5ebc34c92bf23bf5, vmdk fails
4
differently when opening the sample image.
5
6
Signed-off-by: Max Reitz <mreitz@redhat.com>
7
Message-id: 20171123020832.8165-13-mreitz@redhat.com
8
Reviewed-by: John Snow <jsnow@redhat.com>
9
Reviewed-by: Fam Zheng <famz@redhat.com>
10
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
---
12
tests/qemu-iotests/059.out | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
14
15
diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out
16
index XXXXXXX..XXXXXXX 100644
17
--- a/tests/qemu-iotests/059.out
18
+++ b/tests/qemu-iotests/059.out
19
@@ -XXX,XX +XXX,XX @@ Offset Length Mapped to File
20
0x140000000 0x10000 0x50000 TEST_DIR/t-s003.vmdk
21
22
=== Testing afl image with a very large capacity ===
23
-qemu-img: Can't get image size 'TEST_DIR/afl9.IMGFMT': File too large
24
+qemu-img: Could not open 'TEST_DIR/afl9.IMGFMT': Could not open 'TEST_DIR/afl9.IMGFMT': Invalid argument
25
*** done
26
--
27
2.13.6
28
29
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
067 works very well with compat=0.10 once you remove format-specific
4
information from the QMP output.
5
6
Signed-off-by: Max Reitz <mreitz@redhat.com>
7
Message-id: 20171123020832.8165-14-mreitz@redhat.com
8
Reviewed-by: John Snow <jsnow@redhat.com>
9
Signed-off-by: Max Reitz <mreitz@redhat.com>
10
---
11
tests/qemu-iotests/067 | 3 +-
12
tests/qemu-iotests/067.out | 97 +++++++++++++---------------------------------
13
2 files changed, 28 insertions(+), 72 deletions(-)
14
15
diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067
16
index XXXXXXX..XXXXXXX 100755
17
--- a/tests/qemu-iotests/067
18
+++ b/tests/qemu-iotests/067
19
@@ -XXX,XX +XXX,XX @@ function run_qemu()
20
{
21
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | _filter_qemu \
22
| _filter_actual_image_size \
23
- | _filter_generated_node_ids | _filter_qmp_events
24
+ | _filter_generated_node_ids | _filter_qmp_events \
25
+ | _filter_img_info
26
}
27
28
size=128M
29
diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out
30
index XXXXXXX..XXXXXXX 100644
31
--- a/tests/qemu-iotests/067.out
32
+++ b/tests/qemu-iotests/067.out
33
@@ -XXX,XX +XXX,XX @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
34
35
=== -drive/-device and device_del ===
36
37
-Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virtio-blk,drive=disk,id=virtio0
38
+Testing: -drive file=TEST_DIR/t.IMGFMT,format=IMGFMT,if=none,id=disk -device virtio-blk,drive=disk,id=virtio0
39
{
40
QMP_VERSION
41
}
42
@@ -XXX,XX +XXX,XX @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virti
43
"detect_zeroes": "off",
44
"image": {
45
"virtual-size": 134217728,
46
- "filename": "TEST_DIR/t.qcow2",
47
+ "filename": "TEST_DIR/t.IMGFMT",
48
"cluster-size": 65536,
49
- "format": "qcow2",
50
+ "format": "IMGFMT",
51
"actual-size": SIZE,
52
- "format-specific": {
53
- "type": "qcow2",
54
- "data": {
55
- "compat": "1.1",
56
- "lazy-refcounts": false,
57
- "refcount-bits": 16,
58
- "corrupt": false
59
- }
60
- },
61
"dirty-flag": false
62
},
63
"iops_wr": 0,
64
"ro": false,
65
"node-name": "NODE_NAME",
66
"backing_file_depth": 0,
67
- "drv": "qcow2",
68
+ "drv": "IMGFMT",
69
"iops": 0,
70
"bps_wr": 0,
71
"write_threshold": 0,
72
@@ -XXX,XX +XXX,XX @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virti
73
"direct": false,
74
"writeback": true
75
},
76
- "file": "TEST_DIR/t.qcow2",
77
+ "file": "TEST_DIR/t.IMGFMT",
78
"encryption_key_missing": false
79
},
80
"qdev": "/machine/peripheral/virtio0/virtio-backend",
81
@@ -XXX,XX +XXX,XX @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virti
82
83
=== -drive/device_add and device_del ===
84
85
-Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk
86
+Testing: -drive file=TEST_DIR/t.IMGFMT,format=IMGFMT,if=none,id=disk
87
{
88
QMP_VERSION
89
}
90
@@ -XXX,XX +XXX,XX @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk
91
"detect_zeroes": "off",
92
"image": {
93
"virtual-size": 134217728,
94
- "filename": "TEST_DIR/t.qcow2",
95
+ "filename": "TEST_DIR/t.IMGFMT",
96
"cluster-size": 65536,
97
- "format": "qcow2",
98
+ "format": "IMGFMT",
99
"actual-size": SIZE,
100
- "format-specific": {
101
- "type": "qcow2",
102
- "data": {
103
- "compat": "1.1",
104
- "lazy-refcounts": false,
105
- "refcount-bits": 16,
106
- "corrupt": false
107
- }
108
- },
109
"dirty-flag": false
110
},
111
"iops_wr": 0,
112
"ro": false,
113
"node-name": "NODE_NAME",
114
"backing_file_depth": 0,
115
- "drv": "qcow2",
116
+ "drv": "IMGFMT",
117
"iops": 0,
118
"bps_wr": 0,
119
"write_threshold": 0,
120
@@ -XXX,XX +XXX,XX @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk
121
"direct": false,
122
"writeback": true
123
},
124
- "file": "TEST_DIR/t.qcow2",
125
+ "file": "TEST_DIR/t.IMGFMT",
126
"encryption_key_missing": false
127
},
128
"type": "unknown"
129
@@ -XXX,XX +XXX,XX @@ Testing:
130
"detect_zeroes": "off",
131
"image": {
132
"virtual-size": 134217728,
133
- "filename": "TEST_DIR/t.qcow2",
134
+ "filename": "TEST_DIR/t.IMGFMT",
135
"cluster-size": 65536,
136
- "format": "qcow2",
137
+ "format": "IMGFMT",
138
"actual-size": SIZE,
139
- "format-specific": {
140
- "type": "qcow2",
141
- "data": {
142
- "compat": "1.1",
143
- "lazy-refcounts": false,
144
- "refcount-bits": 16,
145
- "corrupt": false
146
- }
147
- },
148
"dirty-flag": false
149
},
150
"iops_wr": 0,
151
"ro": false,
152
"node-name": "NODE_NAME",
153
"backing_file_depth": 0,
154
- "drv": "qcow2",
155
+ "drv": "IMGFMT",
156
"iops": 0,
157
"bps_wr": 0,
158
"write_threshold": 0,
159
@@ -XXX,XX +XXX,XX @@ Testing:
160
"direct": false,
161
"writeback": true
162
},
163
- "file": "TEST_DIR/t.qcow2",
164
+ "file": "TEST_DIR/t.IMGFMT",
165
"encryption_key_missing": false
166
},
167
"type": "unknown"
168
@@ -XXX,XX +XXX,XX @@ Testing:
169
"detect_zeroes": "off",
170
"image": {
171
"virtual-size": 134217728,
172
- "filename": "TEST_DIR/t.qcow2",
173
+ "filename": "TEST_DIR/t.IMGFMT",
174
"cluster-size": 65536,
175
- "format": "qcow2",
176
+ "format": "IMGFMT",
177
"actual-size": SIZE,
178
- "format-specific": {
179
- "type": "qcow2",
180
- "data": {
181
- "compat": "1.1",
182
- "lazy-refcounts": false,
183
- "refcount-bits": 16,
184
- "corrupt": false
185
- }
186
- },
187
"dirty-flag": false
188
},
189
"iops_wr": 0,
190
"ro": false,
191
"node-name": "disk",
192
"backing_file_depth": 0,
193
- "drv": "qcow2",
194
+ "drv": "IMGFMT",
195
"iops": 0,
196
"bps_wr": 0,
197
"write_threshold": 0,
198
@@ -XXX,XX +XXX,XX @@ Testing:
199
"direct": false,
200
"writeback": true
201
},
202
- "file": "TEST_DIR/t.qcow2",
203
+ "file": "TEST_DIR/t.IMGFMT",
204
"encryption_key_missing": false
205
},
206
{
207
@@ -XXX,XX +XXX,XX @@ Testing:
208
"detect_zeroes": "off",
209
"image": {
210
"virtual-size": 197120,
211
- "filename": "TEST_DIR/t.qcow2",
212
+ "filename": "TEST_DIR/t.IMGFMT",
213
"format": "file",
214
"actual-size": SIZE,
215
"dirty-flag": false
216
@@ -XXX,XX +XXX,XX @@ Testing:
217
"direct": false,
218
"writeback": true
219
},
220
- "file": "TEST_DIR/t.qcow2",
221
+ "file": "TEST_DIR/t.IMGFMT",
222
"encryption_key_missing": false
223
}
224
]
225
@@ -XXX,XX +XXX,XX @@ Testing:
226
"detect_zeroes": "off",
227
"image": {
228
"virtual-size": 134217728,
229
- "filename": "TEST_DIR/t.qcow2",
230
+ "filename": "TEST_DIR/t.IMGFMT",
231
"cluster-size": 65536,
232
- "format": "qcow2",
233
+ "format": "IMGFMT",
234
"actual-size": SIZE,
235
- "format-specific": {
236
- "type": "qcow2",
237
- "data": {
238
- "compat": "1.1",
239
- "lazy-refcounts": false,
240
- "refcount-bits": 16,
241
- "corrupt": false
242
- }
243
- },
244
"dirty-flag": false
245
},
246
"iops_wr": 0,
247
"ro": false,
248
"node-name": "disk",
249
"backing_file_depth": 0,
250
- "drv": "qcow2",
251
+ "drv": "IMGFMT",
252
"iops": 0,
253
"bps_wr": 0,
254
"write_threshold": 0,
255
@@ -XXX,XX +XXX,XX @@ Testing:
256
"direct": false,
257
"writeback": true
258
},
259
- "file": "TEST_DIR/t.qcow2",
260
+ "file": "TEST_DIR/t.IMGFMT",
261
"encryption_key_missing": false
262
},
263
{
264
@@ -XXX,XX +XXX,XX @@ Testing:
265
"detect_zeroes": "off",
266
"image": {
267
"virtual-size": 197120,
268
- "filename": "TEST_DIR/t.qcow2",
269
+ "filename": "TEST_DIR/t.IMGFMT",
270
"format": "file",
271
"actual-size": SIZE,
272
"dirty-flag": false
273
@@ -XXX,XX +XXX,XX @@ Testing:
274
"direct": false,
275
"writeback": true
276
},
277
- "file": "TEST_DIR/t.qcow2",
278
+ "file": "TEST_DIR/t.IMGFMT",
279
"encryption_key_missing": false
280
}
281
]
282
--
283
2.13.6
284
285
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
The only thing that is missing is a _filter_img_info after the
4
"$QEMU_IO -c info" invocations.
5
6
Signed-off-by: Max Reitz <mreitz@redhat.com>
7
Message-id: 20171123020832.8165-15-mreitz@redhat.com
8
Reviewed-by: John Snow <jsnow@redhat.com>
9
Signed-off-by: Max Reitz <mreitz@redhat.com>
10
---
11
tests/qemu-iotests/089 | 4 ++--
12
tests/qemu-iotests/089.out | 10 ----------
13
2 files changed, 2 insertions(+), 12 deletions(-)
14
15
diff --git a/tests/qemu-iotests/089 b/tests/qemu-iotests/089
16
index XXXXXXX..XXXXXXX 100755
17
--- a/tests/qemu-iotests/089
18
+++ b/tests/qemu-iotests/089
19
@@ -XXX,XX +XXX,XX @@ echo
20
21
# Both options given directly and those given in the filename should be used
22
$QEMU_IO -c "open -o driver=qcow2 json:{\"file.filename\":\"$TEST_IMG\"}" \
23
- -c "info" 2>&1 | _filter_testdir | _filter_imgfmt
24
+ -c "info" 2>&1 | _filter_img_info
25
26
# Options given directly should be prioritized over those given in the filename
27
$QEMU_IO -c "open -o driver=qcow2 json:{\"driver\":\"raw\",\"file.filename\":\"$TEST_IMG\"}" \
28
- -c "info" 2>&1 | _filter_testdir | _filter_imgfmt
29
+ -c "info" 2>&1 | _filter_img_info
30
31
32
# success, all done
33
diff --git a/tests/qemu-iotests/089.out b/tests/qemu-iotests/089.out
34
index XXXXXXX..XXXXXXX 100644
35
--- a/tests/qemu-iotests/089.out
36
+++ b/tests/qemu-iotests/089.out
37
@@ -XXX,XX +XXX,XX @@ cluster_size: 65536
38
format name: IMGFMT
39
cluster size: 64 KiB
40
vm state offset: 512 MiB
41
-Format specific information:
42
- compat: 1.1
43
- lazy refcounts: false
44
- refcount bits: 16
45
- corrupt: false
46
format name: IMGFMT
47
cluster size: 64 KiB
48
vm state offset: 512 MiB
49
-Format specific information:
50
- compat: 1.1
51
- lazy refcounts: false
52
- refcount bits: 16
53
- corrupt: false
54
*** done
55
--
56
2.13.6
57
58
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
184 does not need an image, so don't use one.
4
5
Signed-off-by: Max Reitz <mreitz@redhat.com>
6
Message-id: 20171123020832.8165-16-mreitz@redhat.com
7
Reviewed-by: John Snow <jsnow@redhat.com>
8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9
---
10
tests/qemu-iotests/184 | 25 ++++--------------
11
tests/qemu-iotests/184.out | 63 +++++++---------------------------------------
12
2 files changed, 14 insertions(+), 74 deletions(-)
13
14
diff --git a/tests/qemu-iotests/184 b/tests/qemu-iotests/184
15
index XXXXXXX..XXXXXXX 100755
16
--- a/tests/qemu-iotests/184
17
+++ b/tests/qemu-iotests/184
18
@@ -XXX,XX +XXX,XX @@ echo "QA output created by $seq"
19
here=`pwd`
20
status=1    # failure is the default!
21
22
-_cleanup()
23
-{
24
- _cleanup_test_img
25
-}
26
-trap "_cleanup; exit \$status" 0 1 2 3 15
27
+trap "exit \$status" 0 1 2 3 15
28
29
# get standard environment, filters and checks
30
. ./common.rc
31
. ./common.filter
32
33
-_supported_fmt qcow2
34
-_supported_proto file
35
_supported_os Linux
36
37
function do_run_qemu()
38
@@ -XXX,XX +XXX,XX @@ function run_qemu()
39
| _filter_actual_image_size
40
}
41
42
-_make_test_img 64M
43
test_throttle=$($QEMU_IMG --help|grep throttle)
44
[ "$test_throttle" = "" ] && _supported_fmt throttle
45
46
@@ -XXX,XX +XXX,XX @@ run_qemu <<EOF
47
{ "execute": "qmp_capabilities" }
48
{ "execute": "blockdev-add",
49
"arguments": {
50
- "driver": "$IMGFMT",
51
- "node-name": "disk0",
52
- "file": {
53
- "driver": "file",
54
- "filename": "$TEST_IMG"
55
- }
56
+ "driver": "null-co",
57
+ "node-name": "disk0"
58
}
59
}
60
{ "execute": "object-add",
61
@@ -XXX,XX +XXX,XX @@ run_qemu <<EOF
62
{ "execute": "qmp_capabilities" }
63
{ "execute": "blockdev-add",
64
"arguments": {
65
- "driver": "$IMGFMT",
66
- "node-name": "disk0",
67
- "file": {
68
- "driver": "file",
69
- "filename": "$TEST_IMG"
70
- }
71
+ "driver": "null-co",
72
+ "node-name": "disk0"
73
}
74
}
75
{ "execute": "blockdev-add",
76
diff --git a/tests/qemu-iotests/184.out b/tests/qemu-iotests/184.out
77
index XXXXXXX..XXXXXXX 100644
78
--- a/tests/qemu-iotests/184.out
79
+++ b/tests/qemu-iotests/184.out
80
@@ -XXX,XX +XXX,XX @@
81
QA output created by 184
82
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
83
84
== checking interface ==
85
Testing:
86
@@ -XXX,XX +XXX,XX @@ Testing:
87
"iops_rd": 0,
88
"detect_zeroes": "off",
89
"image": {
90
- "virtual-size": 67108864,
91
- "filename": "json:{\"throttle-group\": \"group0\", \"driver\": \"throttle\", \"file\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}}",
92
- "cluster-size": 65536,
93
- "format": "throttle",
94
- "actual-size": SIZE,
95
- "dirty-flag": false
96
+ "virtual-size": 1073741824,
97
+ "filename": "json:{\"throttle-group\": \"group0\", \"driver\": \"throttle\", \"file\": {\"driver\": \"null-co\"}}",
98
+ "format": "throttle"
99
},
100
"iops_wr": 0,
101
"ro": false,
102
@@ -XXX,XX +XXX,XX @@ Testing:
103
"direct": false,
104
"writeback": true
105
},
106
- "file": "json:{\"throttle-group\": \"group0\", \"driver\": \"throttle\", \"file\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}}",
107
+ "file": "json:{\"throttle-group\": \"group0\", \"driver\": \"throttle\", \"file\": {\"driver\": \"null-co\"}}",
108
"encryption_key_missing": false
109
},
110
{
111
"iops_rd": 0,
112
"detect_zeroes": "off",
113
"image": {
114
- "virtual-size": 67108864,
115
- "filename": "TEST_DIR/t.qcow2",
116
- "cluster-size": 65536,
117
- "format": "qcow2",
118
- "actual-size": SIZE,
119
- "format-specific": {
120
- "type": "qcow2",
121
- "data": {
122
- "compat": "1.1",
123
- "lazy-refcounts": false,
124
- "refcount-bits": 16,
125
- "corrupt": false
126
- }
127
- },
128
- "dirty-flag": false
129
+ "virtual-size": 1073741824,
130
+ "filename": "null-co://",
131
+ "format": "null-co"
132
},
133
"iops_wr": 0,
134
"ro": false,
135
"node-name": "disk0",
136
"backing_file_depth": 0,
137
- "drv": "qcow2",
138
+ "drv": "null-co",
139
"iops": 0,
140
"bps_wr": 0,
141
"write_threshold": 0,
142
@@ -XXX,XX +XXX,XX @@ Testing:
143
"direct": false,
144
"writeback": true
145
},
146
- "file": "TEST_DIR/t.qcow2",
147
- "encryption_key_missing": false
148
- },
149
- {
150
- "iops_rd": 0,
151
- "detect_zeroes": "off",
152
- "image": {
153
- "virtual-size": 197120,
154
- "filename": "TEST_DIR/t.qcow2",
155
- "format": "file",
156
- "actual-size": SIZE,
157
- "dirty-flag": false
158
- },
159
- "iops_wr": 0,
160
- "ro": false,
161
- "node-name": "NODE_NAME",
162
- "backing_file_depth": 0,
163
- "drv": "file",
164
- "iops": 0,
165
- "bps_wr": 0,
166
- "write_threshold": 0,
167
- "encrypted": false,
168
- "bps": 0,
169
- "bps_rd": 0,
170
- "cache": {
171
- "no-flush": false,
172
- "direct": false,
173
- "writeback": true
174
- },
175
- "file": "TEST_DIR/t.qcow2",
176
+ "file": "null-co://",
177
"encryption_key_missing": false
178
}
179
]
180
--
181
2.13.6
182
183
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
In order for 191 to work with an explicit refcount_bits or compat=0.10,
4
we should strip format-specific information from the output--and we can
5
do so by using _filter_img_info.
6
7
Signed-off-by: Max Reitz <mreitz@redhat.com>
8
Message-id: 20171123020832.8165-17-mreitz@redhat.com
9
Reviewed-by: John Snow <jsnow@redhat.com>
10
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
---
12
tests/qemu-iotests/191 | 5 +-
13
tests/qemu-iotests/191.out | 313 +++++++++++++--------------------------------
14
2 files changed, 91 insertions(+), 227 deletions(-)
15
16
diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191
17
index XXXXXXX..XXXXXXX 100755
18
--- a/tests/qemu-iotests/191
19
+++ b/tests/qemu-iotests/191
20
@@ -XXX,XX +XXX,XX @@ trap "_cleanup; exit \$status" 0 1 2 3 15
21
. ./common.qemu
22
23
_supported_fmt qcow2
24
-_unsupported_imgopts compat=0.10
25
_supported_proto file
26
_supported_os Linux
27
28
@@ -XXX,XX +XXX,XX @@ echo === Check that both top and top2 point to base now ===
29
echo
30
31
_send_qemu_cmd $h "{ 'execute': 'query-named-block-nodes' }" "^}" |
32
- _filter_generated_node_ids | _filter_actual_image_size
33
+ _filter_generated_node_ids | _filter_actual_image_size | _filter_img_info
34
35
_send_qemu_cmd $h "{ 'execute': 'quit' }" "^}"
36
wait=1 _cleanup_qemu
37
@@ -XXX,XX +XXX,XX @@ echo === Check that both top and top2 point to base now ===
38
echo
39
40
_send_qemu_cmd $h "{ 'execute': 'query-named-block-nodes' }" "^}" |
41
- _filter_generated_node_ids | _filter_actual_image_size
42
+ _filter_generated_node_ids | _filter_actual_image_size | _filter_img_info
43
44
_send_qemu_cmd $h "{ 'execute': 'quit' }" "^}"
45
wait=1 _cleanup_qemu
46
diff --git a/tests/qemu-iotests/191.out b/tests/qemu-iotests/191.out
47
index XXXXXXX..XXXXXXX 100644
48
--- a/tests/qemu-iotests/191.out
49
+++ b/tests/qemu-iotests/191.out
50
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
51
"image": {
52
"backing-image": {
53
"virtual-size": 67108864,
54
- "filename": "TEST_DIR/t.qcow2.base",
55
+ "filename": "TEST_DIR/t.IMGFMT.base",
56
"cluster-size": 65536,
57
- "format": "qcow2",
58
+ "format": "IMGFMT",
59
"actual-size": SIZE,
60
- "format-specific": {
61
- "type": "qcow2",
62
- "data": {
63
- "compat": "1.1",
64
- "lazy-refcounts": false,
65
- "refcount-bits": 16,
66
- "corrupt": false
67
- }
68
- },
69
"dirty-flag": false
70
},
71
- "backing-filename-format": "qcow2",
72
+ "backing-filename-format": "IMGFMT",
73
"virtual-size": 67108864,
74
- "filename": "TEST_DIR/t.qcow2.ovl2",
75
+ "filename": "TEST_DIR/t.IMGFMT.ovl2",
76
"cluster-size": 65536,
77
- "format": "qcow2",
78
+ "format": "IMGFMT",
79
"actual-size": SIZE,
80
- "format-specific": {
81
- "type": "qcow2",
82
- "data": {
83
- "compat": "1.1",
84
- "lazy-refcounts": false,
85
- "refcount-bits": 16,
86
- "corrupt": false
87
- }
88
- },
89
- "full-backing-filename": "TEST_DIR/t.qcow2.base",
90
- "backing-filename": "TEST_DIR/t.qcow2.base",
91
+ "full-backing-filename": "TEST_DIR/t.IMGFMT.base",
92
+ "backing-filename": "TEST_DIR/t.IMGFMT.base",
93
"dirty-flag": false
94
},
95
"iops_wr": 0,
96
"ro": false,
97
"node-name": "top2",
98
"backing_file_depth": 1,
99
- "drv": "qcow2",
100
+ "drv": "IMGFMT",
101
"iops": 0,
102
"bps_wr": 0,
103
"write_threshold": 0,
104
- "backing_file": "TEST_DIR/t.qcow2.base",
105
+ "backing_file": "TEST_DIR/t.IMGFMT.base",
106
"encrypted": false,
107
"bps": 0,
108
"bps_rd": 0,
109
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
110
"direct": false,
111
"writeback": true
112
},
113
- "file": "TEST_DIR/t.qcow2.ovl2",
114
+ "file": "TEST_DIR/t.IMGFMT.ovl2",
115
"encryption_key_missing": false
116
},
117
{
118
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
119
"detect_zeroes": "off",
120
"image": {
121
"virtual-size": 197120,
122
- "filename": "TEST_DIR/t.qcow2.ovl2",
123
+ "filename": "TEST_DIR/t.IMGFMT.ovl2",
124
"format": "file",
125
"actual-size": SIZE,
126
"dirty-flag": false
127
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
128
"direct": false,
129
"writeback": true
130
},
131
- "file": "TEST_DIR/t.qcow2.ovl2",
132
+ "file": "TEST_DIR/t.IMGFMT.ovl2",
133
"encryption_key_missing": false
134
},
135
{
136
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
137
"image": {
138
"backing-image": {
139
"virtual-size": 67108864,
140
- "filename": "TEST_DIR/t.qcow2.base",
141
+ "filename": "TEST_DIR/t.IMGFMT.base",
142
"cluster-size": 65536,
143
- "format": "qcow2",
144
+ "format": "IMGFMT",
145
"actual-size": SIZE,
146
- "format-specific": {
147
- "type": "qcow2",
148
- "data": {
149
- "compat": "1.1",
150
- "lazy-refcounts": false,
151
- "refcount-bits": 16,
152
- "corrupt": false
153
- }
154
- },
155
"dirty-flag": false
156
},
157
- "backing-filename-format": "qcow2",
158
+ "backing-filename-format": "IMGFMT",
159
"virtual-size": 67108864,
160
- "filename": "TEST_DIR/t.qcow2",
161
+ "filename": "TEST_DIR/t.IMGFMT",
162
"cluster-size": 65536,
163
- "format": "qcow2",
164
+ "format": "IMGFMT",
165
"actual-size": SIZE,
166
- "format-specific": {
167
- "type": "qcow2",
168
- "data": {
169
- "compat": "1.1",
170
- "lazy-refcounts": false,
171
- "refcount-bits": 16,
172
- "corrupt": false
173
- }
174
- },
175
- "full-backing-filename": "TEST_DIR/t.qcow2.base",
176
- "backing-filename": "TEST_DIR/t.qcow2.base",
177
+ "full-backing-filename": "TEST_DIR/t.IMGFMT.base",
178
+ "backing-filename": "TEST_DIR/t.IMGFMT.base",
179
"dirty-flag": false
180
},
181
"iops_wr": 0,
182
"ro": false,
183
"node-name": "top",
184
"backing_file_depth": 1,
185
- "drv": "qcow2",
186
+ "drv": "IMGFMT",
187
"iops": 0,
188
"bps_wr": 0,
189
"write_threshold": 0,
190
- "backing_file": "TEST_DIR/t.qcow2.base",
191
+ "backing_file": "TEST_DIR/t.IMGFMT.base",
192
"encrypted": false,
193
"bps": 0,
194
"bps_rd": 0,
195
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
196
"direct": false,
197
"writeback": true
198
},
199
- "file": "TEST_DIR/t.qcow2",
200
+ "file": "TEST_DIR/t.IMGFMT",
201
"encryption_key_missing": false
202
},
203
{
204
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
205
"detect_zeroes": "off",
206
"image": {
207
"virtual-size": 197120,
208
- "filename": "TEST_DIR/t.qcow2",
209
+ "filename": "TEST_DIR/t.IMGFMT",
210
"format": "file",
211
"actual-size": SIZE,
212
"dirty-flag": false
213
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
214
"direct": false,
215
"writeback": true
216
},
217
- "file": "TEST_DIR/t.qcow2",
218
+ "file": "TEST_DIR/t.IMGFMT",
219
"encryption_key_missing": false
220
},
221
{
222
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
223
"image": {
224
"backing-image": {
225
"virtual-size": 67108864,
226
- "filename": "TEST_DIR/t.qcow2.base",
227
+ "filename": "TEST_DIR/t.IMGFMT.base",
228
"cluster-size": 65536,
229
- "format": "qcow2",
230
+ "format": "IMGFMT",
231
"actual-size": SIZE,
232
- "format-specific": {
233
- "type": "qcow2",
234
- "data": {
235
- "compat": "1.1",
236
- "lazy-refcounts": false,
237
- "refcount-bits": 16,
238
- "corrupt": false
239
- }
240
- },
241
"dirty-flag": false
242
},
243
- "backing-filename-format": "qcow2",
244
+ "backing-filename-format": "IMGFMT",
245
"virtual-size": 67108864,
246
- "filename": "TEST_DIR/t.qcow2.mid",
247
+ "filename": "TEST_DIR/t.IMGFMT.mid",
248
"cluster-size": 65536,
249
- "format": "qcow2",
250
+ "format": "IMGFMT",
251
"actual-size": SIZE,
252
- "format-specific": {
253
- "type": "qcow2",
254
- "data": {
255
- "compat": "1.1",
256
- "lazy-refcounts": false,
257
- "refcount-bits": 16,
258
- "corrupt": false
259
- }
260
- },
261
- "full-backing-filename": "TEST_DIR/t.qcow2.base",
262
- "backing-filename": "TEST_DIR/t.qcow2.base",
263
+ "full-backing-filename": "TEST_DIR/t.IMGFMT.base",
264
+ "backing-filename": "TEST_DIR/t.IMGFMT.base",
265
"dirty-flag": false
266
},
267
"iops_wr": 0,
268
"ro": false,
269
"node-name": "mid",
270
"backing_file_depth": 1,
271
- "drv": "qcow2",
272
+ "drv": "IMGFMT",
273
"iops": 0,
274
"bps_wr": 0,
275
"write_threshold": 0,
276
- "backing_file": "TEST_DIR/t.qcow2.base",
277
+ "backing_file": "TEST_DIR/t.IMGFMT.base",
278
"encrypted": false,
279
"bps": 0,
280
"bps_rd": 0,
281
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
282
"direct": false,
283
"writeback": true
284
},
285
- "file": "TEST_DIR/t.qcow2.mid",
286
+ "file": "TEST_DIR/t.IMGFMT.mid",
287
"encryption_key_missing": false
288
},
289
{
290
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
291
"detect_zeroes": "off",
292
"image": {
293
"virtual-size": 393216,
294
- "filename": "TEST_DIR/t.qcow2.mid",
295
+ "filename": "TEST_DIR/t.IMGFMT.mid",
296
"format": "file",
297
"actual-size": SIZE,
298
"dirty-flag": false
299
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
300
"direct": false,
301
"writeback": true
302
},
303
- "file": "TEST_DIR/t.qcow2.mid",
304
+ "file": "TEST_DIR/t.IMGFMT.mid",
305
"encryption_key_missing": false
306
},
307
{
308
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
309
"detect_zeroes": "off",
310
"image": {
311
"virtual-size": 67108864,
312
- "filename": "TEST_DIR/t.qcow2.base",
313
+ "filename": "TEST_DIR/t.IMGFMT.base",
314
"cluster-size": 65536,
315
- "format": "qcow2",
316
+ "format": "IMGFMT",
317
"actual-size": SIZE,
318
- "format-specific": {
319
- "type": "qcow2",
320
- "data": {
321
- "compat": "1.1",
322
- "lazy-refcounts": false,
323
- "refcount-bits": 16,
324
- "corrupt": false
325
- }
326
- },
327
"dirty-flag": false
328
},
329
"iops_wr": 0,
330
"ro": false,
331
"node-name": "base",
332
"backing_file_depth": 0,
333
- "drv": "qcow2",
334
+ "drv": "IMGFMT",
335
"iops": 0,
336
"bps_wr": 0,
337
"write_threshold": 0,
338
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
339
"direct": false,
340
"writeback": true
341
},
342
- "file": "TEST_DIR/t.qcow2.base",
343
+ "file": "TEST_DIR/t.IMGFMT.base",
344
"encryption_key_missing": false
345
},
346
{
347
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
348
"detect_zeroes": "off",
349
"image": {
350
"virtual-size": 393216,
351
- "filename": "TEST_DIR/t.qcow2.base",
352
+ "filename": "TEST_DIR/t.IMGFMT.base",
353
"format": "file",
354
"actual-size": SIZE,
355
"dirty-flag": false
356
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
357
"direct": false,
358
"writeback": true
359
},
360
- "file": "TEST_DIR/t.qcow2.base",
361
+ "file": "TEST_DIR/t.IMGFMT.base",
362
"encryption_key_missing": false
363
}
364
]
365
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
366
"image": {
367
"backing-image": {
368
"virtual-size": 67108864,
369
- "filename": "TEST_DIR/t.qcow2.base",
370
+ "filename": "TEST_DIR/t.IMGFMT.base",
371
"cluster-size": 65536,
372
- "format": "qcow2",
373
+ "format": "IMGFMT",
374
"actual-size": SIZE,
375
- "format-specific": {
376
- "type": "qcow2",
377
- "data": {
378
- "compat": "1.1",
379
- "lazy-refcounts": false,
380
- "refcount-bits": 16,
381
- "corrupt": false
382
- }
383
- },
384
"dirty-flag": false
385
},
386
- "backing-filename-format": "qcow2",
387
+ "backing-filename-format": "IMGFMT",
388
"virtual-size": 67108864,
389
- "filename": "TEST_DIR/t.qcow2.ovl2",
390
+ "filename": "TEST_DIR/t.IMGFMT.ovl2",
391
"cluster-size": 65536,
392
- "format": "qcow2",
393
+ "format": "IMGFMT",
394
"actual-size": SIZE,
395
- "format-specific": {
396
- "type": "qcow2",
397
- "data": {
398
- "compat": "1.1",
399
- "lazy-refcounts": false,
400
- "refcount-bits": 16,
401
- "corrupt": false
402
- }
403
- },
404
- "full-backing-filename": "TEST_DIR/t.qcow2.base",
405
- "backing-filename": "TEST_DIR/t.qcow2.base",
406
+ "full-backing-filename": "TEST_DIR/t.IMGFMT.base",
407
+ "backing-filename": "TEST_DIR/t.IMGFMT.base",
408
"dirty-flag": false
409
},
410
"iops_wr": 0,
411
"ro": true,
412
"node-name": "NODE_NAME",
413
"backing_file_depth": 1,
414
- "drv": "qcow2",
415
+ "drv": "IMGFMT",
416
"iops": 0,
417
"bps_wr": 0,
418
"write_threshold": 0,
419
- "backing_file": "TEST_DIR/t.qcow2.base",
420
+ "backing_file": "TEST_DIR/t.IMGFMT.base",
421
"encrypted": false,
422
"bps": 0,
423
"bps_rd": 0,
424
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
425
"direct": false,
426
"writeback": true
427
},
428
- "file": "TEST_DIR/t.qcow2.ovl2",
429
+ "file": "TEST_DIR/t.IMGFMT.ovl2",
430
"encryption_key_missing": false
431
},
432
{
433
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
434
"detect_zeroes": "off",
435
"image": {
436
"virtual-size": 197120,
437
- "filename": "TEST_DIR/t.qcow2.ovl2",
438
+ "filename": "TEST_DIR/t.IMGFMT.ovl2",
439
"format": "file",
440
"actual-size": SIZE,
441
"dirty-flag": false
442
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
443
"direct": false,
444
"writeback": true
445
},
446
- "file": "TEST_DIR/t.qcow2.ovl2",
447
+ "file": "TEST_DIR/t.IMGFMT.ovl2",
448
"encryption_key_missing": false
449
},
450
{
451
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
452
"backing-image": {
453
"backing-image": {
454
"virtual-size": 67108864,
455
- "filename": "TEST_DIR/t.qcow2.base",
456
+ "filename": "TEST_DIR/t.IMGFMT.base",
457
"cluster-size": 65536,
458
- "format": "qcow2",
459
+ "format": "IMGFMT",
460
"actual-size": SIZE,
461
- "format-specific": {
462
- "type": "qcow2",
463
- "data": {
464
- "compat": "1.1",
465
- "lazy-refcounts": false,
466
- "refcount-bits": 16,
467
- "corrupt": false
468
- }
469
- },
470
"dirty-flag": false
471
},
472
- "backing-filename-format": "qcow2",
473
+ "backing-filename-format": "IMGFMT",
474
"virtual-size": 67108864,
475
- "filename": "TEST_DIR/t.qcow2.ovl2",
476
+ "filename": "TEST_DIR/t.IMGFMT.ovl2",
477
"cluster-size": 65536,
478
- "format": "qcow2",
479
+ "format": "IMGFMT",
480
"actual-size": SIZE,
481
- "format-specific": {
482
- "type": "qcow2",
483
- "data": {
484
- "compat": "1.1",
485
- "lazy-refcounts": false,
486
- "refcount-bits": 16,
487
- "corrupt": false
488
- }
489
- },
490
- "full-backing-filename": "TEST_DIR/t.qcow2.base",
491
- "backing-filename": "TEST_DIR/t.qcow2.base",
492
+ "full-backing-filename": "TEST_DIR/t.IMGFMT.base",
493
+ "backing-filename": "TEST_DIR/t.IMGFMT.base",
494
"dirty-flag": false
495
},
496
- "backing-filename-format": "qcow2",
497
+ "backing-filename-format": "IMGFMT",
498
"virtual-size": 67108864,
499
- "filename": "TEST_DIR/t.qcow2.ovl3",
500
+ "filename": "TEST_DIR/t.IMGFMT.ovl3",
501
"cluster-size": 65536,
502
- "format": "qcow2",
503
+ "format": "IMGFMT",
504
"actual-size": SIZE,
505
- "format-specific": {
506
- "type": "qcow2",
507
- "data": {
508
- "compat": "1.1",
509
- "lazy-refcounts": false,
510
- "refcount-bits": 16,
511
- "corrupt": false
512
- }
513
- },
514
- "full-backing-filename": "TEST_DIR/t.qcow2.ovl2",
515
- "backing-filename": "TEST_DIR/t.qcow2.ovl2",
516
+ "full-backing-filename": "TEST_DIR/t.IMGFMT.ovl2",
517
+ "backing-filename": "TEST_DIR/t.IMGFMT.ovl2",
518
"dirty-flag": false
519
},
520
"iops_wr": 0,
521
"ro": false,
522
"node-name": "top2",
523
"backing_file_depth": 2,
524
- "drv": "qcow2",
525
+ "drv": "IMGFMT",
526
"iops": 0,
527
"bps_wr": 0,
528
"write_threshold": 0,
529
- "backing_file": "TEST_DIR/t.qcow2.ovl2",
530
+ "backing_file": "TEST_DIR/t.IMGFMT.ovl2",
531
"encrypted": false,
532
"bps": 0,
533
"bps_rd": 0,
534
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
535
"direct": false,
536
"writeback": true
537
},
538
- "file": "TEST_DIR/t.qcow2.ovl3",
539
+ "file": "TEST_DIR/t.IMGFMT.ovl3",
540
"encryption_key_missing": false
541
},
542
{
543
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
544
"detect_zeroes": "off",
545
"image": {
546
"virtual-size": 197120,
547
- "filename": "TEST_DIR/t.qcow2.ovl3",
548
+ "filename": "TEST_DIR/t.IMGFMT.ovl3",
549
"format": "file",
550
"actual-size": SIZE,
551
"dirty-flag": false
552
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
553
"direct": false,
554
"writeback": true
555
},
556
- "file": "TEST_DIR/t.qcow2.ovl3",
557
+ "file": "TEST_DIR/t.IMGFMT.ovl3",
558
"encryption_key_missing": false
559
},
560
{
561
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
562
"detect_zeroes": "off",
563
"image": {
564
"virtual-size": 67108864,
565
- "filename": "TEST_DIR/t.qcow2.base",
566
+ "filename": "TEST_DIR/t.IMGFMT.base",
567
"cluster-size": 65536,
568
- "format": "qcow2",
569
+ "format": "IMGFMT",
570
"actual-size": SIZE,
571
- "format-specific": {
572
- "type": "qcow2",
573
- "data": {
574
- "compat": "1.1",
575
- "lazy-refcounts": false,
576
- "refcount-bits": 16,
577
- "corrupt": false
578
- }
579
- },
580
"dirty-flag": false
581
},
582
"iops_wr": 0,
583
"ro": true,
584
"node-name": "NODE_NAME",
585
"backing_file_depth": 0,
586
- "drv": "qcow2",
587
+ "drv": "IMGFMT",
588
"iops": 0,
589
"bps_wr": 0,
590
"write_threshold": 0,
591
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
592
"direct": false,
593
"writeback": true
594
},
595
- "file": "TEST_DIR/t.qcow2.base",
596
+ "file": "TEST_DIR/t.IMGFMT.base",
597
"encryption_key_missing": false
598
},
599
{
600
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
601
"detect_zeroes": "off",
602
"image": {
603
"virtual-size": 393216,
604
- "filename": "TEST_DIR/t.qcow2.base",
605
+ "filename": "TEST_DIR/t.IMGFMT.base",
606
"format": "file",
607
"actual-size": SIZE,
608
"dirty-flag": false
609
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
610
"direct": false,
611
"writeback": true
612
},
613
- "file": "TEST_DIR/t.qcow2.base",
614
+ "file": "TEST_DIR/t.IMGFMT.base",
615
"encryption_key_missing": false
616
},
617
{
618
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
619
"image": {
620
"backing-image": {
621
"virtual-size": 67108864,
622
- "filename": "TEST_DIR/t.qcow2.base",
623
+ "filename": "TEST_DIR/t.IMGFMT.base",
624
"cluster-size": 65536,
625
- "format": "qcow2",
626
+ "format": "IMGFMT",
627
"actual-size": SIZE,
628
- "format-specific": {
629
- "type": "qcow2",
630
- "data": {
631
- "compat": "1.1",
632
- "lazy-refcounts": false,
633
- "refcount-bits": 16,
634
- "corrupt": false
635
- }
636
- },
637
"dirty-flag": false
638
},
639
- "backing-filename-format": "qcow2",
640
+ "backing-filename-format": "IMGFMT",
641
"virtual-size": 67108864,
642
- "filename": "TEST_DIR/t.qcow2",
643
+ "filename": "TEST_DIR/t.IMGFMT",
644
"cluster-size": 65536,
645
- "format": "qcow2",
646
+ "format": "IMGFMT",
647
"actual-size": SIZE,
648
- "format-specific": {
649
- "type": "qcow2",
650
- "data": {
651
- "compat": "1.1",
652
- "lazy-refcounts": false,
653
- "refcount-bits": 16,
654
- "corrupt": false
655
- }
656
- },
657
- "full-backing-filename": "TEST_DIR/t.qcow2.base",
658
- "backing-filename": "TEST_DIR/t.qcow2.base",
659
+ "full-backing-filename": "TEST_DIR/t.IMGFMT.base",
660
+ "backing-filename": "TEST_DIR/t.IMGFMT.base",
661
"dirty-flag": false
662
},
663
"iops_wr": 0,
664
"ro": false,
665
"node-name": "top",
666
"backing_file_depth": 1,
667
- "drv": "qcow2",
668
+ "drv": "IMGFMT",
669
"iops": 0,
670
"bps_wr": 0,
671
"write_threshold": 0,
672
- "backing_file": "TEST_DIR/t.qcow2.base",
673
+ "backing_file": "TEST_DIR/t.IMGFMT.base",
674
"encrypted": false,
675
"bps": 0,
676
"bps_rd": 0,
677
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
678
"direct": false,
679
"writeback": true
680
},
681
- "file": "TEST_DIR/t.qcow2",
682
+ "file": "TEST_DIR/t.IMGFMT",
683
"encryption_key_missing": false
684
},
685
{
686
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
687
"detect_zeroes": "off",
688
"image": {
689
"virtual-size": 197120,
690
- "filename": "TEST_DIR/t.qcow2",
691
+ "filename": "TEST_DIR/t.IMGFMT",
692
"format": "file",
693
"actual-size": SIZE,
694
"dirty-flag": false
695
@@ -XXX,XX +XXX,XX @@ wrote 65536/65536 bytes at offset 1048576
696
"direct": false,
697
"writeback": true
698
},
699
- "file": "TEST_DIR/t.qcow2",
700
+ "file": "TEST_DIR/t.IMGFMT",
701
"encryption_key_missing": false
702
}
703
]
704
--
705
2.13.6
706
707
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
There is a bit of image-specific information which depends on the qcow2
4
compat level. Filter it so that 198 works with compat=0.10 (and any
5
refcount_bits value).
6
7
Note that we cannot simply drop the --format-specific switch because we
8
do need the "encrypt" information.
9
10
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
Message-id: 20171123020832.8165-18-mreitz@redhat.com
12
Reviewed-by: John Snow <jsnow@redhat.com>
13
Signed-off-by: Max Reitz <mreitz@redhat.com>
14
---
15
tests/qemu-iotests/198 | 6 ++++--
16
tests/qemu-iotests/198.out | 8 --------
17
2 files changed, 4 insertions(+), 10 deletions(-)
18
19
diff --git a/tests/qemu-iotests/198 b/tests/qemu-iotests/198
20
index XXXXXXX..XXXXXXX 100755
21
--- a/tests/qemu-iotests/198
22
+++ b/tests/qemu-iotests/198
23
@@ -XXX,XX +XXX,XX @@ $QEMU_IO --object $SECRET0 --object $SECRET1 -c "read -P 0x9 0 $size" --image-op
24
echo
25
echo "== checking image base =="
26
$QEMU_IMG info --image-opts $IMGSPECBASE | _filter_img_info --format-specific \
27
- | sed -e "/^disk size:/ D"
28
+ | sed -e "/^disk size:/ D" -e '/refcount bits:/ D' -e '/compat:/ D' \
29
+ -e '/lazy refcounts:/ D' -e '/corrupt:/ D'
30
31
echo
32
echo "== checking image layer =="
33
$QEMU_IMG info --image-opts $IMGSPECLAYER | _filter_img_info --format-specific \
34
- | sed -e "/^disk size:/ D"
35
+ | sed -e "/^disk size:/ D" -e '/refcount bits:/ D' -e '/compat:/ D' \
36
+ -e '/lazy refcounts:/ D' -e '/corrupt:/ D'
37
38
39
# success, all done
40
diff --git a/tests/qemu-iotests/198.out b/tests/qemu-iotests/198.out
41
index XXXXXXX..XXXXXXX 100644
42
--- a/tests/qemu-iotests/198.out
43
+++ b/tests/qemu-iotests/198.out
44
@@ -XXX,XX +XXX,XX @@ image: json:{"encrypt.key-secret": "sec0", "driver": "IMGFMT", "file": {"driver"
45
file format: IMGFMT
46
virtual size: 16M (16777216 bytes)
47
Format specific information:
48
- compat: 1.1
49
- lazy refcounts: false
50
- refcount bits: 16
51
encrypt:
52
ivgen alg: plain64
53
hash alg: sha256
54
@@ -XXX,XX +XXX,XX @@ Format specific information:
55
key offset: 1810432
56
payload offset: 2068480
57
master key iters: 1024
58
- corrupt: false
59
60
== checking image layer ==
61
image: json:{"encrypt.key-secret": "sec1", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}}
62
@@ -XXX,XX +XXX,XX @@ file format: IMGFMT
63
virtual size: 16M (16777216 bytes)
64
backing file: TEST_DIR/t.IMGFMT.base
65
Format specific information:
66
- compat: 1.1
67
- lazy refcounts: false
68
- refcount bits: 16
69
encrypt:
70
ivgen alg: plain64
71
hash alg: sha256
72
@@ -XXX,XX +XXX,XX @@ Format specific information:
73
key offset: 1810432
74
payload offset: 2068480
75
master key iters: 1024
76
- corrupt: false
77
*** done
78
--
79
2.13.6
80
81
diff view generated by jsdifflib