summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-10-11qapi-types/visit.py: Inheritance for structsKevin Wolf3-2/+37
This introduces a new 'base' key for struct definitions that refers to another struct type. On the JSON level, the fields of the base type are included directly into the same namespace as the fields of the defined type, like with unions. On the C level, a pointer to a struct of the base type is included. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2013-10-11qapi-types/visit.py: Pass whole expr dict for structsKevin Wolf2-5/+14
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2013-10-11vmdk: refuse enabling zeroed grain with flat imagesFam Zheng3-0/+12
This is a header flag and we needs sparse for the header. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11vmdk: convert error code to use errpFam Zheng2-59/+63
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 upper case. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11build: add command check-cleanWenchao Xia2-2/+7
This command will package the clean operations in tests. Now root Makefile simply calls the command and do not care the details of it any more. Original the built binaries for test will not be removed, now they will be deleted in clean operation. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11tests: build the helper program by defaultWenchao Xia1-1/+7
Usually we may configure and make, then goto ./tests/qemu-iotest, check. In this case an error will happen since helper program was not built. This patch simply build it by default. A better way may be introducing Makefile in ./tests/qemu-iotest, but it is more complicate to handle out of tree case, and a bit overkill for a single file now, we can do that when more files come. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11block/raw-posix: Employ error parameterMax Reitz2-16/+58
Make use of the error parameter in the opening and creating functions in block/raw-posix.c. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qemu-iotests: move blank lines of output in case 059Fam Zheng2-8/+8
Move the blank line to above the test step banner, so it looks clearer in blocks. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11blkverify: Employ error parameterMax Reitz1-6/+5
Make use of the error parameter in blkverify_open. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11blkdebug: Employ error parameterMax Reitz1-4/+4
Make use of the error parameter in blkdebug_open. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11block/raw-win32: Employ error parameterMax Reitz1-5/+11
Make use of the error parameter in the opening and creating functions in block/raw-win32.c. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11block/raw_bsd: Employ error parameterMax Reitz1-2/+1
Propagate errors in raw_create rather than directly reporting and afterwards discarding them. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Evaluate overlap check optionsMax Reitz1-1/+28
Evaluate the runtime overlap check options and set BDRVQcowState.overlap_check appropriately. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Add more overlap check bitmask macrosMax Reitz1-3/+11
Introduces the macros QCOW2_OL_CONSTANT and QCOW2_OL_ALL in addition to the already existing QCOW2_OL_CACHED, signifying all metadata overlap checks that can be performed in constant time (regardless of image size etc.) and truly all available overlap checks, respectively. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Array assigning options to OL check bitsMax Reitz1-0/+11
Add an array which assigns the option string to its corresponding overlap check bit. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Add overlap-check optionsMax Reitz2-0/+55
Add runtime options to tune the overlap checks to be performed before write accesses. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Make overlap check mask variableMax Reitz3-4/+5
Replace the QCOW2_OL_DEFAULT macro by a variable overlap_check in BDRVQcowState. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Use negated overflow check maskMax Reitz6-38/+29
In qcow2_check_metadata_overlap and qcow2_pre_write_overlap_check, change the parameter signifying the checks to perform from its current positive form to a negative one, i.e., it will no longer explicitly specify every check to perform but rather a mask of checks not to perform. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11block: Improve driver whitelist checksKevin Wolf2-9/+9
The main intent of this patch is to consolidate the whitelist checks to a single point in the code instead of spreading it everywhere. This adds a nicer error message for read-only whitelisting, too, in places where it was still missing. The patch also contains a bonus bug fix: By finding the format first in bdrv_open() and then independently checking against the whitelist only later, we avoid the case that use of a non-whitelisted format results in probing rather than an error message. Previously, this could happen when using the driver=... option. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com>
2013-10-11qcow2: Use better type for numerical snapshot IDMax Reitz1-2/+3
When trying to find a new snapshot ID, the existing ones are converted to integers using strtoul. This function returns an unsigned long, therefore its result should be saved in an unsigned long as well. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Fix snapshot restoration in snapshot_createMax Reitz1-0/+1
If the new snapshot table could not be written in qcow2_snapshot_create, the old snapshot table has to be restored in memory and the new one released. This should include restoration of the old snapshot count as well, which is added by this patch. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Remove wrong metadata overlap checkMax Reitz1-8/+0
In qcow2_write_compressed, if the compression fails, a normal cluster is written to disk. This is done through bdrv_write on the qcow2 BDS itself (using the guest offset), thus it is wrong to do a metadata overlap check before. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Add missing space in error messageMax Reitz1-1/+1
The error message in qcow2_downgrade about an unsupported refcount order is missing a space. This patch adds it. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11block: qemu-iotests for vhdx, read sample dynamic imageJeff Cody6-1/+86
This adds the VHDX format to the qemu-iotests format, and adds a read test. The test reads from an existing sample image, that was created with Hyper-V under Windwos Server 2012. The image file is a 1GB dynamic image, with 32MB blocks. The pattern 0xa5 exists from 0MB-33MB (past a block size boundary) The pattern 0x96 exists from 33MB-66MB (past another block boundary, and leaving a partial blank block) From 66MB-1024MB, all reads should return 0. Although 1GB dynamic image with 66MB of data, the bzip2'ed image file size is only 874 bytes. This also adds in the IMGFMT_GENERIC flag, so r/o images can be tested (e.g. ./check -vhdx) without failing tests that assume r/w support. Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11ahci: set ahci mode on resetMichael S. Tsirkin1-1/+9
ATM we set AHCI mode on 1st GHC write. Spec says we should set it on reset. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qemu-iotests: Discard preallocated zero clustersMax Reitz3-0/+77
Add a new test case for discarding preallocated zero clusters; doing this should not result in any leaks. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11block: Add BlockDriver.bdrv_check_ext_snapshot.Benoît Canet5-0/+46
This field is used by blkverify to disable external snapshots creation. It will also be used by block filters like quorum to disable external snapshot creation. Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11block/get_block_status: avoid redundant callouts on raw devicesPeter Lieven3-1/+13
if a raw device like an iscsi target or host device is used the current implementation makes a second call out to get the block status of bs->file. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Assert against snapshot name/ID overflowMax Reitz1-0/+1
qcow2_write_snapshots relies on the length of every snapshot ID and name fitting into an unsigned 16 bit integer. This is currently ensured by QEMU through generally only allowing 128 byte IDs and 256 byte names. However, if this should change in the future, the length written to the image file should not be silently truncated (though the name itself would be written completely). Since this is currently not an issue but might require attention due to internal QEMU changes in the future, an assert ensuring sanity is enough for now. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Free allocated snapshot table on errorMax Reitz1-0/+4
If an error occurs during qcow2_write_snapshots, the newly allocated snapshot table clusters are leaked and should thus be freed. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Always use error path on writing snapshotsMax Reitz1-3/+4
qcow2_write_snapshots does contain a fail label and there is no reason not to use it on some errors; therefore, we should always jump there on error. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Free preallocated zero clustersMax Reitz1-3/+5
In qcow2_free_any_clusters, preallocated zero clusters should be freed just as normal clusters are. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Use pread for inactive L1 in overlap checkMax Reitz1-4/+3
Currently, qcow2_check_metadata_overlap uses bdrv_read to read inactive L1 tables from disk. The number of sectors to read is calculated through a truncating integer division, therefore, if the L1 table size is not a multiple of the sector size, the final entries will not be read and their entries in memory remain undefined (from the g_malloc). Using bdrv_pread fixes this. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Alignment of snapshot table entriesMax Reitz1-0/+3
The qcow2 specification does not explicitly state so far that every snapshot table entry is aligned to 8 bytes. QEMU, in contrast, does this alignment, thus it should be properly documented (which this patch does). Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qemu-iotests: Additional info from qemu-img infoMax Reitz4-0/+135
Add a test for the additional information now provided by qemu-img info when used on qcow2 images. It also tests the qemu QMP output from the query-block command when running qemu with different runtime options than specified in the image (ImageInfoSpecific should always refer to the image). Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qemu-iotests: Discard specific info in _img_infoMax Reitz1-1/+19
In _img_info, filter out additional information specific to the image format provided by qemu-img info, since tests designed for multiple image formats would produce different outputs for every image format otherwise. In a human-readable dump, that new information will always be last for each "image information block" (multiple blocks are emitted when inspecting the backing file chain). Every block is separated by an empty line. Therefore, in this case, everything starting with the line "Format specific information:" up to that empty line (or EOF, if it is the last block) has to be stripped. The JSON dump will always emit pretty JSON data. Therefore, the opening and closing braces of every object will be on lines which are indented by exactly the same amount, and all lines in between will have more indentation. Thus, in this case, everything starting with a line matching the regular expression /^ *"format-specific": {/ until /^ *},?/ has to be stripped, where the number of spaces at the beginning of the respective lines is equal. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qcow2: Add support for ImageInfoSpecificMax Reitz2-0/+44
Add a new ImageInfoSpecificQCow2 type as a subtype of ImageInfoSpecific. This contains the compatibility level as a string and an optional lazy_refcounts boolean (optional means mandatory for compat >= 1.1 and not available for compat == 0.10). Also, add qcow2_get_specific_info, which returns this information. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11block/qapi: Human-readable ImageInfoSpecific dumpMax Reitz3-0/+132
Add a function for generically dumping the ImageInfoSpecific information in a human-readable format to block/qapi.c. Use this function in bdrv_image_info_dump and qemu-io-cmds.c:info_f to allow qemu-img info resp. qemu-io -c info to print that format specific information. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11block: Add bdrv_get_specific_infoMax Reitz4-0/+14
Add a function for retrieving an ImageInfoSpecific object from a block driver. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qapi: Add ImageInfoSpecific typeMax Reitz1-1/+17
Add a new type ImageInfoSpecific as a union for image format specific information in ImageInfo. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qapi: make use of new BlockJobTypeFam Zheng6-7/+7
Switch the string to enum type BlockJobType in BlockJobDriver. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11qapi: Introduce enum BlockJobTypeFam Zheng1-0/+18
This will replace the open coded block job type string for mirror, commit and backup. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-11blockjob: rename BlockJobType to BlockJobDriverFam Zheng6-25/+25
We will use BlockJobType as the enum type name of block jobs in QAPI, rename current BlockJobType to BlockJobDriver, which will eventually become a set of operations, similar to block drivers. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-10-10Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into stagingAnthony Liguori18-77/+46
QOM CPUState refactorings / X86CPU * Fix for X86CPU model field of qemu32/qemu64 CPU models * Bug fix for longjmp on FreeBSD * Removal of unused function * Confinement of clone syscall infrastructure to linux-user # gpg: Signature made Wed 09 Oct 2013 03:40:51 AM PDT using RSA key ID 3E7E013F # gpg: Can't check signature: public key not found # By Andreas Färber (2) and others # Via Andreas Färber * afaerber/tags/qom-cpu-for-anthony: cpu: Drop cpu_model_str from CPU_COMMON cpu: Move cpu_copy() into linux-user cputlb: Remove dead function tlb_update_dirty() cpu-exec: Also reload CPUClass *cc after longjmp return in cpu_exec() target-i386: Set model=6 on qemu64 & qemu32 CPU models
2013-10-10Merge remote-tracking branch 'amit/char-remove-watch-on-unplug' into stagingAnthony Liguori2-51/+32
# By Amit Shah # Via Amit Shah * amit/char-remove-watch-on-unplug: char: remove watch callback on chardev detach from frontend char: use common function to disable callbacks on chardev close char: move backends' io watch tag to CharDriverState Message-id: 20131004154802.GA25646@grmbl.mre Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-10-10Merge remote-tracking branch 'otubo/seccomp' into stagingAnthony Liguori1-0/+1
# By Eduardo Otubo # Via Eduardo Otubo * otubo/seccomp: seccomp: fine tuning whitelist by adding times() Message-id: 1380047458-21673-1-git-send-email-otubo@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-10-10Merge remote-tracking branch 'mcayland/qemu-openbios' into stagingAnthony Liguori5-1/+1
* mcayland/qemu-openbios: Update OpenBIOS images Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-10-10Merge remote-tracking branch 'sstabellini/xen-2013-10-10' into stagingAnthony Liguori3-14/+8
# By Matthew Daley (1) and Roger Pau Monné (1) # Via Stefano Stabellini * sstabellini/xen-2013-10-10: qemu/xen: make use of xenstore relative paths xen_disk: mark ioreq as mapped before unmapping in error case
2013-10-10Merge remote-tracking branch 'bonzini/scsi-next' into stagingAnthony Liguori3-14/+39
# By Asias He (1) and Peter Lieven (1) # Via Paolo Bonzini * bonzini/scsi-next: scsi: Allocate SCSITargetReq r->buf dynamically [CVE-2013-4344] block/iscsi: reenable iscsi_co_get_block_status Message-id: 1381332391-8781-1-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-10-10Update email addressAnthony Liguori1-7/+7
Amazon is now funding my work as QEMU maintainer so update addresses accordingly. Signed-off-by: Anthony Liguori <aliguori@amazon.com>