qemu_blockjob: Move active commit failed state handling into a function

Currently, there are only a few lines of code so a separate
function was not necessary, but this will change. So instead of
putting all the new code under 'case
QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT' create a separate function.
Just like every other case has one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2019-08-30 14:21:24 +02:00
parent 86289374ef
commit 143a0f8b05

View File

@ -1121,6 +1121,20 @@ qemuBlockJobProcessEventConcludedCopyAbort(virQEMUDriverPtr driver,
} }
static void
qemuBlockJobProcessEventFailedActiveCommit(virDomainObjPtr vm,
qemuBlockJobDataPtr job)
{
VIR_DEBUG("active commit job '%s' on VM '%s' failed", job->name, vm->def->name);
if (!job->disk)
return;
virObjectUnref(job->disk->mirror);
job->disk->mirror = NULL;
}
static void static void
qemuBlockJobProcessEventConcludedCreate(virQEMUDriverPtr driver, qemuBlockJobProcessEventConcludedCreate(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
@ -1211,10 +1225,7 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
break; break;
case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
if (job->disk) { qemuBlockJobProcessEventFailedActiveCommit(vm, job);
virObjectUnref(job->disk->mirror);
job->disk->mirror = NULL;
}
break; break;
case QEMU_BLOCKJOB_TYPE_CREATE: case QEMU_BLOCKJOB_TYPE_CREATE: