block: Allow recursive "file"s
It should be possible to use a format as a driver for a file which inturn requires another file, i.e., nesting file formats.
Allowing nested file formats results in e.g. qcow2 BlockDriverStatesnever being directly passed to bdrv_open_common() from bdrv_file_open(),...
iotests: Test new blkdebug/blkverify interface
Add a test for the new blkdebug/blkverify interface.
This test is not written in Python, although it uses QMP. This isbecause it invokes the qemu-io HMP command, which outputs errors tostderr instead of returning them through QMP. Filtering and testing that...
qemu-iotests: Introduce _unsupported_imgopts
Introduce _unsupported_imgopts that causes _notrun for specific imageoptions.
Signed-off-by: Fam Zheng <famz@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-iotests: Add _unsupported_imgopts for vmdk subformats
Some cases are not applicable for vmdk subformats those don't supportcertain features, e.g. backing file, and some others can't run onmult-file image, e.g. monolithicFlat. This adds declaration in test...
qemu-iotests: Clean up all extents for vmdk
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>...
vmdk: Fix big flat extent IO
Local variable "n" as int64_t avoids overflow with large sector numbercalculation. See test case change for failure case.
Signed-off-by: Fam Zheng <famz@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-iotests: Update test cases for commit active
Factor out commit test common logic into super class, and update testof committing the active image.
Signed-off-by: Fam Zheng <famz@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qemu-iotests: drop duplicate virtio-blk initialization failure
Commit 75884afd5c6c42e523b08565e289dbe319e17ad9 ("virtio-blk: Convert toQOM realize") dropped a duplicate error_report() call. Now we no longerget the following error message twice:
QEMU_PROG: -drive if=virtio: Device initialization failed....
vmdk: Check VMFS extent line field number
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 asFLAT, which should be invalid format.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>...
qemu-iotests: filter QEMU monitor \r\n
SMTP does not preserve newlines. This is normally not a problem if theemail body uses DOS or UNIX newlines consistently. In 051.out we mixUNIX newlines with DOS newlines (since QEMU monitor output uses \r\n).
This patch filters the QEMU monitor output so the golden master file...
qemu-iotests: add 058 internal snapshot export with qemu-nbd case
This case can't run when IMGPROTO=nbd, since it needs to create someinternal snapshot which would fail for EOF write request, even whenTEST_IMG is exported with "-f raw" in common.rc, so set _supported_proto...
qemu-iotests: add test for snapshot in qemu-img convert
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qemu-iotests: Split qcow2 only cases in 048
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 newcase.
[Resolved merge conflict due to "qemu-io> " prompt filter, added 074 to...
qemu-iotests: Add "-c <cache-mode>" option
The option sets cache mode used in the tests. "-nocache" is changed toan alias to "-c none", and internally passes "-t none" to qemu-io.
Python scripts will make use of option this in the next commit.
Signed-off-by: Fam Zheng <famz@redhat.com>...
qemu-iotests: Honour cache mode in iotests.py
This will allow overriding cache mode from the "-c mode" option.
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>
qemu-iotests: Add _default_cache_mode and _supported_cache_modes
This replaces _unsupported_qemu_io_options and check for support ofcurrent cache mode, and allow to provide a default if user didn'tspecify.
Signed-off-by: Fam Zheng <famz@redhat.com>Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>...
qemu-iotests: Change default cache mode to "writeback"
So that the tests can run faster.
qemu-iotests: Clean up spaces in usage output
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>
qemu-iotests: 033 is fast
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
vmdk: Fix creating big description file
The buffer for description file was 4096 which only covers a fewhundred of extents. This changes the buffer to dynamic allocated withg_strdup_printf in order to support bigger cases.
qemu-iotests: Add sample image and test for VMDK version 3
qemu-iotests: Filter qemu-io output in 025
Signed-off-by: Fam Zheng <famz@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-iotests: Filter out 'qemu-io> ' prompt
This removes "qemu-io> " prompt from qemu-io output in _filter_qemu_io,and updates all the output files with the following command:
cd tests/qemu-iotests && sed -i "s/qemu-io> //g" *.out
qemu-iotests: Drop local version of cancel_and_wait from 040
iotests.py already has one.
qemu-iotest: Add pause_drive and resume_drive methods
They wrap blkdebug "break" and "remove_break".
Add optional argument "resume" to cancel_and_wait().
qemu-iotests: Make test case 030, 040 and 055 deterministic
Pause the drive and start the block job, so we won't miss the block job.
qemu-iotests: Test snapshot mode
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
qemu-iotests: Fix test 041
Performing multiple drive-mirror blockjobs on the same qemu instanceresults in the image file used for the block device being replaced bythe newly mirrored file, which is not what we want.
Fix this by performing one dedicated test per sync mode....
qemu-img: Fix overwriting 'ret' before using
This patch moves ret assignment after reporting original error.
We were lucky to pass qemu-iotests 048 (qemu-img compare case) but whenI tried to run with TEST_DIR=/tmp (tmpfs), it fails with a "wrong" mismatch offset. This fixes two bugs....
block: Fail if requested driver is not available
If an explicit driver option is present, but doesn't specify a validdriver, then bdrv_open() should fail instead of probing the format.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Jeff Cody <jcody@redhat.com>...
qemu-iotests: Test qcow2 count_contiguous_clusters()
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
block: Print its file name if backing file opening failed
If backing file doesn't exist, the error message is confusing andmisleading:
$ qemu /tmp/a.qcow2 qemu: could not open disk image /tmp/a.qcow2: Could not open file: No such file or directory...
qemu-iotests: Extend 041 for unbacked mirroring
Add a new test case in file 041 for mirroring unbacked images in"absolute-paths" mode. This should work, if possible, but mostimportantly, qemu should never crash.
Signed-off-by: Max Reitz <mreitz@redhat.com>...
block: vhdx - update _make_test_img() to filter out vhdx options
The non-global option output is suppresed in _make_test_img() foroutput verification in the 0?? tests. This adds suppression forthe vhdx-unique options as well. This allows check -vhdx to run...
block: qemu-iotests for vhdx, add write test support
This removes the IMGFMT_GENERIC blocker for read-only, so existingiotests run read/write tests for vhdx images created by qemu-img (e.g.tests 001, 002, 003).
In addition, this updates the sample image test for the Hyper-V...
block: vhdx qemu-iotest - log replay of data sector
This tests the replay of a data sector in a VHDX image file.
The image file is a 10G dynamic image, with 4MB block size. Theimage was created with qemu-img, and the log left unplayed bymodification of the vhdx image format driver....
block: qemu-iotests, add quotes to $TEST_IMG usage io pattern tests
The usage of $TEST_IMG was not properly quoted everywhere incommon.pattern.
Signed-off-by: Jeff Cody <jcody@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block: qemu-iotests, fix _make_test_img() to work with spaced pathnames
_make_test_img() currently works with spaced pathnames only when notspecifying a backing file. This fixes it so that the backing fileargument is properly quoted.
Signed-off-by: Jeff Cody <jcody@redhat.com>...
block: qemu-iotests, add quotes to $TEST_IMG.base usage in 017
$TEST_IMG.base is used unquoted. Add quotes so that pathnames withspaces are supported.
block: qemu-iotests, add quotes to $TEST_IMG usage in 019
There were still instances of $TEST_IMG not being properly quoted.This was in the usage of a string built up for a 'for' loop; modifythe loop so we can quote $TEST_IMG properly.
block: qemu-iotests, removes duplicate double quotes in 039
Test 039 had $TEST_IMG with duplicate double quotes - remove duplicate.
block: qemu-iotests, add quotes to $TEST_IMG usage for 051
There were still a couple of instances of unquoted usage of$TEST_IMG and $TEST_IMG.orig. Quoted these so they will not failon pathnames with spaces in them.
block: qemu-iotests, add quotes to $TEST_IMG usage in 061
When creating images with backing files in the test, the backingfile argument was not quoted properly. This caused the test to failwhen run from a pathname with a space. Pass the backing argument in...
qemu-iotests: Filter out actual image size in 067
The actual size of the image file may differ depending on the Linuxkernel currently running on the host. Filtering out this value makesthis test pass in such cases.
vmdk: Implment bdrv_get_specific_info
Implement .bdrv_get_specific_info to return the extent information.
qemu-iotests: prefill some data to test image
Case 030 occasionally fails because of block job compltes too fast to becaptured by script, and 'unexpected qmp event' of job completion causesthe test failure.
Simply fill in some data to the test image to make this false alarm less...
qemu-iotests: Test case for backing file deletion
Add a test case for trying to open an image file where it is impossibleto open its backing file (in this case, because it was deleted). Whendoing this, qemu (or qemu-io in this case) should not crash but rather...
qemu-iotests: drop duplicated "create_image"
There's a same common function in iotests.py
qemu-iotests: Fix 051 reference output
Commit 684b254 forgot to update it.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-iotests: Test for loading VM state from qcow2
Add a test for saving a VM state from a qcow2 image and loading it back(with having restarted qemu in between); this should work without anyproblems.
Signed-off-by: Max Reitz <mreitz@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-iotests: Check autodel behaviour for device_del
Block devices creates with -drive and drive_add should automaticallydisappear if the guest device is unplugged. blockdev-add ones shouldn't.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Max Reitz <mreitz@redhat.com>...
qemu-iotests: Add test for inactive L2 overlap
Extend 060 by a test which creates a corrupted image with an active L2entry pointing to an inactive L2 table and writes to the correspondingguest offset.
Also, use overlap-check=all for all tests in 060....
vmdk: convert error code to use errp
Convert "fprintf(stderr,..." and standardize error messages:
Remove a few local_error's and use errp.
Remove "VMDK:" or "Vmdk:" prefixes in error message and fix to uppercase.
vmdk: refuse enabling zeroed grain with flat images
This is a header flag and we needs sparse for the header.
blockdev: Remove IF_* check for read-only blockdev_init
IF_NONE allows read-only, which makes forbidding it in this placefor other types pretty much pointless.
Instead, make sure that all devices for which the check would haveerrored out check in their init function that they don't get a read-only...
qemu-iotests: move blank lines of output in case 059
Move the blank line to above the test step banner, so it looks clearerin blocks.
block/raw-posix: Employ error parameter
Make use of the error parameter in the opening and creating functions inblock/raw-posix.c.
qemu-iotests: Discard preallocated zero clusters
Add a new test case for discarding preallocated zero clusters; doingthis should not result in any leaks.
block: qemu-iotests for vhdx, read sample dynamic image
This adds the VHDX format to the qemu-iotests format, and addsa read test. The test reads from an existing sample image, thatwas created with Hyper-V under Windwos Server 2012.
The image file is a 1GB dynamic image, with 32MB blocks....
qemu-iotests: Additional info from qemu-img info
Add a test for the additional information now provided by qemu-img infowhen used on qcow2 images. It also tests the qemu QMP output from thequery-block command when running qemu with different runtime options...
qemu-iotests: Discard specific info in _img_info
In _img_info, filter out additional information specific to the imageformat provided by qemu-img info, since tests designed for multipleimage formats would produce different outputs for every image format...
Merge remote-tracking branch 'stefanha/block' into staging
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>
.gitignore: ignore tests/qemu-iotests/socket_scm_helper
Signed-off-by: Fam Zheng <famz@redhat.com>Reviewed-by: Wenchao Xia<xiawenc@linux.vnet.ibm.com>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
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.
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.
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.
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.
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.
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.
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.