[libvirt PATCH 45/80] qemu: Add new migration phases for post-copy recovery

Peter Krempa pkrempa at redhat.com
Thu May 12 08:12:17 UTC 2022


On Tue, May 10, 2022 at 17:21:06 +0200, Jiri Denemark wrote:
> When recovering from a failed post-copy migration, we need to go through
> all migration phases again, but don't need to repeat all the steps in
> each phase. Let's create a new set of migration phases dedicated to
> post-copy recovery so that we can easily distinguish between normal and
> recovery code.
> 
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
>  src/qemu/qemu_migration.c | 20 +++++++++++++++++++-
>  src/qemu/qemu_migration.h |  6 ++++++
>  src/qemu/qemu_process.c   | 25 ++++++++++++++++++++++++-
>  3 files changed, 49 insertions(+), 2 deletions(-)

[...]

> @@ -3680,6 +3692,17 @@ qemuProcessRecoverMigrationOut(virQEMUDriver *driver,
>          /* migration completed, we need to kill the domain here */
>          *stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
>          return -1;
> +
> +    case QEMU_MIGRATION_PHASE_CONFIRM_RESUME:
> +        if (migStatus == VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED) {
> +            *stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;

I'd consider this case to be success ...

> +            return -1;

... so this technically violates the return values as you've previously
declared that:

 *     -1 on error, the domain will be killed,

Please add a comment that makes the reader aware that this is success
actually or modify the comment at the top of the function.

> +        }
> +        return 1;
> +

Reviewed-by: Peter Krempa <pkrempa at redhat.com>


More information about the libvir-list mailing list