qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 5/8] dump-query: add "dump-query" command to query dump status
Date: Fri, 27 Nov 2015 15:03:13 +0800	[thread overview]
Message-ID: <56580031.5070405@redhat.com> (raw)
In-Reply-To: <20151127052523.GC10018@ad.usersys.redhat.com>



On 11/27/2015 01:25 PM, Fam Zheng wrote:
> On Fri, 11/27 10:48, Peter Xu wrote:
>> This patch is only adding the QMP/HMP interface for "dump-query"
>> command, but not implementing them. This command could be used to
>> query background dump status. Please refer to the next patch to see
>> how dump status are defined.
>>
>> Currently, only fake results are returned.
>>
>> Signed-off-by: Peter Xu <peterx@redhat.com>
>> ---
>>  dump.c           |  9 +++++++++
>>  hmp-commands.hx  | 15 +++++++++++++++
>>  hmp.c            |  6 ++++++
>>  hmp.h            |  1 +
>>  qapi-schema.json | 21 +++++++++++++++++++++
>>  qmp-commands.hx  | 29 ++++++++++++++++++++++++++++-
>>  6 files changed, 80 insertions(+), 1 deletion(-)
>>
>> diff --git a/dump.c b/dump.c
>> index 0d321d4..446a991 100644
>> --- a/dump.c
>> +++ b/dump.c
>> @@ -1777,6 +1777,15 @@ void qmp_dump_guest_memory(bool paging, const char *file,
>>      }
>>  }
>>  
>> +DumpStatus *qmp_dump_query(Error **errp)
>> +{
>> +    DumpStatus *status = g_malloc0(sizeof(*status));
>> +    /* TBD */
>> +    status->status = g_strdup("WORKING");
>> +    status->percentage = g_strdup("50%");
>> +    return status;
>> +}
>> +
>>  DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)
>>  {
>>      DumpGuestMemoryFormatList *item;
>> diff --git a/hmp-commands.hx b/hmp-commands.hx
>> index 664d794..4ce7721 100644
>> --- a/hmp-commands.hx
>> +++ b/hmp-commands.hx
>> @@ -1087,6 +1087,21 @@ gdb. Without -z|-l|-s, the dump format is ELF.
>>              together with begin.
>>  ETEXI
>>  
>> +    {
>> +        .name       = "dump-query",
>> +        .args_type  = "",
>> +        .params     = "",
>> +        .help       = "query last guest memory dump status.\n\t\t\t",
> 
> What are "\n\t\t\t" doing here?

Sorry I should remove that.

> 
>> +        .mhandler.cmd = hmp_dump_query,
>> +    },
>> +
>> +
>> +STEXI
>> +@item dump-query
>> +@findex dump-query
>> +Query latest dump status.
>> +ETEXI
>> +
>>  #if defined(TARGET_S390X)
>>      {
>>          .name       = "dump-skeys",
>> diff --git a/hmp.c b/hmp.c
>> index dccb457..6d9c127 100644
>> --- a/hmp.c
>> +++ b/hmp.c
>> @@ -1576,6 +1576,12 @@ void hmp_device_del(Monitor *mon, const QDict *qdict)
>>      hmp_handle_error(mon, &err);
>>  }
>>  
>> +void hmp_dump_query(Monitor *mon, const QDict *qdict)
>> +{
>> +    /* TBD */
>> +    monitor_printf(mon, "QUERY DUMP STATUS\n");
>> +}
>> +
>>  void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
>>  {
>>      Error *err = NULL;
>> diff --git a/hmp.h b/hmp.h
>> index a8c5b5a..fdde4a3 100644
>> --- a/hmp.h
>> +++ b/hmp.h
>> @@ -85,6 +85,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict);
>>  void hmp_device_add(Monitor *mon, const QDict *qdict);
>>  void hmp_device_del(Monitor *mon, const QDict *qdict);
>>  void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict);
>> +void hmp_dump_query(Monitor *mon, const QDict *qdict);
>>  void hmp_netdev_add(Monitor *mon, const QDict *qdict);
>>  void hmp_netdev_del(Monitor *mon, const QDict *qdict);
>>  void hmp_getfd(Monitor *mon, const QDict *qdict);
>> diff --git a/qapi-schema.json b/qapi-schema.json
>> index fd81ce2..5db615d 100644
>> --- a/qapi-schema.json
>> +++ b/qapi-schema.json
>> @@ -2139,6 +2139,27 @@
>>              '*format': 'DumpGuestMemoryFormat'} }
>>  
>>  ##
>> +# @DumpStatus
>> +#
>> +# Status for the last guest memory dump.
>> +#
>> +# Since: 2.6
>> +##
>> +{ 'struct': 'DumpStatus',
>> +  'data': { 'status': 'str', 'percentage': 'str' } }
> 
> I suggest using enum for "status" and int for "percentage" (or two ints for
> "total" and "current").

Yes, I picked string just for flexibility. Regarding to this
interface issue, I'd like to wait for others' comments too before
modification.

