summaryrefslogtreecommitdiff
path: root/tests/qemu-iotests
AgeCommit message (Collapse)AuthorFilesLines
2014-03-14qemu-iotests: remove 085 and 087 from 'quick' groupStefan Hajnoczi1-2/+2
The 'quick' group in qemu-iotests are not allowed to run QEMU since we don't know which targets are available. In other words, they may only use qemu-img, qemu-io, and qemu-nbd. Drop 085 and 087 from the 'quick' group since they run QEMU. This makes "make check-block" pass again. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-14qemu-iotests: add 083 NBD client disconnect testsStefan Hajnoczi3-0/+293
This new test case uses nbd-fault-injector.py to simulate broken TCP connections at each stage in the NBD protocol. This way we can exercise block/nbd-client.c's socket error handling code paths. In particular, this serves as a regression test to make sure nbd-client.c doesn't cause an infinite loop by leaving its nbd_receive_reply() fd handler registered after the connection has been closed. This bug was fixed in an earlier patch. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-14tests: add nbd-fault-injector.py utilityStefan Hajnoczi1-0/+264
The nbd-fault-injector.py script is a special kind of NBD server. It throws away all writes and produces zeroes for reads. Given a list of fault injection rules, it can simulate NBD protocol errors and is useful for testing NBD client error handling code paths. See the patch for documentation. This scripts is modelled after Kevin Wolf <kwolf@redhat.com>'s blkdebug block driver. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-14blockdev: Refuse to open encrypted image unless pausedMarkus Armbruster2-1/+27
Opening an encrypted image takes an additional step: setting the key. Between open and the key set, the image must not be used. We have some protection against accidental use in place: you can't unpause a guest while we're missing keys. You can, however, hot-plug block devices lacking keys into a running guest just fine, or insert media lacking keys. In the latter case, notifying the guest of the insert is delayed until the key is set, which may suffice to protect at least some guests in common usage. This patch makes the protection apply in more cases, in a rather heavy-handed way: it doesn't let you open encrypted images unless we're in a paused state. It doesn't extend the protection to users other than the guest (block jobs?). Use of runstate_check() from block.c is disgusting. Best I can do right now. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-13iotests: Test corruption during COW requestMax Reitz2-0/+41
Extend test file 060 by a test case for corruption occuring concurrently to a COW request. QEMU should not crash but rather return an appropriate error message. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-07block: qemu-iotests 085 - live snapshots testsJeff Cody3-0/+248
This adds tests for live snapshots, both through the single snapshot command, and the transaction group snapshot command. The snapshots are done through the QMP interface, using the following commands for snapshots: Single snapshot: { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'virtio0', 'snapshot-file':'...', 'format': 'qcow2' } }" Group snapshot: { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': '...' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'virtio1', 'snapshot-file': '...' } } ] } } Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-03-06block: Fix error path segfault in bdrv_open()Kevin Wolf2-0/+24
Using an invalid option for a block device that is opened with BDRV_O_PROTOCOL led to drv = NULL, and when trying to include the driver name in the error message, qemu dereferenced it: $ x86_64-softmmu/qemu-system-x86_64 -drive file=/tmp/test.qcow2,file.foo=bar Segmentation fault (core dumped) With this patch applied, the expected error message is printed: $ x86_64-softmmu/qemu-system-x86_64 -drive file=/tmp/test.qcow2,file.foo=bar qemu-system-x86_64: -drive file=/tmp/test.qcow2,file.foo=bar: could not open disk image /tmp/test.qcow2: Block protocol 'file' doesn't support the option 'foo' Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net>
2014-03-06qemu-iotests: Test a few blockdev-add error casesKevin Wolf3-0/+163
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net>
2014-03-05qemu-iotests: Test progress output for conversionKevin Wolf3-0/+84
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-28discard rbd error output when not relevant in qemu-iotestsLoic Dachary1-1/+1
Suppress rbd progress messages with --no-progress so they are not confused with an error output when comparing test results ( progress is displayed on stderr ). Signed-off-by: Loic Dachary <loic@dachary.org> Reviewed-by: Josh Durgin <josh.durgin@inktank.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-02-28qemu-io-test: Disable Quorum test when not compiled in.Benoît Canet1-0/+3
Quorum is not compiled by default: make the quorum 081 test aware of this. Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-02-28qmp: Make Quorum error events more palatable.Benoît Canet1-1/+1
Insert quorum QMP events documentation alphabetically. Also change the "ret" errno value by an optional "error" being an strerror(-ret) in the QUORUM_REPORT_BAD qmp event. Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-02-28qemu-iotests: add more tests to the "quick" groupPaolo Bonzini1-17/+17
None of these needs QEMU_PROG, and they all take but a few seconds. We need to point the launching script to qemu-nbd, though. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-02-21iotests: Mixed quorum child device specificationsMax Reitz2-0/+66
Add a test case to test 081 for mixing full option dicts and reference strings of specifying the quorum child block devices through QMP. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-21quorum: Add unit test.Benoît Canet3-0/+130
Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-21qemu-iotests: Check qemu-img command line parsingKevin Wolf3-0/+738
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2014-02-21vmdk: correctly propagate errorsPaolo Bonzini1-4/+2
Now that we can return the "right" errors, use the Error** parameter to pass them back instead of just printing them. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-21vmdk: do not try opening a file as both image and descriptorPaolo Bonzini1-2/+2
This prepares for propagating errors from vmdk_open_sparse and vmdk_open_desc_file up to the caller of vmdk_open. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-21nbd: correctly propagate errorsPaolo Bonzini1-4/+2
Before: $ ./qemu-io-old qemu-io-old> open -r -o file.driver=nbd one of path and host must be specified. qemu-io-old: can't open device (null): Could not open image: Invalid argument $ ./qemu-io-old qemu-io-old> open -r -o file.driver=nbd,file.host=foo,file.path=bar path and host may not be used at the same time. qemu-io-old: can't open device (null): Could not open image: Invalid argument After: $ ./qemu-io qemu-io> open -r -o file.driver=nbd qemu-io: can't open device (null): one of path and host must be specified. $ ./qemu-io qemu-io> open -r -o file.driver=nbd,file.host=foo,file.path=bar qemu-io: can't open device (null): path and host may not be used at the same time. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-21nbd: produce a better error if neither host nor port is passedPaolo Bonzini1-0/+2
Before: $ qemu-io-old qemu-io-old> open -r -o file.driver=nbd qemu-io-old: can't open device (null): Could not open image: Invalid argument $ ./qemu-io-old qemu-io-old> open -r -o file.driver=nbd,file.host=foo,file.path=bar path and host may not be used at the same time. qemu-io-old: can't open device (null): Could not open image: Invalid argument After: $ ./qemu-io qemu-io> open -r -o file.driver=nbd one of path and host must be specified. qemu-io: can't open device (null): Could not open image: Invalid argument $ ./qemu-io qemu-io> open -r -o file.driver=nbd,file.host=foo,file.path=bar path and host may not be used at the same time. qemu-io: can't open device (null): Could not open image: Invalid argument Next patch will fix the error propagation. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-21qcow2: Set zero flag for discarded clustersKevin Wolf1-4/+14
Instead of making the backing file contents visible again after a discard request, set the zero flag if possible (i.e. on version >= 3). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2014-02-14qemu-iotests: Don't run 005 on vmdk split formatsFam Zheng1-0/+2
There would be too many extents that VMDK driver can't open all of them: 005 0s ... - output mismatch (see 005.out.bad) --- 005.out 2013-12-24 09:27:27.608181030 +0800 +++ 005.out.bad 2014-02-13 10:00:15.282184557 +0800 @@ -4,10 +4,10 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=5368709120000 small read -read 4096/4096 bytes at offset 1024 -4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io: can't open device /tmp/qemu-iotests/t.vmdk: Could not open '/tmp/qemu-iotests/t-s1016.vmdk': Too many open files +no file open, try 'help open' small write -wrote 4096/4096 bytes at offset 8192 -4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io: can't open device /tmp/qemu-iotests/t.vmdk: Could not open '/tmp/qemu-iotests/t-s1016.vmdk': Too many open files +no file open, try 'help open' *** done So disable the two subformats. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-02-14block: qemu-iotests - add vhdx log replay tests for qemu-imgJeff Cody2-0/+21
VHDX logs can now be replayed via 'qemu-img check -r all'. Add tests to verify that the log replay is successful when using qemu-img. Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-02-14block: qemu-iotests - fix test 070 (vhdx)Jeff Cody2-2/+5
VHDX test 070 failed, due to different output from qemu-io / qemu when opening an image read-only that contains a log file. Filter the output, and update the expected results to match the correct output. Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-02-09qemu-iotests: add test for qcow2 preallocation with different cluster sizesHu Tao3-0/+96
Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-09block: Fail gracefully with missing filenameKevin Wolf2-0/+36
This fixes a regression introduced in commit 2a05cbe42 ('block: Allow block devices without files'): $ qemu-system-x86_64 -drive driver=file qemu-system-x86_64: block.c:892: bdrv_open_common: Assertion `!drv->bdrv_needs_filename || filename != ((void *)0)' failed. Now the respective check must be performed not only in bdrv_file_open(), but also in bdrv_open(). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-02-09qemu-iotests: enable support for NFS protocolPeter Lieven2-3/+22
Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-09qemu-iotests: enable test 016 and 025 to work with NFS protocolPeter Lieven2-2/+2
Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-09qemu-iotests: blacklist test 020 for NFS protocolPeter Lieven1-0/+5
reopening is currently not supported. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-09qemu-iotests: change _supported_proto to file for various testsPeter Lieven25-25/+25
all these tests do anything of the following and thus fail with any protocol other than file: - the tests use rm, cp or mv shell commands which only work on file - the tests use qcow2.py - the images construct new filenames (e.g. backing file names) and the logic is broken for anything else than file Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-02-09qemu-iotest: Make 077 raw-onlyKevin Wolf1-1/+1
The qemu-io command sequences make the assumption that an unaligned request on the format layer will be unaligned on the blkdebug layer as well. This doesn't necessarily hold true for drivers other than raw. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Benoît Canet <benoit@irqsave.net>
2014-01-31qemu-iotests: only run 071 on qcow2Stefan Hajnoczi1-1/+1
The 071 test is designed for IMGFMT=qcow2 because it uses the l2_load blkdebug event. Its output filtering also assumes that IMGFMT is not raw since 071.out contains "format=raw" but IMGFMT=raw would filter the output to "format=IMGFMT". Perhaps the test case can be rewritten to be more generic, but for now let's document that it was only supposed to work with qcow2. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net>
2014-01-31qemu-iotests: Drop assert_no_active_commit in case 040Fam Zheng1-16/+12
It is exactly assert_no_active_block_jobs in iotests.py Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-01-24qemu-iotests: Test pwritev RMW logicKevin Wolf3-0/+481
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
2014-01-24vmdk: Check for overhead when openingFam Zheng2-0/+11
Report an error if file size is even smaller than metadata. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-01-22iotests: Test file format nestingMax Reitz3-0/+91
Add a test for nested image formats. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-01-22iotests: Test new blkdebug/blkverify interfaceMax Reitz3-0/+330
Add a test for the new blkdebug/blkverify interface. This test is not written in Python, although it uses QMP. This is because it invokes the qemu-io HMP command, which outputs errors to stderr instead of returning them through QMP. Filtering and testing that output is easier in a shell script than with the Python infrastructure. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-01-22block: Allow recursive "file"sMax Reitz1-1/+1
It should be possible to use a format as a driver for a file which in turn requires another file, i.e., nesting file formats. Allowing nested file formats results in e.g. qcow2 BlockDriverStates never being directly passed to bdrv_open_common() from bdrv_file_open(), but instead being handed through bdrv_open(). This changes the error message when trying to give a filename to qcow2, i.e. trying to use it as a driver for the protocol level. Therefore, change the reference output of I/O test 051 accordingly. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-01-22vmdk: Fix big flat extent IOFam Zheng2-0/+81
Local variable "n" as int64_t avoids overflow with large sector number calculation. See test case change for failure case. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-01-22qemu-iotests: Clean up all extents for vmdkFam Zheng1-3/+14
This modifies _cleanup_test_img to remove all the extent files listed by "qemu-img info"'s format specific information. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-01-22qemu-iotests: Add _unsupported_imgopts for vmdk subformatsFam Zheng9-0/+21
Some cases are not applicable for vmdk subformats those don't support certain features, e.g. backing file, and some others can't run on mult-file image, e.g. monolithicFlat. This adds declaration in test cases to skip them automatically, so that iotests on vmdk can go more smoothly (without manually picking of cases for each subformat). Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-01-22qemu-iotests: Introduce _unsupported_imgoptsFam Zheng1-0/+11
Introduce _unsupported_imgopts that causes _notrun for specific image options. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-12-20qemu-iotests: Update test cases for commit activeFam Zheng1-42/+32
Factor out commit test common logic into super class, and update test of committing the active image. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20qemu-iotests: drop duplicate virtio-blk initialization failureStefan Hajnoczi1-1/+0
Commit 75884afd5c6c42e523b08565e289dbe319e17ad9 ("virtio-blk: Convert to QOM realize") dropped a duplicate error_report() call. Now we no longer get the following error message twice: QEMU_PROG: -drive if=virtio: Device initialization failed. Update qemu-iotests 051. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-20vmdk: Check VMFS extent line field numberFam Zheng2-0/+19
VMFS extent line in description file should be with 4 fields: RW <size> VMFS "file-name.vmdk" Check the number explicitly and report error if offset is appended as FLAT, which should be invalid format. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-06qemu-iotests: filter QEMU monitor \r\nStefan Hajnoczi2-57/+58
SMTP does not preserve newlines. This is normally not a problem if the email body uses DOS or UNIX newlines consistently. In 051.out we mix UNIX newlines with DOS newlines (since QEMU monitor output uses \r\n). This patch filters the QEMU monitor output so the golden master file uses UNIX newlines exclusively. The result is that patches touching 051.out will apply cleanly without mangling newlines after this commit. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-04qemu-iotests: add test for snapshot in qemu-img convertWenchao Xia2-1/+30
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-04qemu-iotests: add 058 internal snapshot export with qemu-nbd caseWenchao Xia5-1/+157
This case can't run when IMGPROTO=nbd, since it needs to create some internal snapshot which would fail for EOF write request, even when TEST_IMG is exported with "-f raw" in common.rc, so set _supported_proto to file. _require_command() is changed to tip what util is missing, instead of printing a blank. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-04qemu-iotests: Split qcow2 only cases in 048Fam Zheng5-43/+105
Format "raw" doesn't always work on certain file systems (e.g. tmpfs). Use qcow2 to make the allocation status explicit and split into a new case. [Resolved merge conflict due to "qemu-io> " prompt filter, added 074 to group file, and fixed up s/048/074/ copy-paste mistake. --Stefan] Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-04qemu-iotests: Clean up spaces in usage outputFam Zheng1-8/+8
Whitespace changes to align columns. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>