megasas

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-nbd: reorganize help message

This patch separates qemu-nbd's options in logical groups, thus making
the help message easier to read.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-nbd: add --cache and --aio options

Add two options to tune the I/O implementation of qemu-nbd, matching
the possibilities given by the QEMU -drive option.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qapi: generalize documentation of streaming commands

Talk about background operations in general, rather than specifically
about streaming.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE

The DeviceNotActive error is not a particularly good match, add
a separate one.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: move job APIs to separate files

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: add block_job_query

Extract it out of the implementation of info block-jobs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: add support for job pause/resume

Job pausing reuses the existing support for cancellable sleeps.  A pause
happens at the next sleeping point and lasts until the coroutine is
re-entered explicitly.  Cancellation was already doing a forced resume,
so implement it explicitly in terms of resume.

Paused jobs cannot be canceled without first resuming them.  This ensures
that I/O errors are never missed by management.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qmp: add block-job-pause and block-job-resume

Add QMP commands matching the functionality.

Paused jobs cannot be canceled without first resuming them.  This
ensures that I/O errors are never missed by management.  However, an
optional force argument can be specified to allow that.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-iotests: add test for pausing a streaming operation

These check that a paused streaming job does not advance its offset.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: rename block_job_complete to block_job_completed

The imperative will be used for the QMP command.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: rename BlockErrorAction, BlockQMPEventAction

We want to remove knowledge of BLOCK_ERR_STOP_ENOSPC from drivers, so
free up the nicer BlockErrorAction name for them.  Do not change the
enums.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: move BlockdevOnError declaration to QAPI

This will let block-stream reuse the enum.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: reorganize io error code

Move the common part of IDE/SCSI/virtio error handling to the block
layer.  The same scheme will be used for errors in block jobs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: sort BlockDeviceIoStatus errors by severity

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: introduce block job error

The following behaviors are possible:

'report': The behavior is the same as in 1.1.  An I/O error,
respectively during a read or a write, will complete the job immediately
with an error code.

'ignore': An I/O error, respectively during a read or a write, will be
ignored.  For streaming, the job will complete with an error and the
backing file will be left in place.  For mirroring, the sector will be
marked again as dirty and re-examined later.

'stop': The job will be paused and the job iostatus will be set to
failed or nospace, while the VM will keep running.  This can only be
specified if the block device has rerror=stop and werror=stop or enospc.

'enospc': Behaves as 'stop' for ENOSPC errors, 'report' for others.

In all cases, even for 'report', the I/O error is reported as a QMP
event BLOCK_JOB_ERROR, with the same arguments as BLOCK_IO_ERROR.

It is possible that while stopping the VM a BLOCK_IO_ERROR event will be
reported and will clobber the event from BLOCK_JOB_ERROR, or vice versa.
This is not really avoidable since stopping the VM completes all pending
I/O requests.  In fact, it is already possible now that a series of
BLOCK_IO_ERROR events are reported with rerror=stop, because vm_stop
calls bdrv_drain_all and this can generate further errors.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
stream: add on_error argument

This patch adds support for error management to streaming.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-iotests: add tests for streaming error handling

Add a test for each of report/ignore/stop.  The tests use blkdebug
to generate an error in the middle of a script.  The error is
recoverable (once = "on") so that we can test resuming a job after
stopping for an error.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: live snapshot documentation tweaks

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: add bdrv_query_info

Extract it out of the implementation of "info block".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>