summaryrefslogtreecommitdiffstats
path: root/qapi
Commit message (Collapse)AuthorAgeFilesLines
* block: delete cow block driverStefan Hajnoczi2014-09-221-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes support for the cow file format. Normally we do not break backwards compatibility but in this case there is no impact and it is the most logical option. Extraordinary claims require extraordinary evidence so I will show why removing the cow block driver is the right thing to do. The cow file format is the disk image format for Usermode Linux, a way of running a Linux system in userspace. The performance of UML was never great and it was hacky, but it enjoyed some popularity before hardware virtualization support became mainstream. QEMU's block/cow.c is supposed to read this image file format. Unfortunately the file format was underspecified: 1. Earlier Linux versions used the MAXPATHLEN constant for the backing filename field. The value of MAXPATHLEN can change, so Linux switched to a 4096 literal but QEMU has a 1024 literal. 2. Padding was not used on the header struct (both in the Linux kernel and in QEMU) so the struct layout varied across architectures. In particular, i386 and x86_64 were different due to int64_t alignment differences. Linux now uses __attribute__((packed)), QEMU does not. Therefore: 1. QEMU cow images do not conform to the Linux cow image file format. 2. cow images cannot be shared between different host architectures. This means QEMU cow images are useless and QEMU has not had bug reports from users actually hitting these issues. Let's get rid of this thing, it serves no purpose and no one will be affected. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-id: 1410877464-20481-1-git-send-email-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi/block-core: Add "new" qcow2 optionsMax Reitz2014-09-221-1/+78
| | | | | | | | | | qcow2 supports more than four options by now, add the new options (overlap check mode and metadata cache size) Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1408557576-14574-5-git-send-email-mreitz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi/block: Add "fatal" to BLOCK_IMAGE_CORRUPTEDMax Reitz2014-09-221-2/+7
| | | | | | | | | | | | | | Not every BLOCK_IMAGE_CORRUPTED event must be fatal; for example, when reading from an image, they should generally not be. Nonetheless, even an image only read from may of course be corrupted and this can be detected during normal operation. In this case, a non-fatal event should be emitted, but the image should not be marked corrupt (in accordance to "fatal" set to false). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1409926039-29044-2-git-send-email-mreitz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi: Sort items in BlockdevOptions definitionFam Zheng2014-09-221-19/+19
| | | | | | | | Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Benoît Canet <benoit.canet@nodalink.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1410415798-20673-4-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi: Sort BlockdevDriver enum data listFam Zheng2014-09-221-5/+5
| | | | | | | | Reviewed-by: Benoît Canet <benoit.canet@nodalink.com> Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1410415798-20673-3-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* block: Introduce "null" driversFam Zheng2014-09-221-2/+17
| | | | | | | | | | | | | | | | | | | | This is an analogue to Linux null_blk. It can be used for testing or benchmarking block device emulation and general block layer functionalities such as coroutines and throttling, where disk IO is not necessary or wanted. Use null-aio:// for AIO version, and null-co:// for coroutine version. [Resolved conflict with Fam's async bdrv_aio_cancel() series: 1. Drop .bdrv_aio_cancel() since it is now done by block.c 2. Rename qemu_aio_release() to qemu_aio_unref() --Stefan] Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Benoît Canet <benoit.canet@nodalink.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1410415798-20673-2-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi: introduce PreallocMode and new PreallocModes full and falloc.Hu Tao2014-09-121-0/+17
| | | | | | | | | | This patch prepares for the subsequent patches. Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: extend BLOCK_IO_ERROR with reason stringLuiz Capitulino2014-09-111-1/+6
| | | | | | | | | | | | | | | BLOCK_IO_ERROR events are logged by libvirt, which helps with post mortem analysis of guests. However, one information that we miss today is a human readable string describing the cause of the I/O error. This commit adds that string it to BLOCK_IO_ERROR. Note that this string is a debugging aid for humans, meaning that it should not parsed by applications. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: extend BLOCK_IO_ERROR event with nospace indicatorLuiz Capitulino2014-09-101-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | Management software, such as RHEV's vdsm, want to be able to allocate disk space on demand. The basic use case is to start a VM with a small disk and then the disk is enlarged when QEMU hits a ENOSPC condition. To this end, the management software has to be notified when QEMU encounters ENOSPC. The solution implemented by this commit is simple: it extends the BLOCK_IO_ERROR with a 'nospace' key, which is true when QEMU is stopped due to ENOSPC. Note that support for querying this event is already present in query-block by means of the 'io-status' key. Also, the new 'nospace' BLOCK_IO_ERROR field shares the same semantics with 'io-status', which basically means that werror= has to be set to either 'stop' or 'enospc' to enable 'nospace'. Finally, this commit also updates the 'io-status' key doc in the schema with a list of supported device models. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* rename parse_enum_option to qapi_enum_parse and make it publicPeter Lieven2014-09-082-1/+35
| | | | | | | | | | | relaxing the license to LGPLv2+ is intentional. Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Benoit Canet <benoit.canet@nodalink.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi: add read-pattern enum for quorumLiu Yuan2014-08-291-1/+19
| | | | | | | | Cc: Eric Blake <eblake@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Benoît Canet <benoit.canet@nodalink.com> Signed-off-by: Liu Yuan <namei.unix@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* QMP: Add support for ArchipelagoChrysostomos Nanakos2014-08-151-1/+34
| | | | | | | | | | | | | | | | | | | | | | Introduce new enum BlockdevOptionsArchipelago. @volume: #Name of the Archipelago volume image @mport: #'mport' is the port number on which mapperd is listening. This is optional and if not specified, QEMU will make Archipelago to use the default port. @vport: #'vport' is the port number on which vlmcd is listening. This is optional and if not specified, QEMU will make Archipelago to use the default port. @segment: #optional The name of the shared memory segment Archipelago stack is using. This is optional and if not specified, QEMU will make Archipelago use the default value, 'archipelago'. Signed-off-by: Chrysostomos Nanakos <cnanakos@grnet.gr> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-img info: show nocow infoChunyan Liu2014-08-151-1/+4
| | | | | | | | | Add nocow info in 'qemu-img info' output to show whether the file currently has NOCOW flag set or not. Signed-off-by: Chunyan Liu <cyliu@suse.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* block: add backing-file option to block-streamJeff Cody2014-07-011-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some image chains, QEMU may not always be able to resolve the filenames properly, when updating the backing file of an image after a block job. For instance, certain relative pathnames may fail, or drives may have been specified originally by file descriptor (e.g. /dev/fd/???), or a relative protocol pathname may have been used. In these instances, QEMU may lack the information to be able to make the correct choice, but the user or management layer most likely does have that knowledge. With this extension to the block-stream api, the user is able to change the backing file of the active layer as part of the block-stream operation. This allows the change to be 'safe', in the sense that if the attempt to write the active image metadata fails, then the block-stream operation returns failure, without disrupting the guest. If a backing file string is not specified in the command, the backing file string to use is determined in the same manner as it was previously. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* block: extend block-commit to accept a string for the backing fileJeff Cody2014-07-011-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some image chains, QEMU may not always be able to resolve the filenames properly, when updating the backing file of an image after a block commit. For instance, certain relative pathnames may fail, or drives may have been specified originally by file descriptor (e.g. /dev/fd/???), or a relative protocol pathname may have been used. In these instances, QEMU may lack the information to be able to make the correct choice, but the user or management layer most likely does have that knowledge. With this extension to the block-commit api, the user is able to change the backing file of the overlay image as part of the block-commit operation. This allows the change to be 'safe', in the sense that if the attempt to write the overlay image metadata fails, then the block-commit operation returns failure, without disrupting the guest. If the commit top is the active layer, then specifying the backing file string will be treated as an error (there is no overlay image to modify in that case). If a backing file string is not specified in the command, the backing file string to use is determined in the same manner as it was previously. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* block: add QAPI command to allow live backing file changeJeff Cody2014-07-011-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows a user to make a live change to the backing file recorded in an open image. The image file to modify can be specified 2 ways: 1) image filename 2) image node-name Note: this does not cause the backing file itself to be reopened; it merely changes the backing filename in the image file structure, and in internal BDS structures. It is the responsibility of the user to pass a filename string that can be resolved when the image chain is reopened, and the filename string is not validated. A good analogy for this command is that it is a live version of 'qemu-img rebase -u', with respect to changing the backing file string. [Jeff is offline so I respun this patch in his absence. Dropped image filename since using node-name is preferred and this is a new command. No need to introduce the limitations of finding images by filename. --Stefan] Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi: Change back sector-count to sectors-count in quorum QAPI events.Benoît Canet2014-07-011-4/+4
| | | | | | | | | | | fe069d9d had aligned code and documentation while dropping the s from the actual JSON output. Fix that. This also fix test/qemu-iotest/081 since the missing s was causing a permutation. Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* block: make 'top' argument to block-commit optionalJeff Cody2014-07-011-3/+4
| | | | | | | | | | | | | | | | Now that active layer block-commit is supported, the 'top' argument no longer needs to be mandatory. Change it to optional, with the default being the active layer in the device chain. [kwolf: Rebased and resolved conflict in tests/qemu-iotests/040] Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into stagingPeter Maydell2014-06-291-3/+27
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Block patches for 2.1.0-rc0 # gpg: Signature made Fri 27 Jun 2014 19:50:32 BST using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (47 commits) iotests: Fix 083 for out-of-tree builds iotests: Drop Python version from 065's Shebang iotests: Use $PYTHON for Python scripts iotests: Source common.env configure: Enable out-of-tree iotests iotests: Allow out-of-tree run block.c: Don't return success for bdrv_append_temp_snapshot() failure qemu-iotests: Add TestRepairQuorum to 041 to test drive-mirror node-name mode. block: Add replaces argument to drive-mirror blockjob: Fix recent BLOCK_JOB_ERROR regression blockjob: Fix recent BLOCK_JOB_READY regression virtio-blk: Rename complete_request_early to complete_request_vring virtio-blk: Unify {non-,}dataplane's request handlings virtio-blk: Schedule BH in the right context virtio-blk: Export request handling functions to dataplane virtio-blk: Make request completion function virtual block: acquire AioContext in qmp_query_blockstats() block: make bdrv_query_stats() static virtio-blk: Fix and clean up the in_sg and out_sg check virtio-blk: Fill in VirtIOBlockReq.out in dataplane code ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * block: Add replaces argument to drive-mirrorBenoît Canet2014-06-271-1/+5
| | | | | | | | | | | | | | | | drive-mirror will bdrv_swap the new BDS named node-name with the one pointed by replaces when the mirroring is finished. Signed-off-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * blockjob: Fix recent BLOCK_JOB_ERROR regressionMarkus Armbruster2014-06-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | Commit 5a2d2cb screwed up the the value of members device and action, breaking tests/qemu-iotests/041. Signed-off-by: Markus Armbruster <armbru@redhat.com> Tested-By: Benoit Canet <benoit@irqsave.net> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * blockjob: Fix recent BLOCK_JOB_READY regressionMarkus Armbruster2014-06-271-1/+14
| | | | | | | | | | | | | | | | | | | | | | Commit bcada37 dropped the (up to now undocumented) members type, len, offset, speed, breaking tests/qemu-iotests/040 and 041. Restore and document them. This fixes 040, and partially fixes 041. Signed-off-by: Markus Armbruster <armbru@redhat.com> Tested-By: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Add node-name argument to drive-mirrorBenoît Canet2014-06-271-0/+4
| | | | | | | | | | | | | | | | This new argument can be used to specify the node-name of the new mirrored BDS. Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * quorum: Add the rewrite-corrupted parameter to quorumBenoît Canet2014-06-271-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | On read operations when this parameter is set and some replicas are corrupted while quorum can be reached quorum will proceed to rewrite the correct version of the data to fix the corrupted replicas. This will shine with SSD where the FTL will remap the same block at another place on rewrite. Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* | virtio-serial: report frontend connection state via monitorLaszlo Ersek2014-06-271-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | Libvirt wants to know about the guest-side connection state of some virtio-serial ports (in particular the one(s) assigned to guest agent(s)). Report such states with a new monitor event. RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1080376 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* | qapi event: clean up in callersWenchao Xia2014-06-272-3/+4
| | | | | | | | | | | | | | | | | | This patch improves docs and address small issues in event callers. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* | qapi: move event definesWenchao Xia2014-06-271-0/+318
|/ | | | | | Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into stagingPeter Maydell2014-06-244-0/+239
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remotes/qmp-unstable/queue/qmp: (43 commits) monitor: protect event emission monitor: protect outbuf and mux_out with mutex qemu-char: make writes thread-safe qemu-char: move pty_chr_update_read_handler around qemu-char: do not call chr_write directly qemu-char: introduce qemu_chr_alloc qapi event: clean up qapi event: convert QUORUM events qapi event: convert GUEST_PANICKED qapi event: convert BALLOON_CHANGE qmp: convert ACPI_DEVICE_OST event qapi event: convert SPICE events qapi event: convert VNC events qapi event: convert NIC_RX_FILTER_CHANGED qapi event: convert other BLOCK_JOB events qapi event: convert BLOCK_IMAGE_CORRUPTED qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR qapi event: convert DEVICE_TRAY_MOVED qapi event: convert DEVICE_DELETED qapi event: convert WATCHDOG ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * qapi event: convert other BLOCK_JOB eventsWenchao Xia2014-06-231-0/+71
| | | | | | | | | | | | | | | | | | | | | | Since BLOCK_JOB_COMPLETED, BLOCK_JOB_CANCELLED, BLOCK_JOB_READY are related, convert them in one patch. The block_job_event_* functions are used to keep encapsulation of BlockJob structure. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
| * qapi event: convert BLOCK_IMAGE_CORRUPTEDWenchao Xia2014-06-231-0/+24
| | | | | | | | | | | | | | Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
| * qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERRORWenchao Xia2014-06-231-0/+39
| | | | | | | | | | | | | | Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
| * qapi event: convert DEVICE_TRAY_MOVEDWenchao Xia2014-06-231-0/+14
| | | | | | | | | | | | | | Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
| * qapi: adjust existing definesWenchao Xia2014-06-231-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to let event defines use existing types later, instead of redefine new ones, some old type defines for spice and vnc are changed, and BlockErrorAction is moved from block.h to qapi schema. Note that BlockErrorAction is not merged with BlockdevOnError. At this point, VncInfo is not made a child of VncBasicInfo, because VncBasicInfo has mandatory fields where VncInfo makes them optional. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
| * qapi: add event helper functionsWenchao Xia2014-06-232-0/+75
| | | | | | | | | | | | | | | | | | This file holds some functions that do not need to be generated. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* | qapi/string-output-visitor: fix human outputHu Tao2014-06-231-1/+1
|/ | | | | | | | | | | "0x1-0x10" looks better than "0x1-10" Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi/string-output-visitor: fix bugsMichael S. Tsirkin2014-06-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | in human mode, we are creating the string: 16-31 (16-31) instead of 16-17 (10-1f) because we forgot to pass 'true' as the human parameter on one of the two calls to format_string. Also, this is a worsening of quality; previously we would produce 16 (0x10) to make it obvious which number was hex. Fix these issues. Reported-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi: fix input visitor bugsMichael S. Tsirkin2014-06-191-5/+4
| | | | | | | | | Remove dead code. Reset errno to 0 before each strtoull call, as the man page requires. Reported-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi: fix build on glib < 2.28Michael S. Tsirkin2014-06-192-4/+17
| | | | | | | | | | | | | The following commits: qapi: make string output visitor parse int list qapi: make string input visitor parse int list break with glib < 2.28 since they use the new g_list_free_full function. Open-code that to fix build on old systems. Cc: Hu Tao <hutao@cn.fujitsu.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* qapi: make string output visitor parse int listHu Tao2014-06-191-10/+219
| | | | | | | | | Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> MST: split up patch
* qapi: make string input visitor parse int listHu Tao2014-06-191-8/+187
| | | | | | | | | Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> MST: split up patch
* QemuOpts: change opt->name|str from (const char *) to (char *)Chunyan Liu2014-06-161-3/+7
| | | | | | | | | | | | | qemu_opt_del() already assumes that all QemuOpt instances contain malloc'd name and value; but it had to cast away const because opts_start_struct() was doing its own thing and using static storage instead. By using the correct type and malloced strings everywhere, the usage of this struct becomes clearer. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Leandro Dorileo <l@dorileo.org> Signed-off-by: Chunyan Liu <cyliu@suse.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi: Extract qapi/block.json definitionsBenoît Canet2014-06-061-0/+159
| | | | | | Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi: Extract qapi/block-core.json definitionsBenoît Canet2014-06-061-0/+1406
| | | | | | Signed-off-by: Benoit Canet <benoit@irqsave.net Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi: create two block related json modulesBenoît Canet2014-06-062-0/+13
| | | | | | | | | | | | | | qapi/block-core.json contains block definitions unrelated to emulation. qapi/block.json is a superset of the previous and contains definitions related to emulation. The purpose of these extractions is to be able to hook qapi/block-core.json generated code on qemu-nbd. Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi: Extract qapi/common.json definitionsBenoît Canet2014-06-061-0/+89
| | | | | | Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi: Avoid output visitor crashing if it encounters a NULL valueMarcel Apfelbaum2014-05-281-0/+6
| | | | | | | | | | | | | A NULL value is not added to visitor's stack, but there is no check for that when the visitor tries to return that value, leading to QEMU crash. Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qapi: Replace uncommon use of the error API by the common oneMarkus Armbruster2014-05-151-130/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We commonly use the error API like this: err = NULL; foo(..., &err); if (err) { goto out; } bar(..., &err); Every error source is checked separately. The second function is only called when the first one succeeds. Both functions are free to pass their argument to error_set(). Because error_set() asserts no error has been set, this effectively means they must not be called with an error set. The qapi-generated code uses the error API differently: // *errp was initialized to NULL somewhere up the call chain frob(..., errp); gnat(..., errp); Errors accumulate in *errp: first error wins, subsequent errors get dropped. To make this work, the second function does nothing when called with an error set. Requires non-null errp, or else the second function can't see the first one fail. This usage has also bled into visitor tests, and two device model object property getters rtc_get_date() and balloon_stats_get_all(). With the "accumulate" technique, you need fewer error checks in callers, and buy that with an error check in every callee. Can be nice. However, mixing the two techniques is confusing. You can't use the "accumulate" technique with functions designed for the "check separately" technique. You can use the "check separately" technique with functions designed for the "accumulate" technique, but then error_set() can't catch you setting an error more than once. Standardize on the "check separately" technique for now, because it's overwhelmingly prevalent. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* qapi: Replace start_optional()/end_optional() by optional()Markus Armbruster2014-05-154-20/+12
| | | | | | | | | | | | | | | | | | | | | | | Semantics of end_optional() differ subtly from the other end_FOO() callbacks: when start_FOO() succeeds, the matching end_FOO() gets called regardless of what happens in between. end_optional() gets called only when everything in between succeeds as well. Entirely undocumented, like all of the visitor API. The only user of Visitor Callback end_optional() never did anything, and was removed in commit 9f9ab46. I'm about to clean up error handling in the generated visitor code, and end_optional() is in my way. No users mean no test cases, and making non-trivial cleanup transformations without test cases doesn't strike me as a good idea. Drop end_optional(), and rename start_optional() to optional(). We can always go back to a pair of callbacks when we have an actual need. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* qapi: Remove unused Visitor callbacks start_handle(), end_handle()Markus Armbruster2014-05-151-15/+0
| | | | | | | | | These have never been called or implemented by anything, and their intended use is undocumented, like all of the visitor API. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()"Peter Lieven2014-05-091-1/+3
| | | | | | | | | | | | | | | | | | This reverts commit 25a7017555f1b4aeb543b5d323ff4afb8f9c5437. Turns out the argument *can* be null: QEMU now segfaults if it receives an invalid parameter via a qmp command instead of throwing an error. For example: { "execute": "blockdev-add", "arguments": { "options" : { "driver": "invalid-driver" } } } CC: qemu-stable@nongnu.org Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
OpenPOWER on IntegriCloud