History | View | Annotate | Download (52 kB)
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.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
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.
The disabling of the driver-specific options is achieved by applying the...
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.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
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>
iostatus: change is_read to a bool
Do this while we are touching this part of the code, before introducingmore uses of "int is_read".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
stream: add on-error argument
This patch adds support for error management to streaming.
iostatus: move BlockdevOnError declaration to QAPI
This will let block-stream reuse the enum. Places that used the enumsare renamed accordingly.
block: add block_job_query
Extract it out of the implementation of info block-jobs.
block: add support for job pause/resume
Job pausing reuses the existing support for cancellable sleeps. A pausehappens at the next sleeping point and lasts until the coroutine isre-entered explicitly. Cancellation was already doing a forced resume,so implement it explicitly in terms of resume....
qmp: add block-job-pause and block-job-resume
Add QMP commands matching the functionality.
Paused jobs cannot be canceled without first resuming them. Thisensures that I/O errors are never missed by management. However, anoptional force argument can be specified to allow that....
block: move job APIs to separate files
qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE
The DeviceNotActive text is not a particularly good match, adda separate text while keeping the same class.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
QAPI: add command for live block commit, 'block-commit'
The command for live block commit is added, which has the followingarguments:
device: the block device to perform the commit on (mandatory)base: the base image to commit into; optional (if not specified,...
blockdev: rename block_stream_cb to a generic block_job_cb
Signed-off-by: Jeff Cody <jcody@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: after creating a live snapshot, make old image read-only
Currently, after a live snapshot of a drive, the image that hasbeen 'demoted' to be below the new active layer remains r/w.This patch reopens it read-only.
Note that we do not check for error on the reopen(), because we...
blockdev: preserve readonly and snapshot states across media changes
If readonly=on is given at device creation time, the ->readonly flagneeds to be set in the block driver state for this device so thatreadonly-ness is preserved across media changes (qmp change command)....
blockdev: flip default cache mode from writethrough to writeback
Now all major device models (IDE, SCSI, virtio) can choose betweenwritethrough and writeback at run-time, and virtio will even revertto writethrough if the guest is not capable of sending flushes. So...
Support 'help' as a synonym for '?' in command line options
For command line options which permit '?' meaning 'please list thepermitted values', add support for 'help' as a synonym, by abstractingthe check out into a helper function.
This change means that in some cases where we were being lazy in...
blockdev: Drop redundant CHS validation for if=ide
Leave it to ide_init_drive().
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev: Don't limit DriveInfo serial to 20 characters
All current users (IDE, SCSI and virtio-blk) happen to share this 20characters limit. Still, it should be left to device models. Theyalready enforce their limits. They have to, as the DriveInfo limit...
block: Geometry and translation hints are now useless, purge them
There are two producers of these hints: drive_init() on behalf of-drive, and hd_geometry_guess().
The only consumer of the hint is hd_geometry_guess().
The callers of hd_geometry_guess() call it only when drive_init()...
blockdev: Save geometry in DriveInfo
In preparation of purging it from the block layer, which will happenlater in this series.
blockdev: warn when copy_on_read=on and readonly=on
If the image is read-only then it's not possible to copy read data intoit. Therefore copy-on-read is automatically disabled for read-onlyimages.
Up until now this behavior was silent, add a warning so the user knows...
block: Simplify how drive_init() computes default ID
qemu-option: qemu_opts_create(): use error_set()
This commit converts qemu_opts_create() from qerror_report() toerror_set().
Currently, most calls to qemu_opts_create() can't fail, so mostcallers don't need any changes.
The two cases where code checks for qemu_opts_create() erros are:...
block: fail live snapshot if disk has no medium
Reviewed-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: use Error mechanism instead of -errno for block_job_create()
The block job API uses -errno return values internally and we convertthese to Error in the QMP functions. This is ugly because the Errorshould be created at the point where we still have all the relevant...
block: use Error mechanism instead of -errno for block_job_set_speed()
There are at least two different errors that can occur inblock_job_set_speed(): the job might not support setting speeds or thevalue might be invalid.
Use the Error mechanism to report the error where it occurs....
block: change block-job-set-speed argument from 'value' to 'speed'
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Acked-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
block: add 'speed' optional parameter to block-stream
Allow streaming operations to be started with an initial speed limit.This eliminates the window of time between starting streaming andissuing block-job-set-speed. Users should use the new optional 'speed'...
blockdev: open images with BDRV_O_INCOMING on incoming live migration
Open images with BDRV_O_INCOMING in order to inform block driversthat an incoming live migration is coming.
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>...
block: cancel jobs when a device is ready to go away
We do not want jobs to keep a device busy for a possibly very longtime, and management could become confused because they thought adevice was not even there anymore. So, cancel long-running jobsas soon as their device is going to disappear....
ide: Change serial number strncpy() to pstrcpy()
strncpy may not null-terminate the destination string.
Cc: kwolf@redhat.comSigned-off-by: Floris Bos <dev@noc-ps.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
use QSIMPLEQ_FOREACH_SAFE when freeing list elements
rename blockdev-group-snapshot-sync
We will add other kinds of operation. Prepare for this by adjustingthe schema.
add mode field to blockdev-snapshot-sync transaction item
The mode field lets a management application create the snapshotdestination outside QEMU.
Right now, the only modes are "existing" and "absolute-paths". Mirroringintroduces "no-backing-file". In the future "relative-paths" could be...
qmp: convert blockdev-snapshot-sync to a wrapper around transactions
Simplify the blockdev-snapshot-sync code and gain failsafe operationby turning it into a wrapper around the new transaction command. A newoption is also added matching "mode".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
Group snapshot: Fix format name for backing file
block: handle -EBUSY in bdrv_commit_all()
Monitor operations that manipulate image files must not execute while abackground job (like image streaming) is in progress. This preventscorruptions from happening when two pieces of code are manipulating the...
qapi: Introduce blockdev-group-snapshot-sync command
This is a QAPI/QMP only command to take a snapshot of a group ofdevices. This is similar to the blockdev-snapshot-sync command, exceptblockdev-group-snapshot-sync accepts a list devices, filenames, and...
blockdev: allow read-only pflash devices
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Fix build breakage from last commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
s390x: fix -drive in the absence of aliases
qmp: add block_job_cancel command
Add block_job_cancel, which stops an active block streaming operation.When the operation has been cancelled the new BLOCK_JOB_CANCELLED eventis emitted.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Acked-by: Luiz Capitulino <lcapitulino@redhat.com>...
qmp: add query-block-jobs
Add query-block-jobs, which shows the progress of ongoing block deviceoperations.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Acked-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev: make image streaming safe across hotplug
Unplugging a storage interface like virtio-blk causes the host blockdevice to be deleted too. Long-running operations like block migrationmust take a DriveInfo reference to prevent the BlockDriverState from...
block: add support for partial streaming
Add support for streaming data from an intermediate section of theimage chain (see patch and documentation for details).
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
qmp: add block_job_set_speed command
Add block_job_set_speed, which sets the maximum speed for a backgroundblock operation.
qmp: add block_stream command
Add the block_stream command, which starts copy backing file contentsinto the image file. Also add the BLOCK_JOB_COMPLETED QMP event whichis emitted when image streaming completes. Later patches add controlover the background copy speed, cancelation, and querying running...
block: check bdrv_in_use() before blockdev operations
Long-running block operations like block migration and image streamingmust have continual access to their block device. It is not safe toperform operations like hotplug, eject, change, resize, commit, or...
block: eject_device(): Use error_set()
Also drops the leftover 'mon' argument.
This is a preparation for the next commits which will port theeject and change commands to the QAPI.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qapi: Convert eject
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qapi: Convert change
qapi: Convert block_set_io_throttle
block: use proper qerrors in qmp_block_resize
Let's report specific errors so that management tools and users canidentify the problem.
Two new qerrors are needed: * QERR_DEVICE_HAS_NO_MEDIUM for ENOMEDIUM * QERR_DEVICE_IS_READ_ONLY for EACCES
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
qapi: Convert block_passwd
qapi: Convert block_resize
qapi: Convert blockdev_snapshot_sync
Unfortunately, this conversion required an additional change.
In the old QMP command, the 'snapshot-file' argument is specified asoptional. The idea is to take the snapshot internally if 'snapshot-file'is not passed. However, internal snapshots are not supported yet so...
block: convert qemu_aio_flush() calls to bdrv_drain_all()
Many places in QEMU call qemu_aio_flush() to complete all pendingasynchronous I/O. Most of these places actually want to drain all blockrequests but there is no block layer API to do so.
This patch introduces the bdrv_drain_all() API to wait for requests...