On Mon, Jul 26, 2021 at 04:46:10PM +0200, Max Reitz wrote: > We largely have two cancel modes for jobs: > > First, there is actual cancelling. The job is terminated as soon as > possible, without trying to reach a consistent result. > > Second, we have mirror in the READY state. Technically, the job is not > really cancelled, but it just is a different completion mode. The job > can still run for an indefinite amount of time while it tries to reach a > consistent result. > > We want to be able to clearly distinguish which cancel mode a job is in > (when it has been cancelled). We can use Job.force_cancel for this, but > right now it only reflects cancel requests from the user with > force=true, but clearly, jobs that do not even distinguish between > force=false and force=true are effectively always force-cancelled. > > So this patch has Job.force_cancel signify whether the job will > terminate as soon as possible (force_cancel=true) or whether it will > effectively remain running despite being "cancelled" > (force_cancel=false). > > To this end, we let jobs that provide JobDriver.cancel() tell the > generic job code whether they will terminate as soon as possible or not, > and for jobs that do not provide that method we assume they will. > > Signed-off-by: Max Reitz <mre...@redhat.com> > --- > include/qemu/job.h | 11 ++++++++++- > block/backup.c | 3 ++- > block/mirror.c | 24 ++++++++++++++++++------ > job.c | 6 +++++- > 4 files changed, 35 insertions(+), 9 deletions(-) >
Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org