Re: [libvirt PATCH 37/80] qemu: Make final part of migration Confirm phase reusable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 10, 2022 at 17:20:58 +0200, Jiri Denemark wrote:
> By separating it into a dedicated qemuMigrationSrcComplete function
> which can be later called in other places.
> 
> Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
> ---
>  src/qemu/qemu_migration.c | 70 ++++++++++++++++++++++++---------------
>  src/qemu/qemu_migration.h |  5 +++
>  2 files changed, 48 insertions(+), 27 deletions(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index b62f7256c4..903c1dbf6b 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -3518,6 +3518,48 @@ qemuMigrationAnyPrepareDef(virQEMUDriver *driver,
>  }
>  
>  
> +void
> +qemuMigrationSrcComplete(virQEMUDriver *driver,
> +                         virDomainObj *vm,
> +                         virDomainAsyncJob asyncJob)
> +{
> +    qemuDomainObjPrivate *priv = vm->privateData;
> +    virDomainJobData *jobData = priv->job.completed;
> +    virObjectEvent *event;
> +    int reason;
> +
> +    if (jobData) {
> +        /* We need to refresh migration statistics after a completed post-copy
> +         * migration since jobData contains obsolete data from the time we
> +         * switched to post-copy mode.
> +         */
> +        if (virDomainObjGetState(vm, &reason) == VIR_DOMAIN_PAUSED &&
> +            reason == VIR_DOMAIN_PAUSED_POSTCOPY) {
> +            VIR_DEBUG("Refreshing migration statistics");
> +            if (qemuMigrationAnyFetchStats(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT,
> +                                           jobData, NULL) < 0)
> +                VIR_WARN("Could not refresh migration statistics");
> +        }
> +
> +        qemuDomainJobDataUpdateTime(jobData);
> +    }
> +
> +    /* If guest uses SPICE and supports seamless migration we have to hold
> +     * up domain shutdown until SPICE server transfers its data */
> +    qemuMigrationSrcWaitForSpice(vm);
> +
> +    qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_MIGRATED, asyncJob,
> +                    VIR_QEMU_PROCESS_STOP_MIGRATED);
> +    virDomainAuditStop(vm, "migrated");
> +
> +    event = virDomainEventLifecycleNewFromObj(vm,
> +                                     VIR_DOMAIN_EVENT_STOPPED,
> +                                     VIR_DOMAIN_EVENT_STOPPED_MIGRATED);

Fix the alignment here.

Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux