qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Pavel Hrdina <phrdina@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 18/18] vm-snapshot-save: add force parameter
Date: Wed, 15 Aug 2012 23:00:22 -0600	[thread overview]
Message-ID: <502C7E66.8040703@redhat.com> (raw)
In-Reply-To: <582c2debbce809a86fe62d6a998d42bee8ef274c.1345016001.git.phrdina@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3802 bytes --]

On 08/15/2012 01:41 AM, Pavel Hrdina wrote:
> HMP command "savevm" now takes extra optional force parameter to specifi whether

s/specifi/specify/

> replace existing snapshot or not.
> 
> QMP command "vm-snapshot-save" has also extra optional force parameter and
> name parameter isn't optional anymore.

When HMP omits the name, what name are you using in it's place?  Either
a nameless snapshot is okay (and QMP must expose it), or it is an error
(and HMP must now be passing a reasonable name).

/me reads patch

Oh, there was always a name; the default name was a timestamp, and you
moved the timestamp creation into HMP.


> +++ b/hmp-commands.hx
> @@ -264,19 +264,19 @@ ETEXI
>  
>      {
>          .name       = "savevm",
> -        .args_type  = "name:s?",
> -        .params     = "[tag|id]",
> -        .help       = "save a VM snapshot. If no tag or id are provided, a new snapshot is created",
> +        .args_type  = "name:s?,force:b?",
> +        .params     = "[tag|id] [on|off]",

Rather than sticking 'force' as an optional parameter at the end,
instead you want to add '-f' as a flag at the beginning.

.args_type = "force:-b,name:s?",
.params = "[-f] name"

By doing this, you no longer need 17/18.

> +        .help       = "save a VM snapshot. To replace existing snapshot use force parameter.",
>          .mhandler.cmd = hmp_vm_snapshot_save,
>      },
>  
>  STEXI
>  @item savevm [@var{tag}|@var{id}]
>  @findex savevm
> -Create a snapshot of the whole virtual machine. If @var{tag} is
> -provided, it is used as human readable identifier. If there is already
> -a snapshot with the same tag or ID, it is replaced. More info at
> -@ref{vm_snapshots}.
> +Create a snapshot of the whole virtual machine. Parameter "name" is optional.
> +If @var{tag} is provided, it is used as human readable identifier. If there is
> +already a snapshot with the same tag, force argument need to be "yes" to

s/force argument need/the force argument needs/

> +++ b/qapi-schema.json
> @@ -2394,21 +2394,23 @@
>  ##
>  # @vm-snapshot-save:
>  #
> -# Create a snapshot of the whole virtual machine. If 'tag' is provided,
> -# it is used as human readable identifier. If there is already a snapshot
> -# with the same tag or ID, it is replaced.
> +# Create a snapshot of the whole virtual machine. Provided 'tag' is used as
> +# human readable identifier. If there is already a snapshot with the same tag,
> +# force argument need to be "yes" to replace it.

s/need to be "yes"/needs to be 'true'/

>  #
>  # The VM is automatically stopped and resumed and saving a snapshot can take
>  # a long time.
>  #
> -# @name: tag or id of new or existing snapshot
> +# @name: tag of new or existing snapshot

Given your new semantics, @name must be tag when @force is false; but
the old HMP semantics allowed 'savevm 1' to rewrite snapshot id 1
regardless of the name, all while keeping the old tag.  Does the new HMP
code do an id lookup, and pass in the correct @name to the QMP code?
Should the QMP code allow the same semantics of being able to pass
@force=true and @name=id instead of the normal creation of @name=tag?

> +#
> +# @force: specify whether existing snapshot is replaced or not

Based on the JSON below, this needs an #optional marking, as well as
mentioning that the default is false.

>  #
>  # Returns: Nothing on success
>  #          If an error occurs, GenericError with error message

Knowing that a creation failed due to a snapshot already existing by the
same name or id might be worth a distinct error class (do we already
have an error class that we could reuse?)

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

  reply	other threads:[~2012-08-16  5:00 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-15  7:41 [Qemu-devel] [PATCH 00/18] qapi: Convert savevm, loadvm, delvm and info snapshots Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 01/18] qerror: introduce QERR_GENERIC_ERROR Pavel Hrdina
2012-08-30 12:11   ` Luiz Capitulino
2012-09-06  8:34     ` Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 02/18] block: add error parameter to bdrv_snapshot_create() and related functions Pavel Hrdina
2012-08-30 14:47   ` Luiz Capitulino
2012-08-31  6:26     ` Markus Armbruster
2012-08-31 12:18       ` Kevin Wolf
2012-08-31 13:13         ` Luiz Capitulino
2012-08-31 13:09       ` Luiz Capitulino
2012-09-06  9:07     ` Pavel Hrdina
2012-09-10 17:03       ` Luiz Capitulino
2012-08-15  7:41 ` [Qemu-devel] [PATCH 03/18] block: add error parameter to bdrv_snapshot_goto() " Pavel Hrdina
2012-08-30 15:07   ` Luiz Capitulino
2012-08-15  7:41 ` [Qemu-devel] [PATCH 04/18] block: add error parameter to bdrv_snapshot_delete() " Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 05/18] block: add error parameter to bdrv_snapshot_list() " Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 06/18] block: add error parameter to bdrv_snapshot_find() Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 07/18] block: add error parameter to del_existing_snapshots() Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 08/18] savevm: add error parameter to qemu_savevm_state_begin() Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 09/18] savevm: add error parameter to qemu_savevm_state_iterate() Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 10/18] savevm: add error parameter to qemu_savevm_state_complete() Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 11/18] savevm: add error parameter to qemu_savevm_state() Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 12/18] savevm: add error parameter to qemu_loadvm_state() Pavel Hrdina
2012-08-30 17:09   ` Luiz Capitulino
2012-09-06  8:33     ` Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 13/18] qapi: Convert savevm Pavel Hrdina
2012-08-15 19:49   ` Eric Blake
2012-08-16 10:16     ` Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 14/18] qapi: Convert loadvm Pavel Hrdina
2012-08-16  3:31   ` Eric Blake
2012-08-16  4:34     ` Eric Blake
2012-08-15  7:41 ` [Qemu-devel] [PATCH 15/18] qapi: Convert delvm Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 16/18] qapi: Convert info snapshots Pavel Hrdina
2012-08-16  4:36   ` Eric Blake
2012-08-16 10:17     ` Pavel Hrdina
2012-08-15  7:41 ` [Qemu-devel] [PATCH 17/18] hmp: allow "bool" parameter to be optional Pavel Hrdina
2012-08-16  4:39   ` Eric Blake
2012-08-15  7:41 ` [Qemu-devel] [PATCH 18/18] vm-snapshot-save: add force parameter Pavel Hrdina
2012-08-16  5:00   ` Eric Blake [this message]
2012-08-16 10:19     ` Pavel Hrdina
2012-08-30 17:15 ` [Qemu-devel] [PATCH 00/18] qapi: Convert savevm, loadvm, delvm and info snapshots Luiz Capitulino

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=502C7E66.8040703@redhat.com \
    --to=eblake@redhat.com \
    --cc=phrdina@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).