qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH V5 13/25] cpr: HMP interfaces for restart


From: Zheng Chuan
Subject: Re: [PATCH V5 13/25] cpr: HMP interfaces for restart
Date: Wed, 28 Jul 2021 12:56:08 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

Hi

On 2021/7/8 1:20, Steve Sistare wrote:
> cprsave <file> <mode>
>   mode may be "restart"
> 
> cprexec <command>
>   Call cprexec().
>   Arguments:
>     command : command line to execute, with space-separated arguments
> 
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> ---
>  hmp-commands.hx       | 20 +++++++++++++++++++-
>  include/monitor/hmp.h |  1 +
>  monitor/hmp-cmds.c    | 11 +++++++++++
>  3 files changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/hmp-commands.hx b/hmp-commands.hx
> index 11827ae..d956405 100644
> --- a/hmp-commands.hx
> +++ b/hmp-commands.hx
> @@ -366,7 +366,7 @@ ERST
>      {
>          .name       = "cprsave",
>          .args_type  = "file:s,mode:s",
> -        .params     = "file 'reboot'",
> +        .params     = "file 'restart'|'reboot'",
>          .help       = "create a checkpoint of the VM in file",
>          .cmd        = hmp_cprsave,
>      },
> @@ -379,6 +379,24 @@ If *mode* is 'reboot', the checkpoint remains valid 
> after a host kexec
>  reboot, and guest ram must be backed by persistant shared memory.  To
Same, Should be persistent.
>  resume from the checkpoint, issue the quit command, reboot the system,
>  and issue the cprload command.
> +
> +If *mode* is 'restart', the checkpoint remains valid after restarting qemu,
> +and guest ram must be allocated with the memfd-alloc machine option.  To
> +resume from the checkpoint, issue the cprexec command to restart, and issue
> +the cprload command.
> +ERST
> +
> +    {
> +        .name       = "cprexec",
> +        .args_type  = "command:S",
> +        .params     = "command",
> +        .help       = "Restart qemu by directly exec'ing command",
> +        .cmd        = hmp_cprexec,
> +    },
> +
> +SRST
> +``cprexec`` *command*
> +Restart qemu by directly exec'ing *command*, replacing the qemu process.
>  ERST
>  
>      {
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index 98bb775..ffc5eb1 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -60,6 +60,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict);
>  void hmp_delvm(Monitor *mon, const QDict *qdict);
>  void hmp_cprinfo(Monitor *mon, const QDict *qdict);
>  void hmp_cprsave(Monitor *mon, const QDict *qdict);
> +void hmp_cprexec(Monitor *mon, const QDict *qdict);
>  void hmp_cprload(Monitor *mon, const QDict *qdict);
>  void hmp_migrate_cancel(Monitor *mon, const QDict *qdict);
>  void hmp_migrate_continue(Monitor *mon, const QDict *qdict);
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index a56f83c..163564e 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -1217,6 +1217,17 @@ out:
>      hmp_handle_error(mon, err);
>  }
>  
> +void hmp_cprexec(Monitor *mon, const QDict *qdict)
> +{
> +    Error *err = NULL;
> +    const char *command = qdict_get_try_str(qdict, "command");
> +    strList *args = strList_from_string(command, ' ');
> +
> +    qmp_cprexec(args, &err);
> +    qapi_free_strList(args);
> +    hmp_handle_error(mon, err);
> +}
> +
>  void hmp_cprload(Monitor *mon, const QDict *qdict)
>  {
>      Error *err = NULL;
> 

-- 
Regards.
Chuan



reply via email to

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