> 
>> +
>> +##
>> +# @dump-query
>> +#
>> +# Query latest dump status.
>> +#
>> +# Returns: A @DumpStatus object showing the dump status.
>> +#
>> +# Since: 2.6
>> +##
>> +{ 'command': 'dump-query', 'returns': 'DumpStatus' }
>> +
>> +##
>>  # @DumpGuestMemoryCapability:
>>  #
>>  # A list of the available formats for dump-guest-memory
>> diff --git a/qmp-commands.hx b/qmp-commands.hx
>> index bbb08e1..6d13778 100644
>> --- a/qmp-commands.hx
>> +++ b/qmp-commands.hx
>> @@ -879,9 +879,36 @@ Notes:
>>  EQMP
>>  
>>      {
>> +        .name       = "dump-query",
>> +        .args_type  = "",
>> +        .params     = "",
>> +        .help       = "query background dump status",
>> +        .mhandler.cmd_new = qmp_marshal_dump_query,
>> +    },
>> +
>> +SQMP
>> +dump-query
>> +----------
>> +
>> +Query background dump status.
>> +
>> +Arguments: None.
>> +
>> +Example:
>> +
>> +-> { "execute": "dump-query" }
>> +<- { "return": {"status": "IN_PROGRESS", "percentage": "85%" } }
>> +
>> +Notes:
>> +
>> +(1) All boolean arguments default to false
> 
> Which "boolean arguments"?

Should remove. Sorry.

Peter

> 
> 
>> +
>> +EQMP
>> +
>> +    {
>>          .name       = "query-dump-guest-memory-capability",
>>          .args_type  = "",
>> -    .mhandler.cmd_new = qmp_marshal_query_dump_guest_memory_capability,
>> +        .mhandler.cmd_new = qmp_marshal_query_dump_guest_memory_capability,
>>      },
>>  
>>  SQMP
>> -- 
>> 2.4.3
>>
>>

  reply	other threads:[~2015-11-27  7:03 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27  2:48 [Qemu-devel] [PATCH v2 0/8] Add basic "detach" support for dump-guest-memory Peter Xu
2015-11-27  2:48 ` [Qemu-devel] [PATCH v2 1/8] dump-guest-memory: cleanup: removing dump_{error|cleanup}() Peter Xu
2015-11-27  4:28   ` Fam Zheng
2015-11-27  6:51     ` Peter Xu
2015-11-27  2:48 ` [Qemu-devel] [PATCH v2 2/8] dump-guest-memory: add "detach" flag for QMP/HMP interfaces Peter Xu
2015-11-27  4:31   ` Fam Zheng
2015-11-27  6:05     ` Peter Xu
2015-11-30 18:21   ` Eric Blake
2015-12-01  1:28     ` Peter Xu
2015-11-27  2:48 ` [Qemu-devel] [PATCH v2 3/8] dump-guest-memory: add basic "detach" support Peter Xu
2015-11-27  5:14   ` Fam Zheng
2015-11-27  5:20     ` Fam Zheng
2015-11-27  6:27     ` Peter Xu
2015-11-27 10:14       ` Paolo Bonzini
2015-11-27 11:03         ` Peter Xu
2015-11-28  5:51     ` Peter Xu
2015-11-30  1:48       ` Fam Zheng
2015-11-27 10:31   ` Paolo Bonzini
2015-11-27 11:26     ` Peter Xu
2015-11-27 11:52       ` Paolo Bonzini
2015-11-27  2:48 ` [Qemu-devel] [PATCH v2 4/8] dump-guest-memory: add qmp event DUMP_COMPLETED Peter Xu
2015-11-27  5:19   ` Fam Zheng
2015-11-27  6:43     ` Peter Xu
2015-11-27 10:15   ` Paolo Bonzini
2015-11-27 11:29     ` Peter Xu
2015-11-30 18:18   ` Eric Blake
2015-12-01  1:52     ` Peter Xu
2015-11-27  2:48 ` [Qemu-devel] [PATCH v2 5/8] dump-query: add "dump-query" command to query dump status Peter Xu
2015-11-27  5:25   ` Fam Zheng
2015-11-27  7:03     ` Peter Xu [this message]
2015-11-27 10:17       ` Paolo Bonzini
2015-11-27 11:33         ` Peter Xu
2015-11-30 18:27   ` Eric Blake
2015-12-01  2:03     ` Peter Xu
2015-11-27  2:48 ` [Qemu-devel] [PATCH v2 6/8] dump-query: implement "status" of "dump-query" command Peter Xu
2015-11-27 10:22   ` Paolo Bonzini
2015-11-27 11:42     ` Peter Xu
2015-11-27 11:53       ` Paolo Bonzini
2015-11-27  2:48 ` [Qemu-devel] [PATCH v2 7/8] DumpState: adding total_size and written_size fields Peter Xu
2015-11-27  2:48 ` [Qemu-devel] [PATCH v2 8/8] dump-query: make the percentage accurate Peter Xu
2015-11-27  2:59 ` [Qemu-devel] [PATCH v2 0/8] Add basic "detach" support for dump-guest-memory Peter Xu
2015-11-27  5:28 ` Fam Zheng
2015-11-27  6:53   ` Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56580031.5070405@redhat.com \
    --to=peterx@redhat.com \
    --cc=famz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).