On Tue, May 10, 2022 at 05:20:34PM +0200, Jiri Denemark wrote: > The code for setting up a previously active backup job in > qemuProcessRecoverJob is generalized into a dedicated function so that > it can be later reused in other places. > > Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> > --- > src/qemu/qemu_domainjob.c | 35 +++++++++++++++++++++++++++++++++++ > src/qemu/qemu_domainjob.h | 8 ++++++++ > src/qemu/qemu_process.c | 29 +++++++---------------------- > 3 files changed, 50 insertions(+), 22 deletions(-) > > diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c > index 1e5724b505..1f82457bd4 100644 > --- a/src/qemu/qemu_domainjob.c > +++ b/src/qemu/qemu_domainjob.c > @@ -249,6 +249,41 @@ qemuDomainObjPreserveJob(virDomainObj *obj, > return 0; > } > > + > +void > +qemuDomainObjRestoreAsyncJob(virDomainObj *vm, > + virDomainAsyncJob asyncJob, > + int phase, > + virDomainJobOperation operation, > + qemuDomainJobStatsType statsType, > + virDomainJobStatus status, > + unsigned long long allowedJobs) > +{ > + qemuDomainObjPrivate *priv = vm->privateData; > + qemuDomainJobObj *job = &priv->job; > + unsigned long long now; > + > + VIR_DEBUG("Restoring %s async job for domain %s", > + virDomainAsyncJobTypeToString(asyncJob), vm->def->name); > + > + ignore_value(virTimeMillisNow(&now)); > + > + priv->job.jobsQueued++; s/priv->job./job->/ > + job->asyncJob = asyncJob; > + job->phase = phase; > + job->asyncOwnerAPI = g_strdup(virThreadJobGet()); > + job->asyncStarted = now; > + > + qemuDomainObjSetAsyncJobMask(vm, allowedJobs); > + > + job->current = virDomainJobDataInit(&qemuJobDataPrivateDataCallbacks); > + qemuDomainJobSetStatsType(priv->job.current, statsType); > + job->current->operation = operation; > + job->current->status = status; > + job->current->started = now; > +} > + > + > void > qemuDomainObjClearJob(qemuDomainJobObj *job)
Attachment:
signature.asc
Description: PGP signature