History | View | Annotate | Download (67.3 kB)
blockdev: fix drive_init() opts and bs_opts leaks
These memory leaks also make drive_add if=none,id=drive0 without a file=option leak the options list. This keeps ID "drive0" around forever.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
blockdev: fix cdrom read_only flag
Since 0ebd24e0, cdrom doesn't have read-only on by default, which willerror out when using an read only image. Fix it by setting the defaultvalue when parsing opts.
Reported-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>...
blockdev: Remove 'media' parameter from blockdev_init()
The remaining users shouldn't be there with blockdev-add and are easy tomove to drive_init().
Bonus bug fix: As a side effect, CD-ROM drives can now use block driverson the read-only whitelist without explicitly specifying read-only=on,...
blockdev: Don't disable COR automatically with blockdev-add
If a read-only device is configured with copy-on-read=on, the old codeonly prints a warning and automatically disables copy on read. Make ita real error for blockdev-add.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
blockdev: blockdev_init() error conversion
This gives us meaningful error messages for the blockdev-add QMPcommand.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Max Reitz <mreitz@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
blockdev: Introduce DriveInfo.enable_auto_del
BlockDriverStates shouldn't be affected by an unplugged guest device,except if created with the legacy -drive command line option or thedrive_add HMP command.
Make the automatic deletion as well as cancelling of jobs conditional on...
blockdev: 'blockdev-add' QMP command
For examples see the changes to qmp-commands.hx.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev: Separate ID generation from DriveInfo creation
blockdev-add shouldn't automatically generate IDs, but will keep most ofthe DriveInfo creation code.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Max Reitz <mreitz@redhat.com>Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>...
blockdev: Pass QDict to blockdev_init()
Working on a QDict instead of a QemuOpts that accepts anything is morein line with bdrv_open(). A QDict is what qmp_blockdev_add() already hasanyway, so this saves additional conversions. And last, but not least,...
blockdev: Move parsing of 'media' option to drive_init
This moves as much as possible of the processing of the 'media' optionto drive_init so that it can only be accessed using legacy functions,but never with anything blockdev-add related.
blockdev: Move parsing of 'if' option to drive_init
It's always IF_NONE for blockdev-add.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Benoit Canet <benoit@irqsave.net>Reviewed-by: Eric Blake <eblake@redhat.com>
blockdev: Moving parsing of geometry options to drive_init
This moves all of the geometry options (cyls/heads/secs/trans) todrive_init so that they can only be accessed using legacy functions, butnever with anything blockdev-add related.
blockdev: Move parsing of 'boot' option to drive_init
It's already ignored and only prints a deprecation message. No use inmaking it available in new interfaces.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
blockdev: Move bus/unit/index processing to drive_init
This requires moving the automatic ID generation at the same time, solet's do that as well.
blockdev: Move virtio-blk device creation to drive_init
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...
block: Improve driver whitelist checks
The main intent of this patch is to consolidate the whitelist checks toa single point in the code instead of spreading it everywhere. This addsa nicer error message for read-only whitelisting, too, in places where...
block: Add BlockDriver.bdrv_check_ext_snapshot.
This field is used by blkverify to disable external snapshots creation.It will also be used by block filters like quorum to disable externalsnapshot creation.
Signed-off-by: Benoit Canet <benoit@irqsave.net>...
block: Remove unused assignment (fixes warning from clang)
blockdev.c:1929:13: warning: Value stored to 'ret' is never read ret = 0; ^ ~
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
blockdev: do not default cache.no-flush to true
That's why all my VMs were so fast lately. :)
This changed in 1.6.0 by mistake in patch 29c4e2b (blockdev: Split up'cache' option, 2013-07-18).
Cc: qemu-stable@nongnu.orgSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>...
block: Assert validity of BdrvActionOps
In qmp_transaction, assert that the BdrvActionOps to be used is actuallyvalid.
This assertion failing is very improbable, however, it might happen, ifa new TransactionActionKind is introduced "out of order" and the...
block: Error parameter for open functions
Add an Error ** parameter to bdrv_open, bdrv_file_open and associatedfunctions to allow more specific error messages.
Signed-off-by: Max Reitz <mreitz@redhat.com>
qmp: add internal snapshot support in qmp_transaction
Unlike savevm, the qmp_transaction interface will not generatesnapshot name automatically, saving trouble to return informationof the new created snapshot.
Although qcow2 support storing multiple snapshots with same name...
qmp: add interface blockdev-snapshot-internal-sync
Snapshot ID can't be specified in this interface.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qmp: add interface blockdev-snapshot-delete-internal-sync
This interface use id and name as optional parameters, to handle thecase that one image contain multiple snapshots with same name whichmay be '', but with different id.
Adding parameter id is for historical compatiability reason, and...
block: make bdrv_delete() static
Manage BlockDriverState lifecycle with refcnt, so bdrv_delete() is nolonger public and should be called by bdrv_unref() if refcnt isdecreased to 0.
This is an identical change because effectively, there's no multiplereference of BDS now: no caller of bdrv_ref() yet, only bdrv_new() sets...
block: use BDS ref for block jobs
Block jobs used drive_get_ref(drive_get_by_blockdev(bs)) to avoid BDSbeing deleted. Now we have BDS reference count, and block jobs don'tcare about dinfo, so replace them to get cleaner code. It is also thesafe way when BDS has no drive info....
block: Enable the new throttling code in the block layer.
Signed-off-by: Benoit Canet <benoit@irqsave.net>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block: Add support for throttling burst max in QMP and the command line.
The max parameter of the leaky bucket throttling algorithm can be used toallow the guest to do bursts.The max value is a pool of I/O that the guest can use without being throttled...
block: Add iops_size to do the iops accounting for a given io size.
This feature can be used in case where users are avoiding the iops limit bydoing jumbo I/Os hammering the storage backend.
Revert "block: Disable driver-specific options for 1.6"
This reverts commit 8afaefb8919dc8746a57c450a758717c516c7b0a.
aio / timers: Switch entire codebase to the new timer API
This is an autogenerated patch using scripts/switch-timer-api.
Switch the entire code base to using the new timer API.
Note this patch may introduce some line length issues.
Signed-off-by: Alex Bligh <alex@alex.org.uk>...
block: better error message for read only format name
When user tries to use read-only whitelist format in the command lineoption, failure message was "'foo' invalid format". It might be invalidonly for writable, but valid for read-only, so it is confusing. Give the...
block: Dont ignore previously set bdrv_flags
bdrv_flags is set by bdrv_parse_discard_flags(), but later it is resetto zero.
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>Message-id: 1376483201-13466-1-git-send-email-mohan@in.ibm.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
block: Bugfix 'format' and 'snapshot' used in drive option
When use -drive file='xxx',format=qcow2,snapshot=on the errormessage "Can't use snapshot=on with driver-specific options" can be show, and fail to start the qemu.
This should not be happened, and there is no file.driver option...
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...
misc: Use g_assert_not_reached for code which is expected to be unreachable
The macro g_assert_not_reached is a better self documenting replacementfor assert(0) or assert(false).
blockdev: Split up 'cache' option
The old 'cache' option really encodes three different boolean flags intoa cache mode name, without providing all combinations. Make them threeseparate options instead and translate the old option to the new onesfor drive_init()....
Implement sync modes for drive-backup.
This patch adds sync-modes to the drive-backup interface andimplements the FULL, NONE and TOP modes of synchronization.
FULL performs as before copying the entire contents of the drivewhile preserving the point-in-time using CoW....
blockdev: Rename 'readonly' option to 'read-only'
Option name cleanup before it becomes a QMP API.
block: Allow "driver" option on the top level
This is traditionally -drive format=..., which is now translated intothe new driver option. This gives us a more consistent way to select thedriver of BlockDriverStates that can be used in QMP context, too....
blockdev: Rename I/O throttling options for QMP
In QMP, we want to use dashes instead of underscores in QMP argumentnames, and use nested options for throttling.
The new option names affect the command line as well, but forcompatibility drive_init() will convert the old option names before...
blockdev: add sync mode to drive-backup QMP command
The drive-backup command is similar to the drive-mirror command, exceptno guest data written after the command executes gets copied. Add async mode argument which determines whether the entire disk is copied,...
blockdev: add DriveBackup transaction
This patch adds a transactional version of the drive-backup QMP command.It allows atomic snapshots of multiple drives along with automaticcleanup if there is a failure to start one of the backup jobs.
Note that QMP events are emitted for block job completion/cancellation...
blockdev: add Abort transaction
The Abort action can be used to test QMP 'transaction' failure. Add itas the last action to exercise the .abort() and .cleanup() code pathsfor all previous actions.
Reviewed-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>...
blockdev: drop redundant proto_drv check
It is not necessary to check that we can find a protocol block driversince we create or open the image file. This produces the error that weneed anyway.
Besides, the QERR_INVALID_BLOCK_FORMAT is inappropriate since the...
blockdev: use bdrv_getlength() in qmp_drive_mirror()
Use bdrv_getlength() for its byte units and error return instead ofbdrv_get_geometry().
Reported-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>...
block: add drive-backup QMP command
@drive-backup
Start a point-in-time copy of a block device to a new destination. Thestatus of ongoing drive-backup operations can be checked withquery-block-jobs where the BlockJobInfo.type field has the value 'backup'....
blockdev: rename BlkTransactionStates to singular
The QMP 'transaction' command keeps a list of in-flight transactions.The transaction state structure is called BlkTransactionStates eventhough it only deals with a single transaction. The only plural thing...
blockdev: allow BdrvActionOps->commit() to be NULL
Some QMP 'transaction' types don't need to do anything on .commit().Make .commit() optional just like .abort().
The "drive-backup" action will take advantage of this, it only needs tocancel the block job on .abort(). Other block job actions will probably...
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>
blockdev: use error_setg_file_open()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>Acked-by: Kevin Wolf <kwolf@redhat.com>
blockdev: reset werror/rerror on drive_del
Paolo Bonzini <pbonzini@redhat.com> suggested the following test case:
1. Launch a guest and wait at the GRUB boot menu:
qemu-system-x86_64 -enable-kvm -m 1024 \ -drive if=none,cache=none,file=test.img,id=foo,werror=stop,rerror=stop...
block: add block driver read only whitelist
We may want to include a driver in the whitelist for read only taskssuch as diagnosing or exporting guest data (with libguestfs as a goodexample). This patch introduces a readonly whitelist option, and forbackward compatibility, the old configure option --block-drv-whitelist...
block: package preparation code in qmp_transaction()
The code before really committing is moved into a function. Mostcode is simply moved from qmp_transaction(), except that on fail itjust returns now. Other code such as input parsing is not touched,to make it easier in review....
block: move input parsing code in qmp_transaction()
The code is moved into preparation function, and changeda bit to tip more clearly what it is doing.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>...
block: package committing code in qmp_transaction()
The code is simply moved into a separate function.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
block: package rollback code in qmp_transaction()
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: make all steps in qmp_transaction() as callback
Make it easier to add other operations to qmp_transaction() by usingcallbacks, with external snapshots serving as an example implementationof the callbacks.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>...
blockdev: Rename BlockdevAction -> TransactionAction
There's no reason to restrict transactions to operations related toblock devices, so rename the type now before schema introspection stopsus from doing so.
Also change the schema documentation of 'transaction' to not refer to...
blockdev: Replace "undefined error" in qmp_block_resize
We have an errno value that can be displayed, so we should just do that.An easy way to reproduce this case is to resize a raw image to a sizethat is too large for the host file system.
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.
hw: move headers to include/
Many of these should be cleaned up with proper qdev-/QOM-ification.Right now there are many catch-all headers in include/hw/ARCH dependingon cpu.h, and this makes it necessary to compile these files per-target.However, fixing this does not belong in these patches....
block: keep I/O throttling slice time constant
It is not necessary to adjust the slice time at runtime. We alreadyextend the current slice in order to carry over accounting into the nextslice. Changing the actual slice time value introduces oscillations....
block: Allow omitting the file name when using driver-specific options
After this patch, using -drive with an empty file name continues to openthe file if driver-specific options are used. If no driver-specificoptions are specified, the semantics stay as it was: It defines a drive...
block: complete all IOs before resizing a device
this patch ensures that all pending IOs are completedbefore a device is resized. this is especially importantif a device is shrinked as it the bdrv_check_request()result is invalidated.
Signed-off-by: Peter Lieven <pl@kamp.de>...
blockdev: Fix up copyright and permission notice
Screwed up in commit 666daa68. Thanks to Kevin Wolf for reminding meto fix this.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block: Add options QDict to bdrv_open() prototype
It doesn't do anything yet except storing the options QDict in theBlockDriverState.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>...
blockdev: Keep a copy of DriveInfo.serial
Pointing to a QemuOpts element is surprising and can lead to subtleuse-after-free errors when the QemuOpts is freed after all options areparsed.
block: Support driver specific options in drive_init()
Any non-default -drive options are now passed down to the block drivers.
blockdev: add discard suboption to -drive
Add support for BDRV_O_UNMAP from the QEMU command-line.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: use Error in do_check_io_limits()
The do_check_io_limits() function returns false when I/O limits areinvalid but it doesn't set an Error to indicate why. The twodo_check_io_limits() callers duplicate error reporting. Solve this bypassing an Error pointer into do_check_io_limits()....
block: refuse negative iops and bps values
Negative I/O throttling iops and bps values do not make sense so rejectthem with an error message.
Reviewed-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qemu-img: Add "Quiet mode" option
There can be a need to turn output to stdout off. This patch adds a -q optionthat enable "Quiet mode". In Quiet mode, only errors are printed out.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>Reviewed-by: Kevin Wolf <kwolf@redhat.com>...
Merge remote-tracking branch 'kwolf/for-anthony' into staging
block: Create proper size file for disk mirror
The qmp monitor command to mirror a disk was passing -1 for sizealong with the disk's backing file. This size of the resulting diskis the size of the backing file, which is incorrect if the diskhas been resized. Therefore we should always pass in the size of...
block: Add special error code for wrong format
The block drivers need a special error code for "wrong format".From the available error codes EMEDIUMTYPE fits best.It is not available on all platforms, so a definition inqemu-common.h and a specific error report are needed....
mirror: allow customizing the granularity
The desired granularity may be very different depending on the kind ofoperation (e.g. continuous replication vs. collapse-to-raw) and whetherthe VM is expected to perform lots of I/O while mirroring is in progress....
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.
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...
block: Monitor command commit neglects to report some errors
The non-live bdrv_commit() function may return one of the followingerrors: -ENOTSUP, -EBUSY, -EACCES, -EIO. The only error that ischecked in the HMP handler is -EBUSY, so the monitor command 'commit'...
qemu-option: move standard option definitions out of qemu-config.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: move include files to include/sysemu/
misc: move include files to include/qemu/
monitor: move include files to include/monitor/
qapi: move include files to include/qobject/
block: move include files to include/block/
use qemu_opts_create_nofail
We will use qemu_opts_create_nofail function, it can make codemore readable.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Support default block interfaces per QEMUMachine
There are QEMUMachines that have neither IF_IDE nor IF_SCSI as adefault/standard interface to their block devices / drives. Therefore,this patch introduces a new field default_block_type per QEMUMachinestruct. The prior use_scsi field becomes thereby obsolete and is...
block: bdrv_img_create(): add Error ** argument
This commit adds an Error ** argument to bdrv_img_create() and set itappropriately on error.
Callers of bdrv_img_create() pass NULL for the new argument and stillrely on bdrv_img_create()'s return value. Next commits will change...
qmp: qmp_transaction(): pass Error object to bdrv_img_create()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qmp: qmp_drive_mirror(): pass Error object to bdrv_img_create()
Issue warning when deprecated drive parameter boot=on|off is used
Releases of qemu-kvm will be interrupted at qemu 1.3.0.Users should switch to plain qemu releases.To avoid breaking scenarios which are setup with command lineoptions specific to qemu-kvm, port these switches from qemu-kvm...
mirror: add support for on-source-error/on-target-error
Error management is important for mirroring; otherwise, an error on thetarget (even something as "innocent" as ENOSPC) requires to start againwith a full copy. Similar to on_read_error/on_write_error, two separate...
qmp: add drive-mirror command
This adds the monitor commands that start the mirroring job.
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...
block: add block-job-complete
While streaming can be dropped as soon as it progressed through the wholeimage, mirroring needs to be completed manually for two reasons: 1) so thatmanagement knows exactly when the VM switches to the target; 2) becausefor other use cases such as replication, we may leave the operation running...
block: introduce BLOCK_JOB_READY event
Even for jobs that need to be manually completed, management may wantto take care itself of the completion, not requiring the user to issuea command to terminate the job. In this case we want to avoid thatthey poll us continuously, waiting for completion to become available....
cleanup useless return sentence
This patch cleans up return sentences in the end of void functions.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Amos Kong <akong@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
stream: add on-error argument
This patch adds support for error management to streaming.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>