diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-12-31 23:26:46 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-12-31 23:26:46 +0000 |
commit | 26f6b15e2636eb20cb6757093170341b22fe6fbc (patch) | |
tree | 147896371dd546414557fdbed8f35b622ee4aae2 /tests | |
parent | c7e48f91653d6ace9dc42ec6b5b627b57d5d49e0 (diff) | |
parent | 0e72078128229bf9efb542e396ab44bf91b91340 (diff) | |
download | qemu-26f6b15e2636eb20cb6757093170341b22fe6fbc.zip qemu-26f6b15e2636eb20cb6757093170341b22fe6fbc.tar.gz qemu-26f6b15e2636eb20cb6757093170341b22fe6fbc.tar.bz2 |
Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2020-12-18' into staging
Block patches:
- New block filter: preallocate (which, on writes beyond an image file's
end, allocates big chunks of data so that such post-EOF writes will
occur less frequently)
- write-zeroes and block-status support for Quorum
- Implementation of truncate for the nvme block driver similarly to the
existing implementations for host block devices and iscsi devices
- Block layer refactoring: Drop the tighten_restrictions concept in the
block permission functions
- iotest fixes
# gpg: Signature made Fri 18 Dec 2020 14:45:30 GMT
# gpg: using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40
# gpg: issuer "mreitz@redhat.com"
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full]
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1 1829 F407 DB00 61D5 CF40
* remotes/maxreitz/tags/pull-block-2020-12-18: (30 commits)
iotests: Fix _send_qemu_cmd with bash 5.1
iotests/102: Pass $QEMU_HANDLE to _send_qemu_cmd
block/nvme: Implement fake truncate() coroutine
quorum: Implement bdrv_co_pwrite_zeroes()
quorum: Implement bdrv_co_block_status()
scripts/simplebench: add bench_prealloc.py
simplebench/results_to_text: make executable
simplebench/results_to_text: add difference line to the table
simplebench/results_to_text: improve view of the table
simplebench: move results_to_text() into separate file
simplebench: rename ascii() to results_to_text()
scripts/simplebench: use standard deviation for +- error
scripts/simplebench: support iops
scripts/simplebench: fix grammar: s/successed/succeeded/
iotests: add 298 to test new preallocate filter driver
iotests.py: execute_setup_common(): add required_fmts argument
iotests: qemu_io_silent: support --image-opts
qemu-io: add preallocate mode parameter for truncate command
block: introduce preallocate filter
block: bdrv_check_perm(): process children anyway
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
31 files changed, 1169 insertions, 201 deletions
diff --git a/tests/qemu-iotests/085.out b/tests/qemu-iotests/085.out index 7fc44b1..32a193f 100644 --- a/tests/qemu-iotests/085.out +++ b/tests/qemu-iotests/085.out @@ -12,56 +12,135 @@ Formatting 'TEST_DIR/t.IMGFMT.2', fmt=IMGFMT size=134217728 === Create a single snapshot on virtio0 === -{ 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'virtio0', 'snapshot-file':'TEST_DIR/1-snapshot-v0.IMGFMT', 'format': 'IMGFMT' } } +{ 'execute': 'blockdev-snapshot-sync', + 'arguments': { 'device': 'virtio0', + 'snapshot-file':'TEST_DIR/1-snapshot-v0.IMGFMT', + 'format': 'IMGFMT' } } Formatting 'TEST_DIR/1-snapshot-v0.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/t.qcow2.1 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} === Invalid command - missing device and nodename === -{ 'execute': 'blockdev-snapshot-sync', 'arguments': { 'snapshot-file':'TEST_DIR/1-snapshot-v0.IMGFMT', 'format': 'IMGFMT' } } +{ 'execute': 'blockdev-snapshot-sync', + 'arguments': { 'snapshot-file':'TEST_DIR/1-snapshot-v0.IMGFMT', + 'format': 'IMGFMT' } } {"error": {"class": "GenericError", "desc": "Cannot find device= nor node_name="}} === Invalid command - missing snapshot-file === -{ 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'virtio0', 'format': 'IMGFMT' } } +{ 'execute': 'blockdev-snapshot-sync', + 'arguments': { 'device': 'virtio0', + 'format': 'IMGFMT' } } {"error": {"class": "GenericError", "desc": "Parameter 'snapshot-file' is missing"}} === Create several transactional group snapshots === -{ 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/2-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/2-snapshot-v1.IMGFMT' } } ] } } +{ 'execute': 'transaction', 'arguments': + {'actions': [ + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio0', + 'snapshot-file': 'TEST_DIR/2-snapshot-v0.IMGFMT' } }, + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio1', + 'snapshot-file': 'TEST_DIR/2-snapshot-v1.IMGFMT' } } ] + } } Formatting 'TEST_DIR/2-snapshot-v0.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/1-snapshot-v0.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 Formatting 'TEST_DIR/2-snapshot-v1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/t.qcow2.2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} -{ 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/3-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/3-snapshot-v1.IMGFMT' } } ] } } +{ 'execute': 'transaction', 'arguments': + {'actions': [ + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio0', + 'snapshot-file': 'TEST_DIR/3-snapshot-v0.IMGFMT' } }, + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio1', + 'snapshot-file': 'TEST_DIR/3-snapshot-v1.IMGFMT' } } ] + } } Formatting 'TEST_DIR/3-snapshot-v0.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/2-snapshot-v0.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 Formatting 'TEST_DIR/3-snapshot-v1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/2-snapshot-v1.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} -{ 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/4-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/4-snapshot-v1.IMGFMT' } } ] } } +{ 'execute': 'transaction', 'arguments': + {'actions': [ + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio0', + 'snapshot-file': 'TEST_DIR/4-snapshot-v0.IMGFMT' } }, + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio1', + 'snapshot-file': 'TEST_DIR/4-snapshot-v1.IMGFMT' } } ] + } } Formatting 'TEST_DIR/4-snapshot-v0.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/3-snapshot-v0.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 Formatting 'TEST_DIR/4-snapshot-v1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/3-snapshot-v1.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} -{ 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/5-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/5-snapshot-v1.IMGFMT' } } ] } } +{ 'execute': 'transaction', 'arguments': + {'actions': [ + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio0', + 'snapshot-file': 'TEST_DIR/5-snapshot-v0.IMGFMT' } }, + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio1', + 'snapshot-file': 'TEST_DIR/5-snapshot-v1.IMGFMT' } } ] + } } Formatting 'TEST_DIR/5-snapshot-v0.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/4-snapshot-v0.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 Formatting 'TEST_DIR/5-snapshot-v1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/4-snapshot-v1.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} -{ 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/6-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/6-snapshot-v1.IMGFMT' } } ] } } +{ 'execute': 'transaction', 'arguments': + {'actions': [ + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio0', + 'snapshot-file': 'TEST_DIR/6-snapshot-v0.IMGFMT' } }, + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio1', + 'snapshot-file': 'TEST_DIR/6-snapshot-v1.IMGFMT' } } ] + } } Formatting 'TEST_DIR/6-snapshot-v0.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/5-snapshot-v0.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 Formatting 'TEST_DIR/6-snapshot-v1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/5-snapshot-v1.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} -{ 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/7-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/7-snapshot-v1.IMGFMT' } } ] } } +{ 'execute': 'transaction', 'arguments': + {'actions': [ + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio0', + 'snapshot-file': 'TEST_DIR/7-snapshot-v0.IMGFMT' } }, + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio1', + 'snapshot-file': 'TEST_DIR/7-snapshot-v1.IMGFMT' } } ] + } } Formatting 'TEST_DIR/7-snapshot-v0.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/6-snapshot-v0.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 Formatting 'TEST_DIR/7-snapshot-v1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/6-snapshot-v1.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} -{ 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/8-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/8-snapshot-v1.IMGFMT' } } ] } } +{ 'execute': 'transaction', 'arguments': + {'actions': [ + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio0', + 'snapshot-file': 'TEST_DIR/8-snapshot-v0.IMGFMT' } }, + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio1', + 'snapshot-file': 'TEST_DIR/8-snapshot-v1.IMGFMT' } } ] + } } Formatting 'TEST_DIR/8-snapshot-v0.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/7-snapshot-v0.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 Formatting 'TEST_DIR/8-snapshot-v1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/7-snapshot-v1.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} -{ 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/9-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/9-snapshot-v1.IMGFMT' } } ] } } +{ 'execute': 'transaction', 'arguments': + {'actions': [ + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio0', + 'snapshot-file': 'TEST_DIR/9-snapshot-v0.IMGFMT' } }, + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio1', + 'snapshot-file': 'TEST_DIR/9-snapshot-v1.IMGFMT' } } ] + } } Formatting 'TEST_DIR/9-snapshot-v0.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/8-snapshot-v0.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 Formatting 'TEST_DIR/9-snapshot-v1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/8-snapshot-v1.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} -{ 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR/10-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/10-snapshot-v1.IMGFMT' } } ] } } +{ 'execute': 'transaction', 'arguments': + {'actions': [ + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio0', + 'snapshot-file': 'TEST_DIR/10-snapshot-v0.IMGFMT' } }, + { 'type': 'blockdev-snapshot-sync', 'data' : + { 'device': 'virtio1', + 'snapshot-file': 'TEST_DIR/10-snapshot-v1.IMGFMT' } } ] + } } Formatting 'TEST_DIR/10-snapshot-v0.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/9-snapshot-v0.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 Formatting 'TEST_DIR/10-snapshot-v1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=134217728 backing_file=TEST_DIR/9-snapshot-v1.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} @@ -69,48 +148,84 @@ Formatting 'TEST_DIR/10-snapshot-v1.qcow2', fmt=qcow2 cluster_size=65536 extende === Create a couple of snapshots using blockdev-snapshot === Formatting 'TEST_DIR/11-snapshot-v0.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/10-snapshot-v0.IMGFMT backing_fmt=IMGFMT -{ 'execute': 'blockdev-add', 'arguments': { 'driver': 'IMGFMT', 'node-name': 'snap_11', 'backing': null, 'file': { 'driver': 'file', 'filename': 'TEST_DIR/11-snapshot-v0.IMGFMT', 'node-name': 'file_11' } } } +{ 'execute': 'blockdev-add', 'arguments': + { 'driver': 'IMGFMT', 'node-name': 'snap_11', 'backing': null, + 'file': + { 'driver': 'file', 'filename': 'TEST_DIR/11-snapshot-v0.IMGFMT', + 'node-name': 'file_11' } } } {"return": {}} -{ 'execute': 'blockdev-snapshot', 'arguments': { 'node': 'virtio0', 'overlay':'snap_11' } } +{ 'execute': 'blockdev-snapshot', + 'arguments': { 'node': 'virtio0', + 'overlay':'snap_11' } } {"return": {}} Formatting 'TEST_DIR/12-snapshot-v0.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/11-snapshot-v0.IMGFMT backing_fmt=IMGFMT -{ 'execute': 'blockdev-add', 'arguments': { 'driver': 'IMGFMT', 'node-name': 'snap_12', 'backing': null, 'file': { 'driver': 'file', 'filename': 'TEST_DIR/12-snapshot-v0.IMGFMT', 'node-name': 'file_12' } } } +{ 'execute': 'blockdev-add', 'arguments': + { 'driver': 'IMGFMT', 'node-name': 'snap_12', 'backing': null, + 'file': + { 'driver': 'file', 'filename': 'TEST_DIR/12-snapshot-v0.IMGFMT', + 'node-name': 'file_12' } } } {"return": {}} -{ 'execute': 'blockdev-snapshot', 'arguments': { 'node': 'virtio0', 'overlay':'snap_12' } } +{ 'execute': 'blockdev-snapshot', + 'arguments': { 'node': 'virtio0', + 'overlay':'snap_12' } } {"return": {}} === Invalid command - cannot create a snapshot using a file BDS === -{ 'execute': 'blockdev-snapshot', 'arguments': { 'node':'virtio0', 'overlay':'file_12' } } +{ 'execute': 'blockdev-snapshot', + 'arguments': { 'node':'virtio0', + 'overlay':'file_12' } + } {"error": {"class": "GenericError", "desc": "The overlay is already in use"}} === Invalid command - snapshot node used as active layer === -{ 'execute': 'blockdev-snapshot', 'arguments': { 'node': 'virtio0', 'overlay':'snap_12' } } +{ 'execute': 'blockdev-snapshot', + 'arguments': { 'node': 'virtio0', + 'overlay':'snap_12' } } {"error": {"class": "GenericError", "desc": "The overlay is already in use"}} -{ 'execute': 'blockdev-snapshot', 'arguments': { 'node':'virtio0', 'overlay':'virtio0' } } +{ 'execute': 'blockdev-snapshot', + 'arguments': { 'node':'virtio0', + 'overlay':'virtio0' } + } {"error": {"class": "GenericError", "desc": "The overlay is already in use"}} -{ 'execute': 'blockdev-snapshot', 'arguments': { 'node':'virtio0', 'overlay':'virtio1' } } +{ 'execute': 'blockdev-snapshot', + 'arguments': { 'node':'virtio0', + 'overlay':'virtio1' } + } {"error": {"class": "GenericError", "desc": "The overlay is already in use"}} === Invalid command - snapshot node used as backing hd === -{ 'execute': 'blockdev-snapshot', 'arguments': { 'node': 'virtio0', 'overlay':'snap_11' } } +{ 'execute': 'blockdev-snapshot', + 'arguments': { 'node': 'virtio0', + 'overlay':'snap_11' } } {"error": {"class": "GenericError", "desc": "The overlay is already in use"}} === Invalid command - snapshot node has a backing image === Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT -{ 'execute': 'blockdev-add', 'arguments': { 'driver': 'IMGFMT', 'node-name': 'snap_13', 'file': { 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT', 'node-name': 'file_13' } } } -{"return": {}} -{ 'execute': 'blockdev-snapshot', 'arguments': { 'node': 'virtio0', 'overlay':'snap_13' } } +{ 'execute': 'blockdev-add', 'arguments': + { 'driver': 'IMGFMT', 'node-name': 'snap_13', + 'file': + { 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT', + 'node-name': 'file_13' } } } +{"return": {}} +{ 'execute': 'blockdev-snapshot', + 'arguments': { 'node': 'virtio0', + 'overlay':'snap_13' } } {"error": {"class": "GenericError", "desc": "The overlay already has a backing image"}} === Invalid command - The node does not exist === -{ 'execute': 'blockdev-snapshot', 'arguments': { 'node': 'virtio0', 'overlay':'snap_14' } } +{ 'execute': 'blockdev-snapshot', + 'arguments': { 'node': 'virtio0', + 'overlay':'snap_14' } } {"error": {"class": "GenericError", "desc": "Cannot find device=snap_14 nor node_name=snap_14"}} -{ 'execute': 'blockdev-snapshot', 'arguments': { 'node':'nodevice', 'overlay':'snap_13' } } +{ 'execute': 'blockdev-snapshot', + 'arguments': { 'node':'nodevice', + 'overlay':'snap_13' } + } {"error": {"class": "GenericError", "desc": "Cannot find device=nodevice nor node_name=nodevice"}} *** done diff --git a/tests/qemu-iotests/094.out b/tests/qemu-iotests/094.out index 9b6c57b..97f894c 100644 --- a/tests/qemu-iotests/094.out +++ b/tests/qemu-iotests/094.out @@ -3,13 +3,19 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 Formatting 'TEST_DIR/source.IMGFMT', fmt=IMGFMT size=67108864 {'execute': 'qmp_capabilities'} {"return": {}} -{'execute': 'drive-mirror', 'arguments': {'device': 'src', 'target': 'nbd+unix:///?socket=SOCK_DIR/nbd', 'format': 'nbd', 'sync':'full', 'mode':'existing'}} +{'execute': 'drive-mirror', + 'arguments': {'device': 'src', + 'target': 'nbd+unix:///?socket=SOCK_DIR/nbd', + 'format': 'nbd', + 'sync':'full', + 'mode':'existing'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 67108864, "offset": 67108864, "speed": 0, "type": "mirror"}} -{'execute': 'block-job-complete', 'arguments': {'device': 'src'}} +{'execute': 'block-job-complete', + 'arguments': {'device': 'src'}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}} diff --git a/tests/qemu-iotests/095.out b/tests/qemu-iotests/095.out index e66ced5..8257c5e 100644 --- a/tests/qemu-iotests/095.out +++ b/tests/qemu-iotests/095.out @@ -12,7 +12,9 @@ virtual size: 5 MiB (5242880 bytes) { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'block-commit', 'arguments': { 'device': 'test', 'top': 'TEST_DIR/t.IMGFMT.snp1' } } +{ 'execute': 'block-commit', + 'arguments': { 'device': 'test', + 'top': 'TEST_DIR/t.IMGFMT.snp1' } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "test"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "test"}} {"return": {}} diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102 index 2cc3efd..9d747c7 100755 --- a/tests/qemu-iotests/102 +++ b/tests/qemu-iotests/102 @@ -68,7 +68,7 @@ $QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io qemu_comm_method=monitor _launch_qemu -drive if=none,file="$TEST_IMG",id=drv0 # Wait for a prompt to appear (so we know qemu has opened the image) -_send_qemu_cmd '' '(qemu)' +_send_qemu_cmd $QEMU_HANDLE '' '(qemu)' $QEMU_IMG resize --shrink --image-opts \ "driver=raw,file.driver=file,file.filename=$TEST_IMG,file.locking=off" \ diff --git a/tests/qemu-iotests/102.out b/tests/qemu-iotests/102.out index cd2fdc7..320ed5a 100644 --- a/tests/qemu-iotests/102.out +++ b/tests/qemu-iotests/102.out @@ -16,8 +16,8 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) QEMU X.Y.Z monitor - type 'help' for more information -Image resized. (qemu) +Image resized. (qemu) qemu-io drv0 map 64 KiB (0x10000) bytes allocated at offset 0 bytes (0x0) *** done diff --git a/tests/qemu-iotests/109.out b/tests/qemu-iotests/109.out index ad739df..6e73406 100644 --- a/tests/qemu-iotests/109.out +++ b/tests/qemu-iotests/109.out @@ -6,7 +6,9 @@ Formatting 'TEST_DIR/t.raw.src', fmt=IMGFMT size=67108864 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=SIZE { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', + 'mode': 'existing', 'sync': 'full'}} WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. @@ -27,7 +29,9 @@ read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', + 'mode': 'existing', 'sync': 'full'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} @@ -51,7 +55,9 @@ Formatting 'TEST_DIR/t.raw.src', fmt=IMGFMT size=67108864 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=SIZE { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', + 'mode': 'existing', 'sync': 'full'}} WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. @@ -72,7 +78,9 @@ read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', + 'mode': 'existing', 'sync': 'full'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} @@ -96,7 +104,9 @@ Formatting 'TEST_DIR/t.raw.src', fmt=IMGFMT size=67108864 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=SIZE { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', + 'mode': 'existing', 'sync': 'full'}} WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. @@ -117,7 +127,9 @@ read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', + 'mode': 'existing', 'sync': 'full'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} @@ -141,7 +153,9 @@ Formatting 'TEST_DIR/t.raw.src', fmt=IMGFMT size=67108864 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=SIZE { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', + 'mode': 'existing', 'sync': 'full'}} WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. @@ -162,7 +176,9 @@ read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', + 'mode': 'existing', 'sync': 'full'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} @@ -186,7 +202,9 @@ Formatting 'TEST_DIR/t.raw.src', fmt=IMGFMT size=67108864 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=SIZE { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', + 'mode': 'existing', 'sync': 'full'}} WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. @@ -207,7 +225,9 @@ read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', + 'mode': 'existing', 'sync': 'full'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} @@ -231,7 +251,9 @@ Formatting 'TEST_DIR/t.raw.src', fmt=IMGFMT size=67108864 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=SIZE { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', + 'mode': 'existing', 'sync': 'full'}} WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. @@ -252,7 +274,9 @@ read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', + 'mode': 'existing', 'sync': 'full'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} @@ -275,7 +299,9 @@ Images are identical. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=SIZE { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', + 'mode': 'existing', 'sync': 'full'}} WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. @@ -296,7 +322,9 @@ read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', + 'mode': 'existing', 'sync': 'full'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} @@ -319,7 +347,9 @@ Images are identical. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=SIZE { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', + 'mode': 'existing', 'sync': 'full'}} WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. @@ -340,7 +370,9 @@ read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', + 'mode': 'existing', 'sync': 'full'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} @@ -363,7 +395,9 @@ Images are identical. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=SIZE { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', + 'mode': 'existing', 'sync': 'full'}} WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. @@ -384,7 +418,9 @@ read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', + 'mode': 'existing', 'sync': 'full'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} @@ -407,7 +443,9 @@ Images are identical. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=SIZE { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', + 'mode': 'existing', 'sync': 'full'}} WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. @@ -428,7 +466,9 @@ read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', + 'mode': 'existing', 'sync': 'full'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} @@ -451,7 +491,9 @@ Images are identical. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=SIZE { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', + 'mode': 'existing', 'sync': 'full'}} WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. @@ -473,7 +515,9 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed Images are identical. { 'execute': 'qmp_capabilities' } {"return": {}} -{'execute':'drive-mirror', 'arguments':{ 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'existing', 'sync': 'full'}} +{'execute':'drive-mirror', 'arguments':{ + 'device': 'src', 'target': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', + 'mode': 'existing', 'sync': 'full'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "src"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "src"}} {"return": {}} diff --git a/tests/qemu-iotests/117.out b/tests/qemu-iotests/117.out index bb623dc..735ffd2 100644 --- a/tests/qemu-iotests/117.out +++ b/tests/qemu-iotests/117.out @@ -2,11 +2,18 @@ QA output created by 117 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536 { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'blockdev-add', 'arguments': { 'node-name': 'protocol', 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT' } } +{ 'execute': 'blockdev-add', + 'arguments': { 'node-name': 'protocol', + 'driver': 'file', + 'filename': 'TEST_DIR/t.IMGFMT' } } {"return": {}} -{ 'execute': 'blockdev-add', 'arguments': { 'node-name': 'format', 'driver': 'IMGFMT', 'file': 'protocol' } } +{ 'execute': 'blockdev-add', + 'arguments': { 'node-name': 'format', + 'driver': 'IMGFMT', + 'file': 'protocol' } } {"return": {}} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io format "write -P 42 0 64k"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': 'qemu-io format "write -P 42 0 64k"' } } wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} diff --git a/tests/qemu-iotests/127.out b/tests/qemu-iotests/127.out index efd6cb3..1685c48 100644 --- a/tests/qemu-iotests/127.out +++ b/tests/qemu-iotests/127.out @@ -6,13 +6,21 @@ wrote 42/42 bytes at offset 0 42 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'drive-mirror', 'arguments': { 'job-id': 'mirror', 'device': 'source', 'target': 'TEST_DIR/t.IMGFMT.overlay1', 'mode': 'existing', 'sync': 'top' } } +{ 'execute': 'drive-mirror', + 'arguments': { + 'job-id': 'mirror', + 'device': 'source', + 'target': 'TEST_DIR/t.IMGFMT.overlay1', + 'mode': 'existing', + 'sync': 'top' + } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "mirror"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "mirror"}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "mirror"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "mirror", "len": 65536, "offset": 65536, "speed": 0, "type": "mirror"}} -{ 'execute': 'block-job-complete', 'arguments': { 'device': 'mirror' } } +{ 'execute': 'block-job-complete', + 'arguments': { 'device': 'mirror' } } {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "mirror"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "mirror"}} diff --git a/tests/qemu-iotests/140.out b/tests/qemu-iotests/140.out index 62d9c3a..312f76d 100644 --- a/tests/qemu-iotests/140.out +++ b/tests/qemu-iotests/140.out @@ -4,13 +4,17 @@ wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'nbd-server-start', 'arguments': { 'addr': { 'type': 'unix', 'data': { 'path': 'SOCK_DIR/nbd' }}}} +{ 'execute': 'nbd-server-start', + 'arguments': { 'addr': { 'type': 'unix', + 'data': { 'path': 'SOCK_DIR/nbd' }}}} {"return": {}} -{ 'execute': 'nbd-server-add', 'arguments': { 'device': 'drv' }} +{ 'execute': 'nbd-server-add', + 'arguments': { 'device': 'drv' }} {"return": {}} read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -{ 'execute': 'eject', 'arguments': { 'device': 'drv' }} +{ 'execute': 'eject', + 'arguments': { 'device': 'drv' }} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "drv"}} qemu-io: can't open device nbd+unix:///drv?socket=SOCK_DIR/nbd: Requested export not available server reported: export 'drv' not present diff --git a/tests/qemu-iotests/141.out b/tests/qemu-iotests/141.out index 08e0aec..6d8652e 100644 --- a/tests/qemu-iotests/141.out +++ b/tests/qemu-iotests/141.out @@ -7,105 +7,173 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/m. === Testing drive-backup === -{'execute': 'blockdev-add', 'arguments': { 'node-name': 'drv0', 'driver': 'IMGFMT', 'file': { 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT' }}} -{"return": {}} -{'execute': 'drive-backup', 'arguments': {'job-id': 'job0', 'device': 'drv0', 'target': 'TEST_DIR/o.IMGFMT', 'format': 'IMGFMT', 'sync': 'none'}} +{'execute': 'blockdev-add', + 'arguments': { + 'node-name': 'drv0', + 'driver': 'IMGFMT', + 'file': { + 'driver': 'file', + 'filename': 'TEST_DIR/t.IMGFMT' + }}} +{"return": {}} +{'execute': 'drive-backup', +'arguments': {'job-id': 'job0', +'device': 'drv0', +'target': 'TEST_DIR/o.IMGFMT', +'format': 'IMGFMT', +'sync': 'none'}} Formatting 'TEST_DIR/o.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "paused", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} -{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} +{'execute': 'blockdev-del', + 'arguments': {'node-name': 'drv0'}} {"error": {"class": "GenericError", "desc": "Node 'drv0' is busy: node is used as backing hd of 'NODE_NAME'"}} -{'execute': 'block-job-cancel', 'arguments': {'device': 'job0'}} +{'execute': 'block-job-cancel', + 'arguments': {'device': 'job0'}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "job0", "len": 1048576, "offset": 0, "speed": 0, "type": "backup"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} -{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} +{'execute': 'blockdev-del', + 'arguments': {'node-name': 'drv0'}} {"return": {}} === Testing drive-mirror === -{'execute': 'blockdev-add', 'arguments': { 'node-name': 'drv0', 'driver': 'IMGFMT', 'file': { 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT' }}} -{"return": {}} -{'execute': 'drive-mirror', 'arguments': {'job-id': 'job0', 'device': 'drv0', 'target': 'TEST_DIR/o.IMGFMT', 'format': 'IMGFMT', 'sync': 'none'}} +{'execute': 'blockdev-add', + 'arguments': { + 'node-name': 'drv0', + 'driver': 'IMGFMT', + 'file': { + 'driver': 'file', + 'filename': 'TEST_DIR/t.IMGFMT' + }}} +{"return": {}} +{'execute': 'drive-mirror', +'arguments': {'job-id': 'job0', +'device': 'drv0', +'target': 'TEST_DIR/o.IMGFMT', +'format': 'IMGFMT', +'sync': 'none'}} Formatting 'TEST_DIR/o.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "mirror"}} -{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} +{'execute': 'blockdev-del', + 'arguments': {'node-name': 'drv0'}} {"error": {"class": "GenericError", "desc": "Node 'drv0' is busy: block device is in use by block job: mirror"}} -{'execute': 'block-job-cancel', 'arguments': {'device': 'job0'}} +{'execute': 'block-job-cancel', + 'arguments': {'device': 'job0'}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "mirror"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} -{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} +{'execute': 'blockdev-del', + 'arguments': {'node-name': 'drv0'}} {"return": {}} === Testing active block-commit === -{'execute': 'blockdev-add', 'arguments': { 'node-name': 'drv0', 'driver': 'IMGFMT', 'file': { 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT' }}} -{"return": {}} -{'execute': 'block-commit', 'arguments': {'job-id': 'job0', 'device': 'drv0'}} +{'execute': 'blockdev-add', + 'arguments': { + 'node-name': 'drv0', + 'driver': 'IMGFMT', + 'file': { + 'driver': 'file', + 'filename': 'TEST_DIR/t.IMGFMT' + }}} +{"return": {}} +{'execute': 'block-commit', +'arguments': {'job-id': 'job0', 'device': 'drv0'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "commit"}} -{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} +{'execute': 'blockdev-del', + 'arguments': {'node-name': 'drv0'}} {"error": {"class": "GenericError", "desc": "Node 'drv0' is busy: block device is in use by block job: commit"}} -{'execute': 'block-job-cancel', 'arguments': {'device': 'job0'}} +{'execute': 'block-job-cancel', + 'arguments': {'device': 'job0'}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "commit"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} -{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} +{'execute': 'blockdev-del', + 'arguments': {'node-name': 'drv0'}} {"return": {}} === Testing non-active block-commit === wrote 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -{'execute': 'blockdev-add', 'arguments': { 'node-name': 'drv0', 'driver': 'IMGFMT', 'file': { 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT' }}} -{"return": {}} -{'execute': 'block-commit', 'arguments': {'job-id': 'job0', 'device': 'drv0', 'top': 'TEST_DIR/m.IMGFMT', 'speed': 1}} +{'execute': 'blockdev-add', + 'arguments': { + 'node-name': 'drv0', + 'driver': 'IMGFMT', + 'file': { + 'driver': 'file', + 'filename': 'TEST_DIR/t.IMGFMT' + }}} +{"return": {}} +{'execute': 'block-commit', +'arguments': {'job-id': 'job0', +'device': 'drv0', +'top': 'TEST_DIR/m.IMGFMT', +'speed': 1}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} -{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} +{'execute': 'blockdev-del', + 'arguments': {'node-name': 'drv0'}} {"error": {"class": "GenericError", "desc": "Node drv0 is in use"}} -{'execute': 'block-job-cancel', 'arguments': {'device': 'job0'}} +{'execute': 'block-job-cancel', + 'arguments': {'device': 'job0'}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "job0", "len": 1048576, "offset": 524288, "speed": 1, "type": "commit"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} -{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} +{'execute': 'blockdev-del', + 'arguments': {'node-name': 'drv0'}} {"return": {}} === Testing block-stream === wrote 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -{'execute': 'blockdev-add', 'arguments': { 'node-name': 'drv0', 'driver': 'IMGFMT', 'file': { 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT' }}} -{"return": {}} -{'execute': 'block-stream', 'arguments': {'job-id': 'job0', 'device': 'drv0', 'speed': 1}} +{'execute': 'blockdev-add', + 'arguments': { + 'node-name': 'drv0', + 'driver': 'IMGFMT', + 'file': { + 'driver': 'file', + 'filename': 'TEST_DIR/t.IMGFMT' + }}} +{"return": {}} +{'execute': 'block-stream', +'arguments': {'job-id': 'job0', +'device': 'drv0', +'speed': 1}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} -{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} +{'execute': 'blockdev-del', + 'arguments': {'node-name': 'drv0'}} {"error": {"class": "GenericError", "desc": "Node drv0 is in use"}} -{'execute': 'block-job-cancel', 'arguments': {'device': 'job0'}} +{'execute': 'block-job-cancel', + 'arguments': {'device': 'job0'}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "job0", "len": 1048576, "offset": 524288, "speed": 1, "type": "stream"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} -{'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} +{'execute': 'blockdev-del', + 'arguments': {'node-name': 'drv0'}} {"return": {}} *** done diff --git a/tests/qemu-iotests/143.out b/tests/qemu-iotests/143.out index fc9c0a7..9ec5888 100644 --- a/tests/qemu-iotests/143.out +++ b/tests/qemu-iotests/143.out @@ -1,7 +1,9 @@ QA output created by 143 { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'nbd-server-start', 'arguments': { 'addr': { 'type': 'unix', 'data': { 'path': 'SOCK_DIR/nbd' }}}} +{ 'execute': 'nbd-server-start', + 'arguments': { 'addr': { 'type': 'unix', + 'data': { 'path': 'SOCK_DIR/nbd' }}}} {"return": {}} qemu-io: can't open device nbd+unix:///no_such_export?socket=SOCK_DIR/nbd: Requested export not available server reported: export 'no_such_export' not present diff --git a/tests/qemu-iotests/144.out b/tests/qemu-iotests/144.out index 13e0c4f..b3b4812 100644 --- a/tests/qemu-iotests/144.out +++ b/tests/qemu-iotests/144.out @@ -8,19 +8,33 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=536870912 { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'virtio0', 'snapshot-file':'TEST_DIR/tmp.IMGFMT', 'format': 'IMGFMT' } } +{ 'execute': 'blockdev-snapshot-sync', + 'arguments': { + 'device': 'virtio0', + 'snapshot-file':'TEST_DIR/tmp.IMGFMT', + 'format': 'IMGFMT' + } + } Formatting 'TEST_DIR/tmp.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=536870912 backing_file=TEST_DIR/t.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} === Performing block-commit on active layer === -{ 'execute': 'block-commit', 'arguments': { 'device': 'virtio0' } } +{ 'execute': 'block-commit', + 'arguments': { + 'device': 'virtio0' + } + } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "virtio0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "virtio0"}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "virtio0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "virtio0", "len": 0, "offset": 0, "speed": 0, "type": "commit"}} -{ 'execute': 'block-job-complete', 'arguments': { 'device': 'virtio0' } } +{ 'execute': 'block-job-complete', + 'arguments': { + 'device': 'virtio0' + } + } {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "virtio0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "virtio0"}} @@ -30,7 +44,13 @@ Formatting 'TEST_DIR/tmp.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off co === Performing Live Snapshot 2 === -{ 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'virtio0', 'snapshot-file':'TEST_DIR/tmp2.IMGFMT', 'format': 'IMGFMT' } } +{ 'execute': 'blockdev-snapshot-sync', + 'arguments': { + 'device': 'virtio0', + 'snapshot-file':'TEST_DIR/tmp2.IMGFMT', + 'format': 'IMGFMT' + } + } Formatting 'TEST_DIR/tmp2.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=536870912 backing_file=TEST_DIR/t.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} *** done diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out index fcaa71a..ff8e558 100644 --- a/tests/qemu-iotests/153.out +++ b/tests/qemu-iotests/153.out @@ -425,7 +425,8 @@ _qemu_img_wrapper commit -b TEST_DIR/t.qcow2.b TEST_DIR/t.qcow2.c { 'execute': 'qmp_capabilities' } {"return": {}} Adding drive -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'drive_add 0 if=none,id=d0,file=TEST_DIR/t.IMGFMT' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': 'drive_add 0 if=none,id=d0,file=TEST_DIR/t.IMGFMT' } } {"return": "OKrn"} _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 @@ -435,25 +436,30 @@ Creating overlay with qemu-img when the guest is running should be allowed _qemu_img_wrapper create -f qcow2 -b TEST_DIR/t.qcow2 -F qcow2 TEST_DIR/t.qcow2.overlay == Closing an image should unlock it == -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'drive_del d0' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': 'drive_del d0' } } {"return": ""} _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 Adding two and closing one -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'drive_add 0 if=none,id=d0,file=TEST_DIR/t.IMGFMT,readonly=on' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': 'drive_add 0 if=none,id=d0,file=TEST_DIR/t.IMGFMT,readonly=on' } } {"return": "OKrn"} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'drive_add 0 if=none,id=d1,file=TEST_DIR/t.IMGFMT,readonly=on' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': 'drive_add 0 if=none,id=d1,file=TEST_DIR/t.IMGFMT,readonly=on' } } {"return": "OKrn"} _qemu_img_wrapper info TEST_DIR/t.qcow2 -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'drive_del d0' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': 'drive_del d0' } } {"return": ""} _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock Is another process using the image [TEST_DIR/t.qcow2]? Closing the other -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'drive_del d1' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': 'drive_del d1' } } {"return": ""} _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 diff --git a/tests/qemu-iotests/156.out b/tests/qemu-iotests/156.out index cce167b..4a22f0c 100644 --- a/tests/qemu-iotests/156.out +++ b/tests/qemu-iotests/156.out @@ -8,24 +8,37 @@ wrote 196608/196608 bytes at offset 65536 { 'execute': 'qmp_capabilities' } {"return": {}} Formatting 'TEST_DIR/t.IMGFMT.overlay', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT -{ 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'source', 'snapshot-file': 'TEST_DIR/t.IMGFMT.overlay', 'format': 'IMGFMT', 'mode': 'existing' } } +{ 'execute': 'blockdev-snapshot-sync', + 'arguments': { 'device': 'source', + 'snapshot-file': 'TEST_DIR/t.IMGFMT.overlay', + 'format': 'IMGFMT', + 'mode': 'existing' } } {"return": {}} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io source "write -P 3 128k 128k"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io source "write -P 3 128k 128k"' } } wrote 131072/131072 bytes at offset 131072 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} Formatting 'TEST_DIR/t.IMGFMT.target.overlay', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.target backing_fmt=IMGFMT -{ 'execute': 'drive-mirror', 'arguments': { 'device': 'source', 'target': 'TEST_DIR/t.IMGFMT.target.overlay', 'mode': 'existing', 'sync': 'top' } } +{ 'execute': 'drive-mirror', + 'arguments': { 'device': 'source', + 'target': 'TEST_DIR/t.IMGFMT.target.overlay', + 'mode': 'existing', + 'sync': 'top' } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "source"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "source"}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "source"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "source", "len": 131072, "offset": 131072, "speed": 0, "type": "mirror"}} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io source "write -P 4 192k 64k"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io source "write -P 4 192k 64k"' } } wrote 65536/65536 bytes at offset 196608 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} -{ 'execute': 'block-job-complete', 'arguments': { 'device': 'source' } } +{ 'execute': 'block-job-complete', + 'arguments': { 'device': 'source' } } {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "source"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "source"}} @@ -33,19 +46,27 @@ wrote 65536/65536 bytes at offset 196608 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "source"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "source"}} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io source "read -P 1 0k 64k"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io source "read -P 1 0k 64k"' } } read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io source "read -P 2 64k 64k"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io source "read -P 2 64k 64k"' } } read 65536/65536 bytes at offset 65536 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io source "read -P 3 128k 64k"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io source "read -P 3 128k 64k"' } } read 65536/65536 bytes at offset 131072 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io source "read -P 4 192k 64k"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io source "read -P 4 192k 64k"' } } read 65536/65536 bytes at offset 196608 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} diff --git a/tests/qemu-iotests/161.out b/tests/qemu-iotests/161.out index 3d8d89a..6cc285a 100644 --- a/tests/qemu-iotests/161.out +++ b/tests/qemu-iotests/161.out @@ -7,18 +7,23 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t. { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io none0 "reopen -o backing.detect-zeroes=on"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io none0 "reopen -o backing.detect-zeroes=on"' } } {"return": ""} *** Stream and then change an option on the backing file { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'block-stream', 'arguments': { 'device': 'none0', 'base': 'TEST_DIR/t.IMGFMT.base' } } +{ 'execute': 'block-stream', 'arguments': { 'device': 'none0', + 'base': 'TEST_DIR/t.IMGFMT.base' } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "none0"}} {"return": {}} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io none0 "reopen -o backing.detect-zeroes=on"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io none0 "reopen -o backing.detect-zeroes=on"' } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "none0", "len": 1048576, "offset": 1048576, "speed": 0, "type": "stream"}} @@ -33,11 +38,14 @@ Formatting 'TEST_DIR/t.IMGFMT.int', fmt=IMGFMT size=1048576 backing_file=TEST_DI Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t.IMGFMT.int backing_fmt=IMGFMT { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'block-commit', 'arguments': { 'device': 'none0', 'top': 'TEST_DIR/t.IMGFMT.int' } } +{ 'execute': 'block-commit', 'arguments': { 'device': 'none0', + 'top': 'TEST_DIR/t.IMGFMT.int' } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "none0"}} {"return": {}} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io none0 "reopen -o backing.detect-zeroes=on"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io none0 "reopen -o backing.detect-zeroes=on"' } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "none0", "len": 1048576, "offset": 1048576, "speed": 0, "type": "commit"}} diff --git a/tests/qemu-iotests/173.out b/tests/qemu-iotests/173.out index b5114b5..2d6490d 100644 --- a/tests/qemu-iotests/173.out +++ b/tests/qemu-iotests/173.out @@ -6,11 +6,30 @@ Formatting 'TEST_DIR/image.snp1', fmt=IMGFMT size=104857600 { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'arguments': { 'device': 'disk2', 'format': 'IMGFMT', 'mode': 'existing', 'snapshot-file': 'TEST_DIR/image.snp1', 'snapshot-node-name': 'snp1' }, 'execute': 'blockdev-snapshot-sync' } +{ 'arguments': { + 'device': 'disk2', + 'format': 'IMGFMT', + 'mode': 'existing', + 'snapshot-file': 'TEST_DIR/image.snp1', + 'snapshot-node-name': 'snp1' + }, + 'execute': 'blockdev-snapshot-sync' + } {"return": {}} -{ 'arguments': { 'backing-file': 'image.base', 'device': 'disk2', 'image-node-name': 'snp1' }, 'execute': 'change-backing-file' } +{ 'arguments': { + 'backing-file': 'image.base', + 'device': 'disk2', + 'image-node-name': 'snp1' + }, + 'execute': 'change-backing-file' + } {"return": {}} -{ 'arguments': { 'base': 'TEST_DIR/image.base', 'device': 'disk2' }, 'execute': 'block-stream' } +{ 'arguments': { + 'base': 'TEST_DIR/image.base', + 'device': 'disk2' + }, + 'execute': 'block-stream' + } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk2"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk2"}} {"return": {}} diff --git a/tests/qemu-iotests/182.out b/tests/qemu-iotests/182.out index ce23340..57f7265 100644 --- a/tests/qemu-iotests/182.out +++ b/tests/qemu-iotests/182.out @@ -10,16 +10,42 @@ Is another process using the image [TEST_DIR/t.qcow2]? {'execute': 'qmp_capabilities'} {"return": {}} -{'execute': 'blockdev-add', 'arguments': { 'node-name': 'node0', 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT', 'locking': 'on' } } -{"return": {}} -{'execute': 'blockdev-snapshot-sync', 'arguments': { 'node-name': 'node0', 'snapshot-file': 'TEST_DIR/t.IMGFMT.overlay', 'snapshot-node-name': 'node1' } } +{'execute': 'blockdev-add', + 'arguments': { + 'node-name': 'node0', + 'driver': 'file', + 'filename': 'TEST_DIR/t.IMGFMT', + 'locking': 'on' + } } +{"return": {}} +{'execute': 'blockdev-snapshot-sync', + 'arguments': { + 'node-name': 'node0', + 'snapshot-file': 'TEST_DIR/t.IMGFMT.overlay', + 'snapshot-node-name': 'node1' + } } Formatting 'TEST_DIR/t.qcow2.overlay', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=197120 backing_file=TEST_DIR/t.qcow2 backing_fmt=file lazy_refcounts=off refcount_bits=16 {"return": {}} -{'execute': 'blockdev-add', 'arguments': { 'node-name': 'node1', 'driver': 'file', 'filename': 'TEST_DIR/t.IMGFMT', 'locking': 'on' } } -{"return": {}} -{'execute': 'nbd-server-start', 'arguments': { 'addr': { 'type': 'unix', 'data': { 'path': 'SOCK_DIR/nbd.socket' } } } } -{"return": {}} -{'execute': 'nbd-server-add', 'arguments': { 'device': 'node1' } } +{'execute': 'blockdev-add', + 'arguments': { + 'node-name': 'node1', + 'driver': 'file', + 'filename': 'TEST_DIR/t.IMGFMT', + 'locking': 'on' + } } +{"return": {}} +{'execute': 'nbd-server-start', + 'arguments': { + 'addr': { + 'type': 'unix', + 'data': { + 'path': 'SOCK_DIR/nbd.socket' + } } } } +{"return": {}} +{'execute': 'nbd-server-add', + 'arguments': { + 'device': 'node1' + } } {"return": {}} === Testing failure to loosen restrictions === diff --git a/tests/qemu-iotests/183.out b/tests/qemu-iotests/183.out index d4be2cb..fd9c2e5 100644 --- a/tests/qemu-iotests/183.out +++ b/tests/qemu-iotests/183.out @@ -11,18 +11,23 @@ Formatting 'TEST_DIR/t.IMGFMT.dest', fmt=IMGFMT size=67108864 === Write something on the source === -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io disk "write -P 0x55 0 64k"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io disk "write -P 0x55 0 64k"' } } wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io disk "read -P 0x55 0 64k"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io disk "read -P 0x55 0 64k"' } } read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} === Do block migration to destination === -{ 'execute': 'migrate', 'arguments': { 'uri': 'unix:SOCK_DIR/migrate', 'blk': true } } +{ 'execute': 'migrate', + 'arguments': { 'uri': 'unix:SOCK_DIR/migrate', 'blk': true } } {"return": {}} { 'execute': 'query-status' } {"return": {"status": "postmigrate", "singlestep": false, "running": false}} @@ -32,11 +37,15 @@ read 65536/65536 bytes at offset 0 { 'execute': 'query-status' } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "RESUME"} {"return": {"status": "running", "singlestep": false, "running": true}} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io disk "read -P 0x55 0 64k"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io disk "read -P 0x55 0 64k"' } } read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io disk "write -P 0x66 1M 64k"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io disk "write -P 0x66 1M 64k"' } } wrote 65536/65536 bytes at offset 1048576 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} diff --git a/tests/qemu-iotests/185.out b/tests/qemu-iotests/185.out index 339438a..eab55d2 100644 --- a/tests/qemu-iotests/185.out +++ b/tests/qemu-iotests/185.out @@ -8,20 +8,34 @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 === Creating backing chain === -{ 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'disk', 'snapshot-file': 'TEST_DIR/t.IMGFMT.mid', 'format': 'IMGFMT', 'mode': 'absolute-paths' } } +{ 'execute': 'blockdev-snapshot-sync', + 'arguments': { 'device': 'disk', + 'snapshot-file': 'TEST_DIR/t.IMGFMT.mid', + 'format': 'IMGFMT', + 'mode': 'absolute-paths' } } Formatting 'TEST_DIR/t.qcow2.mid', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 backing_file=TEST_DIR/t.qcow2.base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} -{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu-io disk "write 0 4M"' } } +{ 'execute': 'human-monitor-command', + 'arguments': { 'command-line': + 'qemu-io disk "write 0 4M"' } } wrote 4194304/4194304 bytes at offset 0 4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} -{ 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'disk', 'snapshot-file': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'absolute-paths' } } +{ 'execute': 'blockdev-snapshot-sync', + 'arguments': { 'device': 'disk', + 'snapshot-file': 'TEST_DIR/t.IMGFMT', + 'format': 'IMGFMT', + 'mode': 'absolute-paths' } } Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 backing_file=TEST_DIR/t.qcow2.mid backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} === Start commit job and exit qemu === -{ 'execute': 'block-commit', 'arguments': { 'device': 'disk', 'base':'TEST_DIR/t.IMGFMT.base', 'top': 'TEST_DIR/t.IMGFMT.mid', 'speed': 65536 } } +{ 'execute': 'block-commit', + 'arguments': { 'device': 'disk', + 'base':'TEST_DIR/t.IMGFMT.base', + 'top': 'TEST_DIR/t.IMGFMT.mid', + 'speed': 65536 } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}} {"return": {}} @@ -34,7 +48,10 @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off comp { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'block-commit', 'arguments': { 'device': 'disk', 'base':'TEST_DIR/t.IMGFMT.base', 'speed': 65536 } } +{ 'execute': 'block-commit', + 'arguments': { 'device': 'disk', + 'base':'TEST_DIR/t.IMGFMT.base', + 'speed': 65536 } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}} {"return": {}} @@ -47,7 +64,12 @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off comp { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'drive-mirror', 'arguments': { 'device': 'disk', 'target': 'TEST_DIR/t.IMGFMT.copy', 'format': 'IMGFMT', 'sync': 'full', 'speed': 65536 } } +{ 'execute': 'drive-mirror', + 'arguments': { 'device': 'disk', + 'target': 'TEST_DIR/t.IMGFMT.copy', + 'format': 'IMGFMT', + 'sync': 'full', + 'speed': 65536 } } Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}} @@ -61,7 +83,12 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 cluster_size=65536 extended_l2=off { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'drive-backup', 'arguments': { 'device': 'disk', 'target': 'TEST_DIR/t.IMGFMT.copy', 'format': 'IMGFMT', 'sync': 'full', 'speed': 65536 } } +{ 'execute': 'drive-backup', + 'arguments': { 'device': 'disk', + 'target': 'TEST_DIR/t.IMGFMT.copy', + 'format': 'IMGFMT', + 'sync': 'full', + 'speed': 65536 } } Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}} @@ -77,7 +104,9 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 cluster_size=65536 extended_l2=off { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'block-stream', 'arguments': { 'device': 'disk', 'speed': 65536 } } +{ 'execute': 'block-stream', + 'arguments': { 'device': 'disk', + 'speed': 65536 } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}} {"return": {}} diff --git a/tests/qemu-iotests/191.out b/tests/qemu-iotests/191.out index 11aaf3b..022021e 100644 --- a/tests/qemu-iotests/191.out +++ b/tests/qemu-iotests/191.out @@ -16,7 +16,11 @@ wrote 65536/65536 bytes at offset 1048576 === Perform commit job === -{ 'execute': 'block-commit', 'arguments': { 'job-id': 'commit0', 'device': 'top', 'base':'TEST_DIR/t.IMGFMT.base', 'top': 'TEST_DIR/t.IMGFMT.mid' } } +{ 'execute': 'block-commit', + 'arguments': { 'job-id': 'commit0', + 'device': 'top', + 'base':'TEST_DIR/t.IMGFMT.base', + 'top': 'TEST_DIR/t.IMGFMT.mid' } } { "timestamp": { "seconds": TIMESTAMP, @@ -427,7 +431,11 @@ wrote 65536/65536 bytes at offset 1048576 === Perform commit job === -{ 'execute': 'block-commit', 'arguments': { 'job-id': 'commit0', 'device': 'top', 'base':'TEST_DIR/t.IMGFMT.base', 'top': 'TEST_DIR/t.IMGFMT.mid' } } +{ 'execute': 'block-commit', + 'arguments': { 'job-id': 'commit0', + 'device': 'top', + 'base':'TEST_DIR/t.IMGFMT.base', + 'top': 'TEST_DIR/t.IMGFMT.mid' } } { "timestamp": { "seconds": TIMESTAMP, diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out index f6eac23..bbc8528 100644 --- a/tests/qemu-iotests/223.out +++ b/tests/qemu-iotests/223.out @@ -26,31 +26,48 @@ wrote 2097152/2097152 bytes at offset 2097152 {"execute":"qmp_capabilities"} {"return": {}} -{"execute":"blockdev-add", "arguments":{"driver":"IMGFMT", "node-name":"n", "file":{"driver":"file", "filename":"TEST_DIR/t.IMGFMT"}}} +{"execute":"blockdev-add", + "arguments":{"driver":"IMGFMT", "node-name":"n", + "file":{"driver":"file", "filename":"TEST_DIR/t.IMGFMT"}}} {"return": {}} -{"execute":"block-dirty-bitmap-disable", "arguments":{"node":"n", "name":"b"}} +{"execute":"block-dirty-bitmap-disable", + "arguments":{"node":"n", "name":"b"}} {"return": {}} === Set up NBD with normal access === -{"execute":"nbd-server-add", "arguments":{"device":"n"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n"}} {"error": {"class": "GenericError", "desc": "NBD server not running"}} -{"execute":"nbd-server-start", "arguments":{"addr":{"type":"unix", "data":{"path":"SOCK_DIR/nbd"}}}} +{"execute":"nbd-server-start", + "arguments":{"addr":{"type":"unix", + "data":{"path":"SOCK_DIR/nbd"}}}} {"return": {}} -{"execute":"nbd-server-start", "arguments":{"addr":{"type":"unix", "data":{"path":"SOCK_DIR/nbd1"}}}} +{"execute":"nbd-server-start", + "arguments":{"addr":{"type":"unix", + "data":{"path":"SOCK_DIR/nbd1"}}}} {"error": {"class": "GenericError", "desc": "NBD server already running"}} exports available: 0 -{"execute":"nbd-server-add", "arguments":{"device":"n", "bitmap":"b"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "bitmap":"b"}} {"return": {}} -{"execute":"nbd-server-add", "arguments":{"device":"nosuch"}} +{"execute":"nbd-server-add", + "arguments":{"device":"nosuch"}} {"error": {"class": "GenericError", "desc": "Cannot find device=nosuch nor node_name=nosuch"}} -{"execute":"nbd-server-add", "arguments":{"device":"n"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n"}} {"error": {"class": "GenericError", "desc": "Block export id 'n' is already in use"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "bitmap":"b2"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", + "bitmap":"b2"}} {"error": {"class": "GenericError", "desc": "Enabled bitmap 'b2' incompatible with readonly export"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "bitmap":"b3"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", + "bitmap":"b3"}} {"error": {"class": "GenericError", "desc": "Bitmap 'b3' is not found"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "writable":true, "description":"some text", "bitmap":"b2"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", "writable":true, + "description":"some text", "bitmap":"b2"}} {"return": {}} exports available: 2 export: 'n' @@ -99,12 +116,15 @@ read 2097152/2097152 bytes at offset 2097152 === End qemu NBD server === -{"execute":"nbd-server-remove", "arguments":{"name":"n"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n"}} {"return": {}} -{"execute":"nbd-server-remove", "arguments":{"name":"n2"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n2"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "n"}} {"return": {}} -{"execute":"nbd-server-remove", "arguments":{"name":"n2"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n2"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "n2"}} {"error": {"class": "GenericError", "desc": "Export 'n2' is not found"}} {"execute":"nbd-server-stop"} @@ -114,26 +134,41 @@ read 2097152/2097152 bytes at offset 2097152 === Set up NBD with iothread access === -{"execute":"x-blockdev-set-iothread", "arguments":{"node-name":"n", "iothread":"io0"}} +{"execute":"x-blockdev-set-iothread", + "arguments":{"node-name":"n", "iothread":"io0"}} {"return": {}} -{"execute":"nbd-server-add", "arguments":{"device":"n"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n"}} {"error": {"class": "GenericError", "desc": "NBD server not running"}} -{"execute":"nbd-server-start", "arguments":{"addr":{"type":"unix", "data":{"path":"SOCK_DIR/nbd"}}}} +{"execute":"nbd-server-start", + "arguments":{"addr":{"type":"unix", + "data":{"path":"SOCK_DIR/nbd"}}}} {"return": {}} -{"execute":"nbd-server-start", "arguments":{"addr":{"type":"unix", "data":{"path":"SOCK_DIR/nbd1"}}}} +{"execute":"nbd-server-start", + "arguments":{"addr":{"type":"unix", + "data":{"path":"SOCK_DIR/nbd1"}}}} {"error": {"class": "GenericError", "desc": "NBD server already running"}} exports available: 0 -{"execute":"nbd-server-add", "arguments":{"device":"n", "bitmap":"b"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "bitmap":"b"}} {"return": {}} -{"execute":"nbd-server-add", "arguments":{"device":"nosuch"}} +{"execute":"nbd-server-add", + "arguments":{"device":"nosuch"}} {"error": {"class": "GenericError", "desc": "Cannot find device=nosuch nor node_name=nosuch"}} -{"execute":"nbd-server-add", "arguments":{"device":"n"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n"}} {"error": {"class": "GenericError", "desc": "Block export id 'n' is already in use"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "bitmap":"b2"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", + "bitmap":"b2"}} {"error": {"class": "GenericError", "desc": "Enabled bitmap 'b2' incompatible with readonly export"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "bitmap":"b3"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", + "bitmap":"b3"}} {"error": {"class": "GenericError", "desc": "Bitmap 'b3' is not found"}} -{"execute":"nbd-server-add", "arguments":{"device":"n", "name":"n2", "writable":true, "description":"some text", "bitmap":"b2"}} +{"execute":"nbd-server-add", + "arguments":{"device":"n", "name":"n2", "writable":true, + "description":"some text", "bitmap":"b2"}} {"return": {}} exports available: 2 export: 'n' @@ -182,12 +217,15 @@ read 2097152/2097152 bytes at offset 2097152 === End qemu NBD server === -{"execute":"nbd-server-remove", "arguments":{"name":"n"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n"}} {"return": {}} -{"execute":"nbd-server-remove", "arguments":{"name":"n2"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n2"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "n"}} {"return": {}} -{"execute":"nbd-server-remove", "arguments":{"name":"n2"}} +{"execute":"nbd-server-remove", + "arguments":{"name":"n2"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "n2"}} {"error": {"class": "GenericError", "desc": "Export 'n2' is not found"}} {"execute":"nbd-server-stop"} diff --git a/tests/qemu-iotests/229.out b/tests/qemu-iotests/229.out index 7eed393..7d2bfbf 100644 --- a/tests/qemu-iotests/229.out +++ b/tests/qemu-iotests/229.out @@ -8,7 +8,14 @@ wrote 2097152/2097152 bytes at offset 0 === Starting drive-mirror, causing error & stop === -{'execute': 'drive-mirror', 'arguments': {'device': 'testdisk', 'format': 'IMGFMT', 'target': 'blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT.dest', 'sync': 'full', 'mode': 'existing', 'on-source-error': 'stop', 'on-target-error': 'stop' }} +{'execute': 'drive-mirror', + 'arguments': {'device': 'testdisk', + 'format': 'IMGFMT', + 'target': 'blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT.dest', + 'sync': 'full', + 'mode': 'existing', + 'on-source-error': 'stop', + 'on-target-error': 'stop' }} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "testdisk"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}} {"return": {}} @@ -17,7 +24,9 @@ wrote 2097152/2097152 bytes at offset 0 === Force cancel job paused in error state === -{'execute': 'block-job-cancel', 'arguments': { 'device': 'testdisk', 'force': true}} +{'execute': 'block-job-cancel', + 'arguments': { 'device': 'testdisk', + 'force': true}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "testdisk"}} diff --git a/tests/qemu-iotests/249.out b/tests/qemu-iotests/249.out index 85acda4..92ec81d 100644 --- a/tests/qemu-iotests/249.out +++ b/tests/qemu-iotests/249.out @@ -7,24 +7,29 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t. === Send a write command to a drive opened in read-only mode (1) -{ 'execute': 'human-monitor-command', 'arguments': {'command-line': 'qemu-io none0 "aio_write 0 2k"'}} +{ 'execute': 'human-monitor-command', + 'arguments': {'command-line': 'qemu-io none0 "aio_write 0 2k"'}} {"return": "Block node is read-onlyrn"} === Run block-commit on base using an invalid filter node name -{ 'execute': 'block-commit', 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int', 'filter-node-name': '1234'}} +{ 'execute': 'block-commit', + 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int', + 'filter-node-name': '1234'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} {"error": {"class": "GenericError", "desc": "Invalid node name"}} === Send a write command to a drive opened in read-only mode (2) -{ 'execute': 'human-monitor-command', 'arguments': {'command-line': 'qemu-io none0 "aio_write 0 2k"'}} +{ 'execute': 'human-monitor-command', + 'arguments': {'command-line': 'qemu-io none0 "aio_write 0 2k"'}} {"return": "Block node is read-onlyrn"} === Run block-commit on base using the default filter node name -{ 'execute': 'block-commit', 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int'}} +{ 'execute': 'block-commit', + 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int'}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} {"return": {}} @@ -36,6 +41,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t. === Send a write command to a drive opened in read-only mode (3) -{ 'execute': 'human-monitor-command', 'arguments': {'command-line': 'qemu-io none0 "aio_write 0 2k"'}} +{ 'execute': 'human-monitor-command', + 'arguments': {'command-line': 'qemu-io none0 "aio_write 0 2k"'}} {"return": "Block node is read-onlyrn"} *** done diff --git a/tests/qemu-iotests/298 b/tests/qemu-iotests/298 new file mode 100644 index 0000000..d535946 --- /dev/null +++ b/tests/qemu-iotests/298 @@ -0,0 +1,186 @@ +#!/usr/bin/env python3 +# +# Test for preallocate filter +# +# Copyright (c) 2020 Virtuozzo International GmbH. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +import os +import iotests + +MiB = 1024 * 1024 +disk = os.path.join(iotests.test_dir, 'disk') +overlay = os.path.join(iotests.test_dir, 'overlay') +refdisk = os.path.join(iotests.test_dir, 'refdisk') +drive_opts = f'node-name=disk,driver={iotests.imgfmt},' \ + f'file.node-name=filter,file.driver=preallocate,' \ + f'file.file.node-name=file,file.file.filename={disk}' + + +class TestPreallocateBase(iotests.QMPTestCase): + def setUp(self): + iotests.qemu_img_create('-f', iotests.imgfmt, disk, str(10 * MiB)) + + def tearDown(self): + try: + self.check_small() + check = iotests.qemu_img_check(disk) + self.assertFalse('leaks' in check) + self.assertFalse('corruptions' in check) + self.assertEqual(check['check-errors'], 0) + finally: + os.remove(disk) + + def check_big(self): + self.assertTrue(os.path.getsize(disk) > 100 * MiB) + + def check_small(self): + self.assertTrue(os.path.getsize(disk) < 10 * MiB) + + +class TestQemuImg(TestPreallocateBase): + def test_qemu_img(self): + p = iotests.QemuIoInteractive('--image-opts', drive_opts) + + p.cmd('write 0 1M') + p.cmd('flush') + + self.check_big() + + p.close() + + +class TestPreallocateFilter(TestPreallocateBase): + def setUp(self): + super().setUp() + self.vm = iotests.VM().add_drive(path=None, opts=drive_opts) + self.vm.launch() + + def tearDown(self): + self.vm.shutdown() + super().tearDown() + + def test_prealloc(self): + self.vm.hmp_qemu_io('drive0', 'write 0 1M') + self.check_big() + + def test_external_snapshot(self): + self.test_prealloc() + + result = self.vm.qmp('blockdev-snapshot-sync', node_name='disk', + snapshot_file=overlay, + snapshot_node_name='overlay') + self.assert_qmp(result, 'return', {}) + + # on reopen to r-o base preallocation should be dropped + self.check_small() + + self.vm.hmp_qemu_io('drive0', 'write 1M 1M') + + result = self.vm.qmp('block-commit', device='overlay') + self.assert_qmp(result, 'return', {}) + self.complete_and_wait() + + # commit of new megabyte should trigger preallocation + self.check_big() + + def test_reopen_opts(self): + result = self.vm.qmp('x-blockdev-reopen', **{ + 'node-name': 'disk', + 'driver': iotests.imgfmt, + 'file': { + 'node-name': 'filter', + 'driver': 'preallocate', + 'prealloc-size': 20 * MiB, + 'prealloc-align': 5 * MiB, + 'file': { + 'node-name': 'file', + 'driver': 'file', + 'filename': disk + } + } + }) + self.assert_qmp(result, 'return', {}) + + self.vm.hmp_qemu_io('drive0', 'write 0 1M') + self.assertTrue(os.path.getsize(disk) == 25 * MiB) + + +class TestTruncate(iotests.QMPTestCase): + def setUp(self): + iotests.qemu_img_create('-f', iotests.imgfmt, disk, str(10 * MiB)) + iotests.qemu_img_create('-f', iotests.imgfmt, refdisk, str(10 * MiB)) + + def tearDown(self): + os.remove(disk) + os.remove(refdisk) + + def do_test(self, prealloc_mode, new_size): + ret = iotests.qemu_io_silent('--image-opts', '-c', 'write 0 10M', '-c', + f'truncate -m {prealloc_mode} {new_size}', + drive_opts) + self.assertEqual(ret, 0) + + ret = iotests.qemu_io_silent('-f', iotests.imgfmt, '-c', 'write 0 10M', + '-c', + f'truncate -m {prealloc_mode} {new_size}', + refdisk) + self.assertEqual(ret, 0) + + stat = os.stat(disk) + refstat = os.stat(refdisk) + + # Probably we'll want preallocate filter to keep align to cluster when + # shrink preallocation, so, ignore small differece + self.assertLess(abs(stat.st_size - refstat.st_size), 64 * 1024) + + # Preallocate filter may leak some internal clusters (for example, if + # guest write far over EOF, skipping some clusters - they will remain + # fallocated, preallocate filter don't care about such leaks, it drops + # only trailing preallocation. + self.assertLess(abs(stat.st_blocks - refstat.st_blocks) * 512, + 1024 * 1024) + + def test_real_shrink(self): + self.do_test('off', '5M') + + def test_truncate_inside_preallocated_area__falloc(self): + self.do_test('falloc', '50M') + + def test_truncate_inside_preallocated_area__metadata(self): + self.do_test('metadata', '50M') + + def test_truncate_inside_preallocated_area__full(self): + self.do_test('full', '50M') + + def test_truncate_inside_preallocated_area__off(self): + self.do_test('off', '50M') + + def test_truncate_over_preallocated_area__falloc(self): + self.do_test('falloc', '150M') + + def test_truncate_over_preallocated_area__metadata(self): + self.do_test('metadata', '150M') + + def test_truncate_over_preallocated_area__full(self): + self.do_test('full', '150M') + + def test_truncate_over_preallocated_area__off(self): + self.do_test('off', '150M') + + +if __name__ == '__main__': + iotests.main(supported_fmts=['qcow2'], required_fmts=['preallocate']) diff --git a/tests/qemu-iotests/298.out b/tests/qemu-iotests/298.out new file mode 100644 index 0000000..fa16b5c --- /dev/null +++ b/tests/qemu-iotests/298.out @@ -0,0 +1,5 @@ +............. +---------------------------------------------------------------------- +Ran 13 tests + +OK diff --git a/tests/qemu-iotests/308.out b/tests/qemu-iotests/308.out index b93acee..466e7e0 100644 --- a/tests/qemu-iotests/308.out +++ b/tests/qemu-iotests/308.out @@ -5,42 +5,91 @@ wrote 67108864/67108864 bytes at offset 0 64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {'execute': 'qmp_capabilities'} {"return": {}} -{'execute': 'blockdev-add', 'arguments': { 'driver': 'file', 'node-name': 'node-protocol', 'filename': 'TEST_DIR/t.IMGFMT' } } +{'execute': 'blockdev-add', + 'arguments': { + 'driver': 'file', + 'node-name': 'node-protocol', + 'filename': 'TEST_DIR/t.IMGFMT' + } } {"return": {}} -{'execute': 'blockdev-add', 'arguments': { 'driver': 'IMGFMT', 'node-name': 'node-format', 'file': 'node-protocol' } } +{'execute': 'blockdev-add', + 'arguments': { + 'driver': 'IMGFMT', + 'node-name': 'node-format', + 'file': 'node-protocol' + } } {"return": {}} === Mountpoint not present === -{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'export-err', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse' } } +{'execute': 'block-export-add', + 'arguments': { + 'type': 'fuse', + 'id': 'export-err', + 'node-name': 'node-format', + 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse' + } } {"error": {"class": "GenericError", "desc": "Failed to stat 'TEST_DIR/t.IMGFMT.fuse': No such file or directory"}} === Mountpoint is a directory === -{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'export-err', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse' } } +{'execute': 'block-export-add', + 'arguments': { + 'type': 'fuse', + 'id': 'export-err', + 'node-name': 'node-format', + 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse' + } } {"error": {"class": "GenericError", "desc": "'TEST_DIR/t.IMGFMT.fuse' is not a regular file"}} === Mountpoint is a regular file === -{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'export-mp', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse' } } +{'execute': 'block-export-add', + 'arguments': { + 'type': 'fuse', + 'id': 'export-mp', + 'node-name': 'node-format', + 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse' + } } {"return": {}} Images are identical. === Mount over existing file === -{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'export-img', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT' } } +{'execute': 'block-export-add', + 'arguments': { + 'type': 'fuse', + 'id': 'export-img', + 'node-name': 'node-format', + 'mountpoint': 'TEST_DIR/t.IMGFMT' + } } {"return": {}} Images are identical. === Double export === -{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'export-err', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse' } } +{'execute': 'block-export-add', + 'arguments': { + 'type': 'fuse', + 'id': 'export-err', + 'node-name': 'node-format', + 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse' + } } {"error": {"class": "GenericError", "desc": "There already is a FUSE export on 'TEST_DIR/t.IMGFMT.fuse'"}} === Remove export === virtual size: 64 MiB (67108864 bytes) -{'execute': 'block-export-del', 'arguments': { 'id': 'export-mp' } } +{'execute': 'block-export-del', + 'arguments': { + 'id': 'export-mp' + } } {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "export-mp"}} virtual size: 0 B (0 bytes) === Writable export === -{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'export-mp', 'node-name': 'node-format', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse', 'writable': true } } +{'execute': 'block-export-add', + 'arguments': { + 'type': 'fuse', + 'id': 'export-mp', + 'node-name': 'node-format', + 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse', 'writable': true + } } {"return": {}} write failed: Permission denied wrote 65536/65536 bytes at offset 1048576 @@ -49,15 +98,30 @@ wrote 65536/65536 bytes at offset 1048576 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) === Resizing exports === -{'execute': 'block-export-del', 'arguments': { 'id': 'export-mp' } } +{'execute': 'block-export-del', + 'arguments': { + 'id': 'export-mp' + } } {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "export-mp"}} -{'execute': 'block-export-del', 'arguments': { 'id': 'export-img' } } +{'execute': 'block-export-del', + 'arguments': { + 'id': 'export-img' + } } {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "export-img"}} -{'execute': 'blockdev-del', 'arguments': { 'node-name': 'node-format' } } +{'execute': 'blockdev-del', + 'arguments': { + 'node-name': 'node-format' + } } {"return": {}} -{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'export-mp', 'node-name': 'node-protocol', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse', 'writable': true } } +{'execute': 'block-export-add', + 'arguments': { + 'type': 'fuse', + 'id': 'export-mp', + 'node-name': 'node-protocol', + 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse', 'writable': true + } } {"return": {}} --- Try growing non-growable export --- @@ -72,10 +136,19 @@ OK: Post-truncate image size is as expected OK: Disk usage grew with fallocate --- Try growing growable export --- -{'execute': 'block-export-del', 'arguments': { 'id': 'export-mp' } } +{'execute': 'block-export-del', + 'arguments': { + 'id': 'export-mp' + } } {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "export-mp"}} -{'execute': 'block-export-add', 'arguments': { 'type': 'fuse', 'id': 'export-mp', 'node-name': 'node-protocol', 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse', 'writable': true, 'growable': true } } +{'execute': 'block-export-add', + 'arguments': { + 'type': 'fuse', + 'id': 'export-mp', + 'node-name': 'node-protocol', + 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse', 'writable': true, 'growable': true + } } {"return": {}} 65536+0 records in 65536+0 records out diff --git a/tests/qemu-iotests/312 b/tests/qemu-iotests/312 new file mode 100755 index 0000000..4134049 --- /dev/null +++ b/tests/qemu-iotests/312 @@ -0,0 +1,159 @@ +#!/usr/bin/env bash +# +# Test drive-mirror with quorum +# +# The goal of this test is to check how the quorum driver reports +# regions that are known to read as zeroes (BDRV_BLOCK_ZERO). The idea +# is that drive-mirror will try the efficient representation of zeroes +# in the destination image instead of writing actual zeroes. +# +# Copyright (C) 2020 Igalia, S.L. +# Author: Alberto Garcia <berto@igalia.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# creator +owner=berto@igalia.com + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +_cleanup() +{ + _rm_test_img "$TEST_IMG.0" + _rm_test_img "$TEST_IMG.1" + _rm_test_img "$TEST_IMG.2" + _rm_test_img "$TEST_IMG.3" + _cleanup_qemu +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux +_unsupported_imgopts cluster_size data_file + +echo +echo '### Create all images' # three source (quorum), one destination +echo +TEST_IMG="$TEST_IMG.0" _make_test_img -o cluster_size=64k 10M +TEST_IMG="$TEST_IMG.1" _make_test_img -o cluster_size=64k 10M +TEST_IMG="$TEST_IMG.2" _make_test_img -o cluster_size=64k 10M +TEST_IMG="$TEST_IMG.3" _make_test_img -o cluster_size=64k 10M + +quorum="driver=raw,file.driver=quorum,file.vote-threshold=2" +quorum="$quorum,file.children.0.file.filename=$TEST_IMG.0" +quorum="$quorum,file.children.1.file.filename=$TEST_IMG.1" +quorum="$quorum,file.children.2.file.filename=$TEST_IMG.2" +quorum="$quorum,file.children.0.driver=$IMGFMT" +quorum="$quorum,file.children.1.driver=$IMGFMT" +quorum="$quorum,file.children.2.driver=$IMGFMT" + +echo +echo '### Output of qemu-img map (empty quorum)' +echo +$QEMU_IMG map --image-opts $quorum | _filter_qemu_img_map + +# Now we write data to the quorum. All three images will read as +# zeroes in all cases, but with different ways to represent them +# (unallocated clusters, zero clusters, data clusters with zeroes) +# that will have an effect on how the data will be mirrored and the +# output of qemu-img map on the resulting image. +echo +echo '### Write data to the quorum' +echo +# Test 1: data regions surrounded by unallocated clusters. +# Three data regions, the largest one (0x30000) will be picked, end result: +# offset 0x10000, length 0x30000 -> data +$QEMU_IO -c "write -P 0 $((0x10000)) $((0x10000))" "$TEST_IMG.0" | _filter_qemu_io +$QEMU_IO -c "write -P 0 $((0x10000)) $((0x30000))" "$TEST_IMG.1" | _filter_qemu_io +$QEMU_IO -c "write -P 0 $((0x10000)) $((0x20000))" "$TEST_IMG.2" | _filter_qemu_io + +# Test 2: zero regions surrounded by data clusters. +# First we allocate the data clusters. +$QEMU_IO -c "open -o $quorum" -c "write -P 0 $((0x100000)) $((0x40000))" | _filter_qemu_io + +# Three zero regions, the smallest one (0x10000) will be picked, end result: +# offset 0x100000, length 0x10000 -> data +# offset 0x110000, length 0x10000 -> zeroes +# offset 0x120000, length 0x20000 -> data +$QEMU_IO -c "write -z $((0x110000)) $((0x10000))" "$TEST_IMG.0" | _filter_qemu_io +$QEMU_IO -c "write -z $((0x110000)) $((0x30000))" "$TEST_IMG.1" | _filter_qemu_io +$QEMU_IO -c "write -z $((0x110000)) $((0x20000))" "$TEST_IMG.2" | _filter_qemu_io + +# Test 3: zero clusters surrounded by unallocated clusters. +# Everything reads as zeroes, no effect on the end result. +$QEMU_IO -c "write -z $((0x150000)) $((0x10000))" "$TEST_IMG.0" | _filter_qemu_io +$QEMU_IO -c "write -z $((0x150000)) $((0x30000))" "$TEST_IMG.1" | _filter_qemu_io +$QEMU_IO -c "write -z $((0x150000)) $((0x20000))" "$TEST_IMG.2" | _filter_qemu_io + +# Test 4: mix of data and zero clusters. +# The zero region will be ignored in favor of the largest data region +# (0x20000), end result: +# offset 0x200000, length 0x20000 -> data +$QEMU_IO -c "write -P 0 $((0x200000)) $((0x10000))" "$TEST_IMG.0" | _filter_qemu_io +$QEMU_IO -c "write -z $((0x200000)) $((0x30000))" "$TEST_IMG.1" | _filter_qemu_io +$QEMU_IO -c "write -P 0 $((0x200000)) $((0x20000))" "$TEST_IMG.2" | _filter_qemu_io + +# Test 5: write data to a region and then zeroize it, doing it +# directly on the quorum device instead of the individual images. +# This has no effect on the end result but proves that the quorum driver +# supports 'write -z'. +$QEMU_IO -c "open -o $quorum" -c "write -P 1 $((0x250000)) $((0x10000))" | _filter_qemu_io +# Verify the data that we just wrote +$QEMU_IO -c "open -o $quorum" -c "read -P 1 $((0x250000)) $((0x10000))" | _filter_qemu_io +$QEMU_IO -c "open -o $quorum" -c "write -z $((0x250000)) $((0x10000))" | _filter_qemu_io +# Now it should read back as zeroes +$QEMU_IO -c "open -o $quorum" -c "read -P 0 $((0x250000)) $((0x10000))" | _filter_qemu_io + +echo +echo '### Launch the drive-mirror job' +echo +qemu_comm_method="qmp" _launch_qemu -drive if=virtio,"$quorum" +h=$QEMU_HANDLE +_send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" 'return' + +_send_qemu_cmd $h \ + "{'execute': 'drive-mirror', + 'arguments': {'device': 'virtio0', + 'format': '$IMGFMT', + 'target': '$TEST_IMG.3', + 'sync': 'full', + 'mode': 'existing' }}" \ + "BLOCK_JOB_READY.*virtio0" + +_send_qemu_cmd $h \ + "{ 'execute': 'block-job-complete', + 'arguments': { 'device': 'virtio0' } }" \ + 'BLOCK_JOB_COMPLETED' + +_send_qemu_cmd $h "{ 'execute': 'quit' }" '' + +echo +echo '### Output of qemu-img map (destination image)' +echo +$QEMU_IMG map "$TEST_IMG.3" | _filter_qemu_img_map + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/312.out b/tests/qemu-iotests/312.out new file mode 100644 index 0000000..5615146 --- /dev/null +++ b/tests/qemu-iotests/312.out @@ -0,0 +1,81 @@ +QA output created by 312 + +### Create all images + +Formatting 'TEST_DIR/t.IMGFMT.0', fmt=IMGFMT size=10485760 +Formatting 'TEST_DIR/t.IMGFMT.1', fmt=IMGFMT size=10485760 +Formatting 'TEST_DIR/t.IMGFMT.2', fmt=IMGFMT size=10485760 +Formatting 'TEST_DIR/t.IMGFMT.3', fmt=IMGFMT size=10485760 + +### Output of qemu-img map (empty quorum) + +Offset Length File + +### Write data to the quorum + +wrote 65536/65536 bytes at offset 65536 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 196608/196608 bytes at offset 65536 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 131072/131072 bytes at offset 65536 +128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 262144/262144 bytes at offset 1048576 +256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 65536/65536 bytes at offset 1114112 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 196608/196608 bytes at offset 1114112 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 131072/131072 bytes at offset 1114112 +128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 65536/65536 bytes at offset 1376256 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 196608/196608 bytes at offset 1376256 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 131072/131072 bytes at offset 1376256 +128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 65536/65536 bytes at offset 2097152 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 196608/196608 bytes at offset 2097152 +192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 131072/131072 bytes at offset 2097152 +128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 65536/65536 bytes at offset 2424832 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2424832 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 65536/65536 bytes at offset 2424832 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 65536/65536 bytes at offset 2424832 +64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +### Launch the drive-mirror job + +{ 'execute': 'qmp_capabilities' } +{"return": {}} +{'execute': 'drive-mirror', + 'arguments': {'device': 'virtio0', + 'format': 'IMGFMT', + 'target': 'TEST_DIR/t.IMGFMT.3', + 'sync': 'full', + 'mode': 'existing' }} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "virtio0"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "virtio0"}} +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "virtio0"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "virtio0", "len": 10485760, "offset": 10485760, "speed": 0, "type": "mirror"}} +{ 'execute': 'block-job-complete', + 'arguments': { 'device': 'virtio0' } } +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "virtio0"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "virtio0"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "virtio0", "len": 10485760, "offset": 10485760, "speed": 0, "type": "mirror"}} +{ 'execute': 'quit' } + +### Output of qemu-img map (destination image) + +Offset Length File +0x10000 0x30000 TEST_DIR/t.IMGFMT.3 +0x100000 0x10000 TEST_DIR/t.IMGFMT.3 +0x120000 0x20000 TEST_DIR/t.IMGFMT.3 +0x200000 0x20000 TEST_DIR/t.IMGFMT.3 +*** done diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu index de680cf..ef105df 100644 --- a/tests/qemu-iotests/common.qemu +++ b/tests/qemu-iotests/common.qemu @@ -146,14 +146,9 @@ _send_qemu_cmd() count=${qemu_cmd_repeat} use_error="no" fi - # This array element extraction is done to accommodate pathnames with spaces - if [ -z "${success_or_failure}" ]; then - cmd=${@: 1:${#@}-1} - shift $(($# - 1)) - else - cmd=${@: 1:${#@}-2} - shift $(($# - 2)) - fi + + cmd=$1 + shift # Display QMP being sent, but not HMP (since HMP already echoes its # input back to output); decide based on leading '{' diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 9a8394b..e4fb632 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -307,6 +307,7 @@ 295 rw 296 rw 297 meta +298 299 auto quick 300 migration 301 backing quick @@ -317,3 +318,4 @@ 307 rw quick export 308 rw 309 rw auto quick +312 rw auto quick diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index bcd4fe5..dcdcd03 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -205,7 +205,12 @@ def qemu_io_log(*args): def qemu_io_silent(*args): '''Run qemu-io and return the exit code, suppressing stdout''' - args = qemu_io_args + list(args) + if '-f' in args or '--image-opts' in args: + default_args = qemu_io_args_no_fmt + else: + default_args = qemu_io_args + + args = default_args + list(args) exitcode = subprocess.call(args, stdout=open('/dev/null', 'w')) if exitcode < 0: sys.stderr.write('qemu-io received signal %i: %s\n' % @@ -1118,6 +1123,11 @@ def _verify_aio_mode(supported_aio_modes: Sequence[str] = ()) -> None: if supported_aio_modes and (aiomode not in supported_aio_modes): notrun('not suitable for this aio mode: %s' % aiomode) +def _verify_formats(required_formats: Sequence[str] = ()) -> None: + usf_list = list(set(required_formats) - set(supported_formats())) + if usf_list: + notrun(f'formats {usf_list} are not whitelisted') + def supports_quorum(): return 'quorum' in qemu_img_pipe('--help') @@ -1275,7 +1285,8 @@ def execute_setup_common(supported_fmts: Sequence[str] = (), supported_aio_modes: Sequence[str] = (), unsupported_fmts: Sequence[str] = (), supported_protocols: Sequence[str] = (), - unsupported_protocols: Sequence[str] = ()) -> bool: + unsupported_protocols: Sequence[str] = (), + required_fmts: Sequence[str] = ()) -> bool: """ Perform necessary setup for either script-style or unittest-style tests. @@ -1301,6 +1312,7 @@ def execute_setup_common(supported_fmts: Sequence[str] = (), _verify_platform(supported=supported_platforms) _verify_cache_mode(supported_cache_modes) _verify_aio_mode(supported_aio_modes) + _verify_formats(required_fmts) return debug |