qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] qapi/run-state: Add a new shutdown cause 'migration-comp


From: Daniel P . Berrangé
Subject: Re: [PATCH 1/2] qapi/run-state: Add a new shutdown cause 'migration-completed'
Date: Mon, 5 Jul 2021 13:48:19 +0100
User-agent: Mutt/2.0.7 (2021-05-04)

On Mon, Jul 05, 2021 at 08:36:52PM +0800, Kunkun Jiang wrote:
> In the current version, the source QEMU process does not automatic
> exit after a successful migration. Additional action is required,
> such as sending { "execute": "quit" } or ctrl+c. For simplify, add
> a new shutdown cause 'migration-completed' to exit the source QEMU
> process after a successful migration.

IIUC, 'STATUS_COMPLETED' state is entered on the source host
once it has finished sending all VM state, and thus does not
guarantee that the target host has successfully received and
loaded all VM state.

Typically a mgmt app will need to directly confirm that the
target host QEMU has succesfully started running, before it
will tell the source QEMU to quit.

So, AFAICT, this automatic exit after STATUS_COMPLETED is 
not safe and could lead to total loss of the running VM in
error scenarios.



> 
> Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
> ---
>  migration/migration.c | 1 +
>  qapi/run-state.json   | 4 +++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index 4228635d18..16782c93c2 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -3539,6 +3539,7 @@ static void migration_iteration_finish(MigrationState 
> *s)
>      case MIGRATION_STATUS_COMPLETED:
>          migration_calculate_complete(s);
>          runstate_set(RUN_STATE_POSTMIGRATE);
> +        qemu_system_shutdown_request(SHUTDOWN_CAUSE_MIGRATION_COMPLETED);
>          break;
>  
>      case MIGRATION_STATUS_ACTIVE:
> diff --git a/qapi/run-state.json b/qapi/run-state.json
> index 43d66d700f..66aaef4e2b 100644
> --- a/qapi/run-state.json
> +++ b/qapi/run-state.json
> @@ -86,12 +86,14 @@
>  #                   ignores --no-reboot. This is useful for sanitizing
>  #                   hypercalls on s390 that are used during kexec/kdump/boot
>  #
> +# @migration-completed: Reaction to the successful migration
> +#
>  ##
>  { 'enum': 'ShutdownCause',
>    # Beware, shutdown_caused_by_guest() depends on enumeration order
>    'data': [ 'none', 'host-error', 'host-qmp-quit', 'host-qmp-system-reset',
>              'host-signal', 'host-ui', 'guest-shutdown', 'guest-reset',
> -            'guest-panic', 'subsystem-reset'] }
> +            'guest-panic', 'subsystem-reset', 'migration-completed'] }
>  
>  ##
>  # @StatusInfo:
> -- 
> 2.23.0
> 
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]