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.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Revert "block: Disable driver-specific options for 1.5"
This reverts commit 8ec7d390b0d50b5e5b4b1d8dba7ba40d64a70875.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
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
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
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.
Signed-off-by: Fam Zheng <famz@redhat.com>...
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.
Signed-off-by: Fam Zheng <famz@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
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.
The disabling of the driver-specific options is achieved by applying the...
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>
qemu-iotests: add qed.py image manipulation utility
The qed.py utility can inspect and manipulate QED image files. It canbe used for testing to see the state of image metadata and also toinject corruptions into the image file. It also has a scrubbing feature...
qcow2: introduce dirty bit
This patch adds an incompatible feature bit to mark images that have notbeen closed cleanly. When a dirty image file is opened a consistencycheck and repair is performed.
Update qemu-iotests 031 and 036 since the extension header size changes...
qemu-iotests: ignore qemu-img create lazy_refcounts output
Hide the default lazy_refcounts=off output from qemu-img like we do withother image creation options. This ensures that existing golden outputscontinue to pass despite the new option that has been added....
qcow2: implement lazy refcounts
Lazy refcounts is a performance optimization for qcow2 that postponesrefcount metadata updates and instead marks the image dirty. In thecase of crash or power failure the image will be left in a dirty stateand repaired next time it is opened....
qemu-iotests: add 039 qcow2 lazy refcounts test
This tests establishes the basic post-conditions of the qcow2 lazyrefcounts features:
1. If the image was closed normally, it is marked clean.
2. If an allocating write was performed and the image was not closed...
qemu-iotests: Be more flexible with image creation options
qemu-iotests already filters out image creation options that may bepresent or not in order to get the same output in both cases. However,often it only considers the default value of the option. Cover all valid...
qemu-iotests: Valgrind support
check -valgrind wraps all qemu-io calls with valgrind. This makes it abit easier to debug problems that occur somewhere deep in a test case.
qemu-iotests: add qcow2.py set-feature-bit command
This new command sets feature bits in the image file header:
qcow2.py set-feature-bit incompatible|compatible|autoclear <bit>
The bit number must be in the range [0, 64).
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
qemu-iotests: add 036 autoclear feature bit test
This new test validates the autoclear feature bit behavior. When QEMUopens a qcow2v3 image file with an unknown autoclear feature bit the bitshould be cleared in the image file header.
qemu-iotests: fill streaming test image with data
The TestStreamStop test case is racy; if the job completes before we cancancel it, it fails. If we remove the sleep the job will be canceledbefore it has even started, and the test succeeds but it is also not...
qemu-iotests: start vms in qtest mode
This way, they will not execute any VM code at all. However, right nowthe cancellation test is "relying" on being slowed down by TCG executingBIOS code. So, change the timeouts.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
qemu-iotests: Some backing file COW tests
Looks like we're still missing these very basic tests for backing filehandling.
qemu-iotests: COW with many AIO requests on the same cluster
This one is a bit more interesting. The COW operation isn't performedcompletely synchronously, and therefore dependencies must be handledcorrectly when multiple requests write to the same unallocated cluster....
qemu-iotests: mark 035 qcow2-only
The 035 parallel aio write test relies on knowledge of qcow2 metadatalayout to stress parallel L2 table accesses. This only works for qcow2unless we add additional calculations for qed or other formats.
Mark this test as qcow2-only....
stream: do not copy unallocated sectors from the base
Unallocated sectors should really never be accessed by the guest,so there's no need to copy them during the streaming process.If they are read by the guest during streaming, guest-initiatedcopy-on-read will copy them (we're in the base == NULL case, which...
stream: add testcase for partial streaming
stream: fix sectors not allocated test
The test on sectors not allocated can fail if the L1/L2 tables arenot on disk yet. Allow tests to shutdown the VM early.
qemu-io: correctly print non-integer values as decimals
qemu-io's cvtstr function sometimes will incorrectly omit thedecimal part of the number, and sometimes will incorrectly includeit. This patch fixes both. The former is more serious, and canbe seen in the patches to 027.out and 033.out....
qemu-iotests: strip spaces from qemu-img/qemu-io/qemu command lines
A trailing space is left when qemu-img has no arguments, for example if-nocache is not used. This becomes an empty argument after split()and causes qemu-io to fail.
qemu-iotests: ignore fragmentation information for qed
We added image fragmentation statistics functions to qemu-img several daysago, those patches will cause "./check -qed" failed. This patch will ignorefragmentation statistics information of qed format, and then "./check -qed"...
qemu-iotests: Many parallel allocating I/O requests
This test case manages to let qcow2 abort because its cache is used upand it can't find free cache entries for new requests any more.
qemu-iotests: add block-stream speed value test case
Add tests to exercise the InvalidParameter 'speed' error code path, aswell as the regular success case for setting the speed. Theblock-stream 'speed' parameter allows the speed limit of the job to be...
Merge remote-tracking branch 'qmp/queue/qmp' into staging
qmp: make block job command naming consistent
The block streaming and job commands used '_' instead of '-' for reasonsof compatibility with libvirt, which already included support for the'_' naming. However, the semantics of block_job_cancel have changed and...
qemu-iotests: add a simple test for write_zeroes
qemu-iotests: Test backing file COW with zero clusters
qemu-iotests: Add -o and make v3 the default for qcow2
This adds an -o option to qemu-iotests, which is an option string thatis passed through to qemu-img create -o... This allows testing differentsubformat with a command like './check -qcow2 -o compat=0.10'....
qemu-iotests: Fix test 031 for qcow2 v3 support
qcow2.py must be updated to work with version 3 images at all, theoutput has changed since the feature table extension has been added, andversion 2 and version 3 images can't possibly have the same test output....
iotests: Resolve test failures caused by hostname
`hostname -s` may output an errror:hostname: Name or service not knownThis causes all tests to fail for `make check-block`.
Suppress such error messages, letting the tests succeed.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
qemu-iotests: Always filter cluster_size out in _make_test_img
Some image formats do have a cluster size, others don't, but there aretests that work with both sets of images and currently we get failuresbecause the qemu-img create output doesn't mention the cluster size for...
qemu-iotests: Test bdrv_close while AIO is in flight
If the BlockDriverState is closed/freed without draining the AIOrequests first, the request coroutines may work on invalid data and filedescriptors or have some dangling pointers that cause segfaults....
iotests: fix error in 005
According comment, we should not read again, we will write.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-iotests: Fix call syntax for qemu-io
qemu-io requires options first, then fixed parameters.
GNU getopt also allows options at the end, but POSIX getoptdoesn't. Try "export POSIXLY_CORRECT=y" to get the POSIXbehaviour with GNU getopt, too.
Cc: Kevin Wolf <kwolf@redhat.com>...
qemu-iotests: Fix call syntax for qemu-img
qemu-img requires first options, then file name, then size.
qemu-iotests: qcow2.py
This adds a tool that is meant to inspect and edit qcow2 files in alow-level way, that wouldn't be possible with qemu-img/io, for exampleby adding yet unknown extensions or flags. This way we can test whetherqemu deals properly with future backwards compatible extensions....
qemu-iotests: Test unknown qcow2 header extensions
The immportant thing here is that header extensions don't get silentlydropped when the header is rewritten, e.g. during a rebase.
qemu-iotests: Mark some tests as quick
This creates a new test group 'quick' for some test case that take atmost a couple of seconds each, so that the group can be run during aquick 'make check'
qemu-iotests: Filter out DOS line endings
This one makes it possible to run qemu-iotests on a Windows build using Wineand get somewhat meaningful results.
qemu-iotests: 026: Reduce output changes for cache=none qcow2
qemu-iotests supports the -nocache option which makes the tests run withcache=none. For blkdebug tests with qcow2 this means that we may seetest results that differ from cache=writethrough. This patch makes the...
qemu-iotests: Test rebase with short backing file
This tests that qemu-img rebase doesn't assume that the backing file hasthe same size as the image, but considers that it can be smaller.