qemu-iotests: fill streaming test image with data

This avoids that the job completes too fast when the file system
reports the hole to QEMU (via FIEMAP or SEEK_HOLE).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-iotests: start vms in qtest mode

This way, they will not execute any code at all.  However, right now
one test is "relying" on being slowed down by TCG executing random
crap, so change the timeouts there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
blkdebug: remove sync i/o events

These are unused, except (by mistake more or less) in QED.

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

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
blkdebug: pass getlength to underlying file

This is required when using blkdebug with raw format.  Unlike qcow2/QED,
raw asks blkdebug for the length of the file, it doesn't get it from
a header.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
blkdebug: store list of active rules

This prepares for the next patch, where some active rules may actually
not trigger depending on input to readv/writev.  Store the active rules
in a SIMPLEQ (so that it can be emptied easily with QSIMPLEQ_INIT), and
fetch the errno/once/immediately arguments from there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
blkdebug: optionally tie errors to a specific sector

This makes blkdebug scripts more powerful, and independent of the
exact sequence of operations performed by streaming.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
raw: hook into blkdebug

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
kvm: add missing include files

These are included via monitor.h right now, add them explicitly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qmp: do not include monitor.h from qapi-types-core.h

The comment is stale, monitor.h is not needed anymore (only qerror.h
is, because it contains the schema for errors).

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.

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>