[libvirt PATCH 13/80] qemu: Add qemuDomainObjRestoreAsyncJob

Pavel Hrdina phrdina at redhat.com
Wed May 11 10:43:56 UTC 2022


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 at redhat.com>
> ---
>  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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20220511/7dbc4bb9/attachment.sig>


More information about the libvir-list mailing list