qemu-iotests: Correct 026 output
Because l2_allocate now frees the unused L2 cluster on error, theaccording test cases in 026 don't result in one leaked cluster anymore.
Signed-off-by: Max Reitz <mreitz@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qemu-iotests: Preallocated zero clusters in 061
Add a test case for zero cluster expansion on an image completely filledwith preallocated zero clusters to test 061.
Signed-off-by: Max Reitz <mreitz@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-iotests: Quote $TEST_IMG* and $TEST_DIR usage
A lot of image filename and paths are used unquoted. Quote these tomake sure that directories / filenames with spaces are not problematic.
Signed-off-by: Jeff Cody <jcody@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>...
qemu-iotests: Add basic ability to use binary sample images
For image formats that are not "QEMU native", but supported forcompatibility, it is useful to verify that an image created withthe 'gold standard' native tool can be read / written to successfully...
qemu-iotests: fix qmp.py search path
QMP/qmp.py is renamed to scripts/qmp/qmp.py, fix the search path in iotests.py.
Signed-off-by: Fam Zheng <famz@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-iotests: fix test case 059
Since commit "block: Error parameter for open functions", error outputis more verbose. Update test case output file to follow the change.
qemu-iotests: add monolithicFlat creation test to 059
qemu-iotests: add test for backing file overriding
Test that backing.file.filename option can be parsed and override thebacking file from image (backing file reflected with "info block").
qemu-iotests: Do not execute 052 with -nocache
Test 052 uses qemu-io -s which will result in bdrv_open trying to createa temporary snapshot file in /tmp. However, since O_DIRECT and tmpfsdo not work well together, disable this test for -nocache.
Signed-off-by: Max Reitz <mreitz@redhat.com>...
qemu-iotests: Fix test 038
Test 038 uses asynchronous I/O, resulting (potentially) in a differentoutput for every run (regarding the order of the I/O accesses). This canbe fixed by simply sorting the I/O access messages, since their order isirrelevant anyway (for this asynchonous I/O)....
qemu-iotests: Cleanup test image in test number 007
qemu-iotests number 007 doesn't do test image cleanup. This will affectthose protocols that expect a clean state before every test. Henceensure that test image is cleaned up in this test.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>...
qemu-iotests: Adjustments due to error propagation
When opening/creating images, propagating errors instead of immediatelyemitting them on occurrence results in errors generally being printed ona single line rather than being split up into multiple ones. This in...
qemu-iotests: add tests for runtime fd passing via SCM rights
This case will test whether the monitor can receive fd at runtime.To verify better, additional monitor is created to see if qemucan handler two monitor instances correctly.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>...
qemu-iotests: New test case in 061
Add one test case for zero cluster expansion on qcow2 version downgradein shared L2 tables (i.e., L2 tables with a refcount > 1) and one forzero expansion on backed clusters in shared L2 tables.
qemu-iotests: add 057 internal snapshot for block device test case
Create in transaction and deletion in single command will be tested.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-iotest: qcow2 image option amendment
Add tests for qemu-img amend on qcow2 image files.
qemu-iotests: add unix socket help program
This program can do a sendmsg call to transfer fd with unixsocket, which is not supported in python2.
The built binary will not be deleted in clean, but it is aexisting issue in ./tests, which should be solved in another...
qemu-iotests: add infrastructure of fd passing via SCM
This patch make use of the compiled scm helper program to transferfd via unix socket at runtime.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>...
qemu-iotests: Fixed test case 026
The reference output for test case 026 hasn't been updated in a longtime and it's one of the "known failing" cases. This patch updates thereference output so that unintentional changes can be reliably detectedagain.
The problem with this test case is that it produces different output...
qemu-iotests: Whitespace cleanup
These scripts used to have a four characters indentation, with eightconsecutive spaces converted into a tab. Convert everything into spaces.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qemu-iotests: Adjust test result 039
The moved OFLAG_COPIED check in qcow2_check_refcounts results in adifferent output from test 039 (mismatches are now found after thegeneral refcount check (as far as any remain)). This patch adjusts theexpected test result accordingly....
add qemu-img convert -n option (skip target volume creation)
Add a -n option to skip volume creation on qemu-img convert.This is useful for targets such as rbd / ceph, where thetarget volume may already exist; we cannot always rely onqemu-img convert to create the image, as dependent on the...
qemu-iotests: Overlapping cluster allocations
A new test on corrupted images with overlapping cluster allocations.
qcow2: Add corrupt bit
This adds an incompatible bit indicating corruption to qcow2. Any imagewith this bit set may not be written to unless for repairing (andsubsequently clearing the bit if the repair has been successful).
Revert "block: Disable driver-specific options for 1.6"
This reverts commit 8afaefb8919dc8746a57c450a758717c516c7b0a.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-iotests: Update reference output for 051
qemu-iotests: Snapshotting zero clusters
This test creates an image with unallocated zero clusters, then createsa snapshot. Afterwards, there should be neither any errors nor leaks.
qemu-iotests: add poke_file utility function
The new poke_file function sets bytes at an offset in a file given aprintf-style format string. It can be used to corrupt an image file fortest coverage of error paths.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>...
qemu-iotests: add empty test case for vmdk
Will add vmdk specific tests later here.
vmdk: check granularity field in opening
Granularity is used to calculate the cluster size and allocate r/wbuffer. Check the value from image before using it, so we don't abort()for unbounded memory allocation.
Signed-off-by: Fam Zheng <famz@redhat.com>...
vmdk: check l2 table size when opening
header.num_gtes_per_gte determines size for L2 table. Check for too bigvalue before using it. Limit to 512M entries (2GB per one L2 table).
vmdk: check l1 size before opening image
L1 table size is calculated from capacity, granularity and l2 tablesize. If capacity is too big or later two are too small, the L1 tablewill be too big to allocate in memory. Limit it to a reasonable range.
qemu-iotests: filter QEMU version in monitor banner
Filter out the QEMU monitor version banner so that tests do not breakwhen the QEMU version number is changed.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: Disable driver-specific options for 1.6
We don't want to commit to the API yet before everything is worked out.Like already for 1.5, disable it again for the 1.6 release. This commitis meant to be reverted after the 1.6 release.
The disabling of the driver-specific options is achieved by applying the...
Add tests for sync modes 'TOP' and 'NONE'
This patch adds tests for sync modes top and none. Test for 'TOP'is separated out as it requires a backing file. Also added a testfor invalid format.
Signed-off-by: Ian Main <imain@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev: Rename 'readonly' option to 'read-only'
Option name cleanup before it becomes a QMP API.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
qcow2: Use dashes instead of underscores in options
This is what QMP wants to use. The options haven't been enabled in anyrelease yet, so we're still free to change them.
blockdev: add sync mode to drive-backup QMP command
The drive-backup command is similar to the drive-mirror command, exceptno guest data written after the command executes gets copied. Add async mode argument which determines whether the entire disk is copied,...
block: Don't parse protocol from file.filename
One of the major reasons for doing something new for -blockdev andblockdev-add was that the old block layer code parses filenames insteadof just taking them literally. So we should really leave it untouched...
qemu-iotests: Update 051 reference output
This has been broken by commit bd5c51ee.
qemu-iotests: extract wait_until_completed() into iotests.py
The 'drive-mirror' tests often issue 'block-job-complete' and wait forthe QMP completion event. Other types of block jobs also want to waitfor completion but they may not need to issue 'block-job-complete'....
qemu-iotests: add 055 drive-backup test case
Testing drive-backup is similar to image streaming and drive mirroring.This test case is based on 041.
Revert "block: Disable driver-specific options for 1.5"
This reverts commit 8ec7d390b0d50b5e5b4b1d8dba7ba40d64a70875.
cutils: Support 'P' and 'E' suffixes in strtosz()
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qemu-iotests: make assert_no_active_block_jobs() common
Tests 030 and 041 both use query-block-jobs to check whether any blockjobs are active. Make this code common so that 'drive-backup' and othernew feature tests will be able to reuse it.
Suggested-by: Kevin Wolf <kwolf@redhat.com>...
qemu-iotests: make cancel_and_wait() common
The cancel_and_wait() function has been duplicated in 030 and 041. Moveit into iotests.py and let it return the event so tests can performadditional asserts.
Note that 041's cancel_and_wait(wait_ready=True) is replaced by...
qemu-iotests: make compare_images() common
The iotests.compare_images() function returns True if two image fileshave the identical data. Previously this was implemented by convertingimages to raw and then comparing their contents using Python. Since"qemu-img compare" is now available and is more efficient, switch to it....
qemu-iotests: make create_image() common
Both 030 and 041 use create_image(). Move it to iotests.py.
Also drop ImageStreamingTestCase since the class now has no methods.
Suggested-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>...
qemu-iotests: fix 054 cluster size help output
Commit f3f4d2c09b9cf46903ba38425ec46c44185162bd added a hint to increasethe cluster size when a large image cannot be created. Test 054 now hasoutdated output and fails because the golden output does not match....
tests: set MALLOC_PERTURB_ to expose memory bugs
glibc wipes malloc(3) memory when the MALLOC_PERTURB_ environmentvariable is set. The value of the environment variable determines thebit pattern used to wipe memory. For more information, seehttp://udrepper.livejournal.com/11429.html....
qcow2.py: Subcommand for changing header fields
qemu-iotests: Try creating huge qcow2 image
It's supposed to fail gracefully instead of segfaulting.
qemu-iotests: fix 017 018 for vmdk
017 and 018 use /bin/mv to move base img from t.IMGFMG to t.IMGFMT.baseafter filling data, this is not enough for vmdk, when t.IMGFMT is only adescription text file who points to t-{flat,s001,f001,...}.IMGFMT asdata extent, so testing such subformats alway fails on them....
qemu-iotests: exclude vmdk for test 042
Zero sized disk is not supported by qemu vmdk driver, exclude vmdk fromthe test script.
As tested on vmware-vdiskmanager and vmware workstation, zero sized diskis not supported by vmware, either.
qemu-iotests: exclude vmdk and qcow from 043
043 tests recursive backing file by changing backing file. VMDK has notimplemented this yet, and qcow1 probably never will.
qemu-iotests: Filter out 'adapter_type'
Filter out vmdk creation option 'adapter_type' for vmdk. So that testswith an explicit './check -o adapter_type=XXX' will not fail.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qemu-iotests: Filter out vmdk creation options
Cover new image creation options for vmdk, so we can use '-ozeroed_grain=XXX' and '-o subformat=XXX' to run the tests successfully.
Signed-off-by: Fam Zheng <famz@redhat.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>...
block: Disable driver-specific options for 1.5
We don't want to commit to the API yet before everything is worked out.Disable it for the 1.5 release. This commit is meant to be revertedafter the 1.5 release.
qemu-iotests: add 053 unaligned compressed image size test
Test that qemu-img convert -c works when input image length is not amultiple of the cluster size.
Previously an error message would be produced:
qemu-img: error while compressing sector 0: Input/output error...
block: Fail gracefully when using a format driver on protocol level
Specifying the wrong driver could fail an assertion:
$ qemu-system-x86_64 -drive file.driver=qcow2,file=xqemu-system-x86_64: block.c:721: bdrv_open_common: Assertion `file !=((void *)0)' failed....
qemu-iotests: Fix _filter_qemu
$QEMU_PROG happens to be 'qemu' in my setup, so this sed commandreplaces a bit too much. Restrict it to the start of the line and towhen it's followed by a colon, i.e. the form used by error messages.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
qemu-iotests: filter QEMU_PROG in 051.out
Filter the name of the QEMU executable so the output can be diffed nomatter what QEMU_PROG is (e.g. qemu-system-x86_64).
iotests: Add 'check -ssh' option to test Secure Shell block device.
Note in order to run these tests on ssh, you must be running a localssh daemon, and that daemon must accept loopback connections, andssh-agent has to be set up to allow logins on the local daemon. In...
qemu-iotests: A few more bdrv_pread/pwrite tests
qemu-iotests: Add test for -drive options
qcow2: Gather clusters in a looping loop
Instead of just checking once in exactly this order if there aredependendies, non-COW clusters and new allocation, this starts loopingaround these. This way we can, for example, gather non-COW clusters afternew allocations as long as the host cluster offsets stay contiguous....
qcow2: Improve check for overlapping allocations
The old code detected an overlapping allocation even when theallocations didn't actually overlap, but were only adjacent.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
qemu-iotests: More concurrent allocation scenarios
qcow2: Fix "total clusters" number in bdrv_check
This should be based on the virtual disk size, not on the size of theimage.
Interesting observation: With some VM state stored in the image file,percentages higher than 100% are possible, even though snapshots...
qemu-iotests: add 052 BDRV_O_SNAPSHOT test
Check that writes to an image opened with BDRV_O_SNAPSHOT do not modifythe underlying image file.
qemu-iotests: add tests for rebasing zero clusters
If zero clusters are erroneously treated as unallocated, "qemu-img rebase" will copy the backing file's contents onto the cluster.
The bug existed also in image streaming, but since the root cause was in...
qemu-iotests: use -nographic in test case 007
A comment explains that -nographic hangs test case 007. This is nolonger the case so add -nographic. This makes the test suite faster andmore pleasant to run since no windows pop up.
I am not sure exactly when -nographic starting working for this case but...
qemu-iotests: Add qemu-img compare test
Simple test for qemu-img compare to check it's working correctly.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qemu-iotests: Test qcow2 image creation options
Just create lots of images and try out each of the creation options thatqcow2 provides (except backing_file/fmt for now)
I'm not totally happy with the behaviour of qemu-img in each of thecases, but let's be explicit and update the test when we do change...
qemu-img: add compressed clusters to BlockFragInfo
Show how many clusters are compressed. This can be used to monitor howmany compressed clusters remain and whether to recompress the image.
Suggested-by: Cole Robinson <crobinso@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qemu-img: find the image end offset during check
This patch adds the support for reporting the image end offset (inbytes). This is particularly useful after a conversion (or a rebase)where the destination is a block device in order to find the firstunused byte at the end of the image....
qemu-iotests: Add regression test for b7ab0fea
It turned out that the change in b7ab0fea was actually a real qcow2corruption fix. This is a reproducer for the bug.
block: Adds mirroring tests for resized images
This test verifies two mirroring issues are fixed with resized images:
mirror: add buf-size argument to drive-mirror
This makes sense when the next commit starts using the extra buffer spaceto perform many I/O operations asynchronously.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
mirror: perform COW if the cluster size is bigger than the granularity
When mirroring runs, the backing files for the target may not yet beready. However, this means that a copy-on-write operation on the targetwould fill the missing sectors with zeros. Copy-on-write only happens...
qemu-iotests: Test concurrent cluster allocations
This adds some first tests for qcow2's dependency handling when twoparallel write requests access the same cluster.
tests: Add tests for fdsets
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Fix spelling in comments and documentation
These spelling bugs were found by codespell:
supressing -> suppressingtransfered -> transferred
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qemu-iotests: qcow2: Test growing large refcount table
Actually writing all the content with 512 byte sector size would takeforever, therefore build the image file with a Python script and useqemu-io for the last write that actually triggers the refcount table...
tests: allow qemu-iotests to be run against nbd backend
To do this, we start a qemu-nbd process at _make_test_img and killit in _cleanup_test_img. $TEST_IMG is changed to point at the TCPserver. We also remove the checks for existence of binaries fromcommon.config - they're duplicated in common, and we can make the...
qemu-iotests: add mirroring test case
qemu-iotests: add testcases for mirroring on-source-error/on-target-error
The new options are tested with blkdebug on both the source and thetarget.
block: in commit, determine base image from the top image
This simplifies some code and error checking, and also fixes a bug.
bdrv_find_backing_image() should only be passed absolute filenames,or filenames relative to the chain. In the QMP message handler for...
qemu-iotests: add relative backing file tests for block-commit (040)
The previous block commit used absolute filenames for all block-commitimages and commands; this adds relative filenames for the same tests.
Signed-off-by: Jeff Cody <jcody@redhat.com>...
qemu-iotests: Add 043 backing file chain infinite loop test
This new test verifies that qemu-img info --backing-chain safely abortswhen an image file has a backing file infinite loop.
qemu-iotests: Test qemu-img operation on zero size image
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-iotests: map underscore to dash in QMP argument names
iotests.py provides a convenience function that uses Python keywordarguments to represent QMP command arguments. However, almost allQMP commands use dashes for argument names (the sole exception is...
qemu-iotests: add tests for streaming error handling
Add a test for each of report/ignore/stop. The tests use blkdebugto generate an error in the middle of a script. The error isrecoverable (once = "on") so that we can test resuming a job afterstopping for an error....
qemu-iotests: add test for pausing a streaming operation
These check that a paused streaming job does not advance its offset.
Sometimes the new test fails; the map is different between the sourceand the destination of the streaming because qemu-io does not always...
qemu-iotests: add initial tests for live block commit
Derived from the streaming test cases (030), this adds thefollowing 9 tests:
1. For the following image chain, commit [mid] into [backing], and use qemu-io to verify [backing] has its original data, as...
qemu-iotests: add backing file smaller than image test case
This new test case checks that streaming completes successfully when thebacking file is smaller than the image file.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>...
qemu-iotests: Fix 030 after switch to GenericError
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
qemu-iotests: Save some sed processes
Instead of building a huge pipeline, just pass all expressions to asingle sed process.
Suggested-by: Eric Blake <eblake@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
block: add BLOCK_O_CHECK for qemu-img check
Image formats with a dirty bit, like qed and qcow2, repair dirty imagefiles upon open with BDRV_O_RDWR. Performing automatic repair whenqemu-img check runs is not ideal because the bdrv_open() call repairsthe image before the actual bdrv_check() call from qemu-img.c....
qemu-iotests: skip 039 with ./check -nocache
When the qemu-io --nocache option is used the 039 test case cannot abortQEMU at a point where the image is dirty. Skip the test case.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>