diff mbox series

[V1,04/32] savevm: HMP Command for cprsave

Message ID 1596122076-341293-5-git-send-email-steven.sistare@oracle.com (mailing list archive)
State New, archived
Headers show
Series Live Update | expand

Commit Message

Steven Sistare July 30, 2020, 3:14 p.m. UTC
Enable HMP access to the cprsave QMP command.

Usage: cprsave <filename> <mode>

Signed-off-by: Maran Wilson <maran.wilson@oracle.com>
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
 hmp-commands.hx       | 18 ++++++++++++++++++
 include/monitor/hmp.h |  1 +
 monitor/hmp-cmds.c    | 10 ++++++++++
 3 files changed, 29 insertions(+)

Comments

Dr. David Alan Gilbert Sept. 11, 2020, 4:57 p.m. UTC | #1
* Steve Sistare (steven.sistare@oracle.com) wrote:
> Enable HMP access to the cprsave QMP command.
> 
> Usage: cprsave <filename> <mode>
> 
> Signed-off-by: Maran Wilson <maran.wilson@oracle.com>
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>

I realise that the current mode is currently only 'reboot' - can you
please give us a clue as to why you've got a mode argument that's
currently only got one mode?

Dave

> ---
>  hmp-commands.hx       | 18 ++++++++++++++++++
>  include/monitor/hmp.h |  1 +
>  monitor/hmp-cmds.c    | 10 ++++++++++
>  3 files changed, 29 insertions(+)
> 
> diff --git a/hmp-commands.hx b/hmp-commands.hx
> index 60f395c..c8defd9 100644
> --- a/hmp-commands.hx
> +++ b/hmp-commands.hx
> @@ -354,6 +354,24 @@ SRST
>  ERST
>  
>      {
> +        .name       = "cprsave",
> +        .args_type  = "file:s,mode:s",
> +        .params     = "file 'reboot'",
> +        .help       = "create a checkpoint of the VM in file",
> +        .cmd        = hmp_cprsave,
> +    },
> +
> +SRST
> +``cprsave`` *tag*
> +  Stop VCPUs, create a checkpoint of the whole virtual machine and save it
> +  in *file*.
> +  If *mode* is 'reboot', the checkpoint can be cprload'ed after a host kexec
> +  reboot.
> +  exec() /usr/bin/qemu-exec if it exists, else exec /usr/bin/qemu-system-x86_64,
> +  passing all the original command line arguments.  The VCPUs remain paused.
> +ERST
> +
> +    {
>          .name       = "delvm",
>          .args_type  = "name:s",
>          .params     = "tag",
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index c986cfd..af8ee23 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -59,6 +59,7 @@ void hmp_balloon(Monitor *mon, const QDict *qdict);
>  void hmp_loadvm(Monitor *mon, const QDict *qdict);
>  void hmp_savevm(Monitor *mon, const QDict *qdict);
>  void hmp_delvm(Monitor *mon, const QDict *qdict);
> +void hmp_cprsave(Monitor *mon, const QDict *qdict);
>  void hmp_migrate_cancel(Monitor *mon, const QDict *qdict);
>  void hmp_migrate_continue(Monitor *mon, const QDict *qdict);
>  void hmp_migrate_incoming(Monitor *mon, const QDict *qdict);
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index ae4b6a4..59196ed 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -1139,6 +1139,16 @@ void hmp_announce_self(Monitor *mon, const QDict *qdict)
>      qapi_free_AnnounceParameters(params);
>  }
>  
> +void hmp_cprsave(Monitor *mon, const QDict *qdict)
> +{
> +    Error *err = NULL;
> +
> +    qmp_cprsave(qdict_get_try_str(qdict, "file"),
> +                qdict_get_try_str(qdict, "mode"),
> +                &err);
> +    hmp_handle_error(mon, err);
> +}
> +
>  void hmp_migrate_cancel(Monitor *mon, const QDict *qdict)
>  {
>      qmp_migrate_cancel(NULL);
> -- 
> 1.8.3.1
>
Steven Sistare Sept. 24, 2020, 9:44 p.m. UTC | #2
On 9/11/2020 12:57 PM, Dr. David Alan Gilbert wrote:
> * Steve Sistare (steven.sistare@oracle.com) wrote:
>> Enable HMP access to the cprsave QMP command.
>>
>> Usage: cprsave <filename> <mode>
>>
>> Signed-off-by: Maran Wilson <maran.wilson@oracle.com>
>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> 
> I realise that the current mode is currently only 'reboot' - can you
> please give us a clue as to why you've got a mode argument that's
> currently only got one mode?

Patch 14 adds the restart mode.
I factored the patches by capability to make the review easier, first
presenting the reboot patches, then the restart patches.

- Steve

>> ---
>>  hmp-commands.hx       | 18 ++++++++++++++++++
>>  include/monitor/hmp.h |  1 +
>>  monitor/hmp-cmds.c    | 10 ++++++++++
>>  3 files changed, 29 insertions(+)
>>
>> diff --git a/hmp-commands.hx b/hmp-commands.hx
>> index 60f395c..c8defd9 100644
>> --- a/hmp-commands.hx
>> +++ b/hmp-commands.hx
>> @@ -354,6 +354,24 @@ SRST
>>  ERST
>>  
>>      {
>> +        .name       = "cprsave",
>> +        .args_type  = "file:s,mode:s",
>> +        .params     = "file 'reboot'",
>> +        .help       = "create a checkpoint of the VM in file",
>> +        .cmd        = hmp_cprsave,
>> +    },
>> +
>> +SRST
>> +``cprsave`` *tag*
>> +  Stop VCPUs, create a checkpoint of the whole virtual machine and save it
>> +  in *file*.
>> +  If *mode* is 'reboot', the checkpoint can be cprload'ed after a host kexec
>> +  reboot.
>> +  exec() /usr/bin/qemu-exec if it exists, else exec /usr/bin/qemu-system-x86_64,
>> +  passing all the original command line arguments.  The VCPUs remain paused.
>> +ERST
>> +
>> +    {
>>          .name       = "delvm",
>>          .args_type  = "name:s",
>>          .params     = "tag",
>> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
>> index c986cfd..af8ee23 100644
>> --- a/include/monitor/hmp.h
>> +++ b/include/monitor/hmp.h
>> @@ -59,6 +59,7 @@ void hmp_balloon(Monitor *mon, const QDict *qdict);
>>  void hmp_loadvm(Monitor *mon, const QDict *qdict);
>>  void hmp_savevm(Monitor *mon, const QDict *qdict);
>>  void hmp_delvm(Monitor *mon, const QDict *qdict);
>> +void hmp_cprsave(Monitor *mon, const QDict *qdict);
>>  void hmp_migrate_cancel(Monitor *mon, const QDict *qdict);
>>  void hmp_migrate_continue(Monitor *mon, const QDict *qdict);
>>  void hmp_migrate_incoming(Monitor *mon, const QDict *qdict);
>> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
>> index ae4b6a4..59196ed 100644
>> --- a/monitor/hmp-cmds.c
>> +++ b/monitor/hmp-cmds.c
>> @@ -1139,6 +1139,16 @@ void hmp_announce_self(Monitor *mon, const QDict *qdict)
>>      qapi_free_AnnounceParameters(params);
>>  }
>>  
>> +void hmp_cprsave(Monitor *mon, const QDict *qdict)
>> +{
>> +    Error *err = NULL;
>> +
>> +    qmp_cprsave(qdict_get_try_str(qdict, "file"),
>> +                qdict_get_try_str(qdict, "mode"),
>> +                &err);
>> +    hmp_handle_error(mon, err);
>> +}
>> +
>>  void hmp_migrate_cancel(Monitor *mon, const QDict *qdict)
>>  {
>>      qmp_migrate_cancel(NULL);
>> -- 
>> 1.8.3.1
>>
Dr. David Alan Gilbert Sept. 25, 2020, 9:26 a.m. UTC | #3
* Steven Sistare (steven.sistare@oracle.com) wrote:
> On 9/11/2020 12:57 PM, Dr. David Alan Gilbert wrote:
> > * Steve Sistare (steven.sistare@oracle.com) wrote:
> >> Enable HMP access to the cprsave QMP command.
> >>
> >> Usage: cprsave <filename> <mode>
> >>
> >> Signed-off-by: Maran Wilson <maran.wilson@oracle.com>
> >> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> > 
> > I realise that the current mode is currently only 'reboot' - can you
> > please give us a clue as to why you've got a mode argument that's
> > currently only got one mode?
> 
> Patch 14 adds the restart mode.
> I factored the patches by capability to make the review easier, first
> presenting the reboot patches, then the restart patches.

OK, but just add a comment here saying that you'll add another mode
later; otherwise it looks a bit weird.

Dave

> - Steve
> 
> >> ---
> >>  hmp-commands.hx       | 18 ++++++++++++++++++
> >>  include/monitor/hmp.h |  1 +
> >>  monitor/hmp-cmds.c    | 10 ++++++++++
> >>  3 files changed, 29 insertions(+)
> >>
> >> diff --git a/hmp-commands.hx b/hmp-commands.hx
> >> index 60f395c..c8defd9 100644
> >> --- a/hmp-commands.hx
> >> +++ b/hmp-commands.hx
> >> @@ -354,6 +354,24 @@ SRST
> >>  ERST
> >>  
> >>      {
> >> +        .name       = "cprsave",
> >> +        .args_type  = "file:s,mode:s",
> >> +        .params     = "file 'reboot'",
> >> +        .help       = "create a checkpoint of the VM in file",
> >> +        .cmd        = hmp_cprsave,
> >> +    },
> >> +
> >> +SRST
> >> +``cprsave`` *tag*
> >> +  Stop VCPUs, create a checkpoint of the whole virtual machine and save it
> >> +  in *file*.
> >> +  If *mode* is 'reboot', the checkpoint can be cprload'ed after a host kexec
> >> +  reboot.
> >> +  exec() /usr/bin/qemu-exec if it exists, else exec /usr/bin/qemu-system-x86_64,
> >> +  passing all the original command line arguments.  The VCPUs remain paused.
> >> +ERST
> >> +
> >> +    {
> >>          .name       = "delvm",
> >>          .args_type  = "name:s",
> >>          .params     = "tag",
> >> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> >> index c986cfd..af8ee23 100644
> >> --- a/include/monitor/hmp.h
> >> +++ b/include/monitor/hmp.h
> >> @@ -59,6 +59,7 @@ void hmp_balloon(Monitor *mon, const QDict *qdict);
> >>  void hmp_loadvm(Monitor *mon, const QDict *qdict);
> >>  void hmp_savevm(Monitor *mon, const QDict *qdict);
> >>  void hmp_delvm(Monitor *mon, const QDict *qdict);
> >> +void hmp_cprsave(Monitor *mon, const QDict *qdict);
> >>  void hmp_migrate_cancel(Monitor *mon, const QDict *qdict);
> >>  void hmp_migrate_continue(Monitor *mon, const QDict *qdict);
> >>  void hmp_migrate_incoming(Monitor *mon, const QDict *qdict);
> >> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> >> index ae4b6a4..59196ed 100644
> >> --- a/monitor/hmp-cmds.c
> >> +++ b/monitor/hmp-cmds.c
> >> @@ -1139,6 +1139,16 @@ void hmp_announce_self(Monitor *mon, const QDict *qdict)
> >>      qapi_free_AnnounceParameters(params);
> >>  }
> >>  
> >> +void hmp_cprsave(Monitor *mon, const QDict *qdict)
> >> +{
> >> +    Error *err = NULL;
> >> +
> >> +    qmp_cprsave(qdict_get_try_str(qdict, "file"),
> >> +                qdict_get_try_str(qdict, "mode"),
> >> +                &err);
> >> +    hmp_handle_error(mon, err);
> >> +}
> >> +
> >>  void hmp_migrate_cancel(Monitor *mon, const QDict *qdict)
> >>  {
> >>      qmp_migrate_cancel(NULL);
> >> -- 
> >> 1.8.3.1
> >>
>
diff mbox series

Patch

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 60f395c..c8defd9 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -354,6 +354,24 @@  SRST
 ERST
 
     {
+        .name       = "cprsave",
+        .args_type  = "file:s,mode:s",
+        .params     = "file 'reboot'",
+        .help       = "create a checkpoint of the VM in file",
+        .cmd        = hmp_cprsave,
+    },
+
+SRST
+``cprsave`` *tag*
+  Stop VCPUs, create a checkpoint of the whole virtual machine and save it
+  in *file*.
+  If *mode* is 'reboot', the checkpoint can be cprload'ed after a host kexec
+  reboot.
+  exec() /usr/bin/qemu-exec if it exists, else exec /usr/bin/qemu-system-x86_64,
+  passing all the original command line arguments.  The VCPUs remain paused.
+ERST
+
+    {
         .name       = "delvm",
         .args_type  = "name:s",
         .params     = "tag",
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index c986cfd..af8ee23 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -59,6 +59,7 @@  void hmp_balloon(Monitor *mon, const QDict *qdict);
 void hmp_loadvm(Monitor *mon, const QDict *qdict);
 void hmp_savevm(Monitor *mon, const QDict *qdict);
 void hmp_delvm(Monitor *mon, const QDict *qdict);
+void hmp_cprsave(Monitor *mon, const QDict *qdict);
 void hmp_migrate_cancel(Monitor *mon, const QDict *qdict);
 void hmp_migrate_continue(Monitor *mon, const QDict *qdict);
 void hmp_migrate_incoming(Monitor *mon, const QDict *qdict);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index ae4b6a4..59196ed 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1139,6 +1139,16 @@  void hmp_announce_self(Monitor *mon, const QDict *qdict)
     qapi_free_AnnounceParameters(params);
 }
 
+void hmp_cprsave(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+
+    qmp_cprsave(qdict_get_try_str(qdict, "file"),
+                qdict_get_try_str(qdict, "mode"),
+                &err);
+    hmp_handle_error(mon, err);
+}
+
 void hmp_migrate_cancel(Monitor *mon, const QDict *qdict)
 {
     qmp_migrate_cancel(NULL);