From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Pavel Hrdina <phrdina@redhat.com>,
qemu-devel@nongnu.org, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 07/11] qapi: Convert savevm
Date: Tue, 09 Apr 2013 11:46:31 -0600 [thread overview]
Message-ID: <516453F7.3030100@redhat.com> (raw)
In-Reply-To: <8738uz39ep.fsf@blackfin.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 5326 bytes --]
On 04/09/2013 11:23 AM, Markus Armbruster wrote:
>> If we mandate that a tag always be supplied, then we cannot create qcow2
>> files with a snapshot that lacks a tag using just QMP; but even if we do
>
> Are you sure you can do that with the proposed patches? If I read them
> correctly, we make up a tag vm-%Y%m%d%H%M%S when none is given.
HMP is higher-level than QMP, so having HMP default to always generating
a tag seems like a reasonable thing. In my opinion, it's okay for
higher layers to ensure a name even when lower layers leave it optional.
Besides, HMP aims to ease user interface and it is easier to work with
named snapshots than it is to work with anonymous ones, even if that
means HMP generates a name. We already have instances where HMP is
intentionally less powerful than QMP, because if you are using the human
interface, you don't need to be bothered by the subtleties - and if you
need the full power, then you use the lower-level interface. On the
other hand, we could always change our mind later to have HMP create
anonymous snapshots (by adding another flag to HMP 'savevm') instead of
generating a name.
Where we would get into trouble is if QMP enforces a name but we change
our mind and later want HMP to again expose the possibility of anonymous
snapshots. Also, if QMP doesn't expose the full power of the file
format on creation, but still has to support the full power of the file
format on the loadvm side, it becomes that much harder to test that the
loadvm support is correct in the presence of anonymous snapshots.
>
>> that, we STILL have to support use of existing qcow2 files that were
>> created by earlier qemu and/or other tools that have snapshots without a
>> tag.
>
> I understand the need to deal with existing qcow2 files lacking tags.
>
> I understand the desire to be able to create such files via QMP. I
> don't share it, though :)
I'm on the fence - I could live with the requirement that QMP requires a
name, and that creation of anonymous snapshots requires other tools.
Libvirt will always pass a name, for what it is worth, regardless of
whether HMP generates a name, and regardless of whether QMP requires a
name. But testing nameless support is harder if it requires an extra
tool to create a nameless snapshot in the first place.
>
> For block driver method bdrv_snapshot_create() both tag and ID are
> optional. If ID is missing, it picks one. qcow2 picks max. existing ID
> + 1. If tag is missing, the snapshot doesn't get one.
>
> When savevm overwrites an existing snapshot, it reuses both tag and ID.
> One of them matches @name.
>
> When savevm creates a new snapshot, @name becomes the tag. If @name
> isn't given, we make one up. ID is left to the block driver.
>
> vm-snapshot-save behaves the same.
>
> Say we have two snapshots, with IDs 1 and 5. Say I want to overwrite
> the first one, and chose to identify it by its ID. Since I got dirt on
> my monitor, I misread ID 7. Since neither ID nor tag 7 exist, I
> accidentally create a new snapshot with tag 7 and ID 6 (picked by qcow2
> block driver). Next new snapshot will inevitably get ID 7 and the
> confusion is complete. All because the stupid command doesn't let me
> express myself clearly: I mean *ID* 7, *not* tag 7!
Yep - another instance of the confusion that current HMP 'savevm' has,
and that I want to get rid of by adding -f as a force option at a
minimum to the HMP layer.
>
> I think I'd try the following for QMP:
>
> * Drop the capability to overwrite existing snapshot. No real loss, as
> it's not an atomic overwrite: it first deletes the old one, then
> creates the new one, and if create fails, the old one's still gone.
We'd _still_ want to add HMP 'savevm -f' to force an overwrite, but you
are saying that the HMP command would then be a sequence of _two_ QMP
calls - delete then create, where QMP create _always_ fails if a
snapshot already exists with that name. Makes sense - it just means
that the 'force' semantics are now put as a burden on the caller,
instead of on QMP.
>
> * Take parameter @tag and @id.
>
> Fail if @tag is given and matches any existing tag. If it's not
> given, we make one up that doesn't match any existing tag.
Generating an id makes sense. And the command must return the id that
got used (whether passed in by the user or generated).
>
> Fail if @id is given and matches any existing ID. If it's not given,
> we make one up that doesn't match any existing ID.
I don't know if I like the idea of QMP generating a tag, vs. leaving the
snapshot anonymous. But note that the answer to the next question
determines whether we can bypass this question, since if...
>
> * Seriously consider making @tag mandatory.
...tag is made mandatory, then QMP never has to generate a tag. I'm
still on the fence on whether to always have a tag in place (whether by
QMP generation or by mandatory argument) vs. allowing anonymous
snapshots. But again, libvirt always names its snapshots, and I trust
your judgment as maintainer of this area of code in which way we should go.
--
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: 621 bytes --]
next prev parent reply other threads:[~2013-04-09 17:46 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-29 14:12 [Qemu-devel] [PATCH v4 00/11] convert savevm to use qapi and introduce qmp command Pavel Hrdina
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 01/11] block: add error parameter to bdrv_snapshot_create() and related functions Pavel Hrdina
2013-04-09 13:13 ` Markus Armbruster
2013-04-09 13:43 ` Kevin Wolf
2013-04-09 16:21 ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 02/11] block: add error parameter to del_existing_snapshots() Pavel Hrdina
2013-04-09 13:27 ` Markus Armbruster
2013-04-09 14:14 ` Luiz Capitulino
2013-04-10 9:57 ` Pavel Hrdina
2013-04-10 11:33 ` Markus Armbruster
2013-04-10 12:06 ` Eric Blake
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 03/11] savevm: add error parameter to qemu_savevm_state_begin() Pavel Hrdina
2013-04-09 13:34 ` Markus Armbruster
2013-04-09 13:37 ` Markus Armbruster
2013-04-09 13:47 ` Pavel Hrdina
2013-04-09 13:49 ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 04/11] savevm: add error parameter to qemu_savevm_state_iterate() Pavel Hrdina
2013-04-09 13:41 ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 05/11] savevm: add error parameter to qemu_savevm_state_complete() Pavel Hrdina
2013-04-09 13:56 ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 06/11] savevm: add error parameter to qemu_savevm_state() Pavel Hrdina
2013-04-09 14:00 ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 07/11] qapi: Convert savevm Pavel Hrdina
2013-03-29 16:12 ` Eric Blake
2013-03-29 16:21 ` Pavel Hrdina
2013-04-09 16:04 ` Markus Armbruster
2013-04-09 16:12 ` Eric Blake
2013-04-09 17:23 ` Markus Armbruster
2013-04-09 17:46 ` Eric Blake [this message]
2013-04-10 8:01 ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 08/11] qemu-img: introduce qemu_img_handle_error Pavel Hrdina
2013-04-09 16:10 ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 09/11] block: update return value from bdrv_snapshot_create Pavel Hrdina
2013-04-09 16:29 ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 10/11] savevm: update return value from qemu_savevm_state Pavel Hrdina
2013-04-09 16:32 ` Markus Armbruster
2013-03-29 14:12 ` [Qemu-devel] [PATCH v4 11/11] savevm: add force parameter to HMP command and return snapshot info Pavel Hrdina
2013-04-09 16:45 ` Markus Armbruster
2013-04-10 8:18 ` [Qemu-devel] [PATCH v4 00/11] convert savevm to use qapi and introduce qmp command Markus Armbruster
2013-04-10 10:53 ` Pavel Hrdina
2013-04-10 12:24 ` Eric Blake
2013-04-10 12:40 ` Luiz Capitulino
2013-04-10 12:49 ` Eric Blake
2013-04-10 13:22 ` Pavel Hrdina
2013-04-10 13:32 ` Luiz Capitulino
2013-04-10 13:50 ` Pavel Hrdina
2013-04-10 14:05 ` Pavel Hrdina
2013-04-10 17:15 ` Eric Blake
2013-04-10 17:33 ` Pavel Hrdina
2013-04-17 2:48 ` Wenchao Xia
2013-04-11 9:20 ` Markus Armbruster
2013-04-15 12:10 ` Kevin Wolf
2013-04-15 13:16 ` Eric Blake
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=516453F7.3030100@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=lcapitulino@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.