summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-12-04qemu-nbd: add doc for option -fWenchao Xia2-0/+3
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> 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-img: add -l for snapshot in convertWenchao Xia3-15/+45
Now qemu-img convert have similar options as qemu-nbd for internal snapshot. 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-nbd: support internal snapshot exportWenchao Xia4-3/+77
Now it is possible to directly export an internal snapshot, which can be used to probe the snapshot's contents without qemu-img convert. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-04snapshot: distinguish id and name in load_tmpWenchao Xia6-10/+83
Since later this function will be used so improve it. The only caller of it now is qemu-img, and it is not impacted by introduce function bdrv_snapshot_load_tmp_by_id_or_name() that call bdrv_snapshot_load_tmp() twice to keep old search logic. bdrv_snapshot_load_tmp_by_id_or_name() return int to let caller know the errno, and errno will be used later. Also fix a typo in comments of bdrv_snapshot_delete(). 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>
2013-12-04qemu-iotests: Change default cache mode to "writeback"Fam Zheng1-1/+1
So that the tests can run faster. 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: Add _default_cache_mode and _supported_cache_modesFam Zheng4-14/+21
This replaces _unsupported_qemu_io_options and check for support of current cache mode, and allow to provide a default if user didn't specify. 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: Honour cache mode in iotests.pyFam Zheng1-1/+2
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>
2013-12-04qemu-iotests: Add "-c <cache-mode>" optionFam Zheng2-3/+20
The option sets cache mode used in the tests. "-nocache" is changed to an 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> Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-04qcow2: Zero-initialise first cluster for new imagesKevin Wolf1-16/+20
Strictly speaking, this is only required for has_zero_init() == false, but it's easy enough to just do a cluster-aligned write that is padded with zeros after the header. This fixes that after 'qemu-img create' header extensions are attempted to be parsed that are really just random leftover data. Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-04block: Close backing file early in bdrv_img_createMax Reitz1-4/+4
Leaving the backing file open although it is not needed anymore can cause problems if it is opened through a block driver which allows exclusive access only and if the create function of the block driver used for the top image (the one being created) tries to close and reopen the image file (which will include opening the backing file a second time). In particular, this will happen with a backing file opened through qemu-nbd and using qcow2 as the top image file format (which reopens the image to flush it to disk). In addition, the BlockDriverState in bdrv_img_create() is used for the backing file only; it should therefore be made local to the respective block. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03scsi-disk: correctly implement WRITE SAMEPaolo Bonzini1-24/+116
Fetch the data to be written from the input buffer. If it is all zeroes, we can use the write_zeroes call (possibly with the new MAY_UNMAP flag). Otherwise, do as many write cycles as needed, writing 512k at a time. Strictly speaking, this is still incorrect because a zero cluster should only be written if the MAY_UNMAP flag is set. But this is a bug in qcow2 and the other formats, not in the SCSI code. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03scsi-disk: reject ANCHOR=1 for UNMAP and WRITE SAME commandsPaolo Bonzini1-1/+11
Since we report ANC_SUP==0 in VPD page B2h, we need to return an error (ILLEGAL REQUEST/INVALID FIELD IN CDB) for all WRITE SAME requests with ANCHOR==1. Inspired by a similar patch to the LIO in-kernel target. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03scsi-disk: catch write protection errors in UNMAPPaolo Bonzini1-0/+6
This is the same that is already done for WRITE SAME. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03qemu-iotests: 033 is fastPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03raw-posix: add support for write_zeroes on XFS and block devicesPaolo Bonzini2-13/+74
The code is similar to the implementation of discard and write_zeroes with UNMAP. However, failure must be propagated up to block.c. The stale page cache problem can be reproduced as follows: # modprobe scsi-debug lbpws=1 lbprz=1 # ./qemu-io /dev/sdXX qemu-io> write -P 0xcc 0 2M qemu-io> write -z 0 1M qemu-io> read -P 0x00 0 512 Pattern verification failed at offset 0, 512 bytes qemu-io> read -v 0 512 00000000: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc ................ ... # ./qemu-io --cache=none /dev/sdXX qemu-io> write -P 0xcc 0 2M qemu-io> write -z 0 1M qemu-io> read -P 0x00 0 512 qemu-io> read -v 0 512 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ... And similarly with discard instead of "write -z". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03raw-posix: implement write_zeroes with MAY_UNMAP for block devicesPaolo Bonzini1-0/+37
See the next commit for the description of the Linux kernel problem that is worked around in raw_open_common. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03raw-posix: implement write_zeroes with MAY_UNMAP for filesPaolo Bonzini2-2/+65
Writing zeroes to a file can be done by punching a hole if MAY_UNMAP is set. Note that in this case ENOTSUP is not ignored, but makes the block layer fall back to the generic implementation. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block/iscsi: check WRITE SAME support differently depending on MAY_UNMAPPaolo Bonzini1-2/+17
The current check is right for MAY_UNMAP=1. For MAY_UNMAP=0, just try and fall back to regular writes as soon as a WRITE SAME command fails. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block/iscsi: updated copyrightPeter Lieven1-0/+1
added myself to reflect recent work on the iscsi block driver. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block/iscsi: remove .bdrv_has_zero_initPeter Lieven1-7/+0
since commit 3ac21627 the default value changed to 0. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block drivers: expose requirement for write same alignment from formatsPaolo Bonzini3-0/+6
This will let misaligned but large requests use zero clusters. This is important because the cluster size is not guest visible. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block drivers: add discard/write_zeroes properties to bdrv_get_info ↵Paolo Bonzini5-0/+9
implementation Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03vpc, vhdx: add get_infoPaolo Bonzini2-0/+24
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block: make bdrv_co_do_write_zeroes stricter in producing aligned requestsPaolo Bonzini1-12/+23
Right now, bdrv_co_do_write_zeroes will only try to align the beginning of the request. However, it is simpler for many formats to expect the block layer to separate both the head *and* the tail. This makes sure that the format's bdrv_co_write_zeroes function will be called with aligned sector_num and nb_sectors for the bulk of the request. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block: handle ENOTSUP from discard in generic codePaolo Bonzini2-7/+7
Similar to write_zeroes, let the generic code receive a ENOTSUP for discard operations. Since bdrv_discard has advisory semantics, we can just swallow the error. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block: add bdrv_aio_write_zeroesPaolo Bonzini3-0/+15
This will be used by the SCSI layer. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block: add flags argument to bdrv_co_write_zeroes tracepointPaolo Bonzini2-2/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block: add flags to BlockRequestPaolo Bonzini2-6/+12
This lets bdrv_co_do_rw receive flags, so that it can be used for zero writes. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03block: generalize BlockLimits handling to cover bdrv_aio_discard tooPaolo Bonzini1-39/+41
bdrv_co_discard is only covering drivers which have a .bdrv_co_discard() implementation, but not those with .bdrv_aio_discard(). Not very nice, and easy to avoid. Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-03vmdk: Fix creating big description fileFam Zheng3-24/+2055
The buffer for description file was 4096 which only covers a few hundred of extents. This changes the buffer to dynamic allocated with g_strdup_printf in order to support bigger cases. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-02coroutine: remove unused CoQueue AioContextMarc-André Lureau1-1/+0
The AioContext ctx field is apparently unused in qemu codebase since 02ffb504485. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-12-02coroutine: remove qemu_co_queue_wait_insert_headMarc-André Lureau2-14/+0
qemu_co_queue_wait_insert_head() is unused in qemu code base now. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29qemu-iotests: Add sample image and test for VMDK version 3Fam Zheng3-0/+10
Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-11-29vmdk: Allow read only open of VMDK version 3Fam Zheng1-1/+8
Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-11-29qemu-iotests: Filter out 'qemu-io> ' promptFam Zheng19-75552/+75553
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 Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-11-29qemu-iotests: Filter qemu-io output in 025Fam Zheng1-1/+1
Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-11-29block: Use BDRV_O_NO_BACKING where appropriateKevin Wolf3-3/+5
If you open an image temporarily just because you want to check its size or get it flushed, there's no real reason to open the whole backing file chain. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net>
2013-11-29qemu-iotests: Test snapshot modeKevin Wolf2-5/+66
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2013-11-29block: Enable BDRV_O_SNAPSHOT with driver-specific optionsKevin Wolf1-26/+21
In the case of snapshot=on, don't rely on the backing file path in the temporary image any more, but override the backing file with the given set of options. This way, block drivers that don't use a file name can be accessed with snapshot=on, for example: -drive file.driver=nbd,file.host=localhost,snapshot=on Which becomes internally something like: file.filename=/tmp/vl.AWQZCu,backing.file.driver=nbd,backing.file.host=localhost Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-11-29qemu-iotests: Make test case 030, 040 and 055 deterministicFam Zheng3-9/+25
Pause the drive and start the block job, so we won't miss the block job. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29qemu-iotest: Add pause_drive and resume_drive methodsFam Zheng1-1/+17
They wrap blkdebug "break" and "remove_break". Add optional argument "resume" to cancel_and_wait(). Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29blkdebug: add "remove_break" commandFam Zheng5-0/+65
This adds "remove_break" command which is the reverse of blkdebug command "break": it removes all breakpoints with given tag and resumes all the requests. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29qemu-iotests: Drop local version of cancel_and_wait from 040Fam Zheng1-15/+0
iotests.py already has one. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29sheepdog: support user-defined redundancy optionLiu Yuan2-1/+74
Sheepdog support two kinds of redundancy, full replication and erasure coding. # create a fully replicated vdi with x copies -o redundancy=x (1 <= x <= SD_MAX_COPIES) # create a erasure coded vdi with x data strips and y parity strips -o redundancy=x:y (x must be one of {2,4,8,16} and 1 <= y < SD_EC_MAX_STRIP) E.g, to convert a vdi into sheepdog vdi 'test' with 8:3 erasure coding scheme $ qemu-img convert -o redundancy=8:3 linux-0.2.img sheepdog:test Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Liu Yuan <namei.unix@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29sheepdog: refactor do_sd_create()Liu Yuan1-22/+15
We can actually use BDRVSheepdogState *s to pass most of the parameters. Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Liu Yuan <namei.unix@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-11-29qdict: Optimise qdict_do_flatten()Kevin Wolf1-3/+7
Nested QDicts used to be both entered recursively in order to move their entries to the target QDict and also be moved themselves to the target QDict like all other objects. This is harmless because for the top level, qdict_do_flatten() will encounter the (now empty) QDict for a second time and then delete it, but at the same time it's obviously unnecessary overhead. Just delete nested QDicts directly after moving all of their entries. Reported-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>