From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: Eric Blake <eblake@redhat.com>
Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com,
qemu-devel@nongnu.org, blauwirbel@gmail.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH 5/6] snapshot: qmp interface
Date: Fri, 04 Jan 2013 14:02:34 +0800 [thread overview]
Message-ID: <50E6707A.4080302@linux.vnet.ibm.com> (raw)
In-Reply-To: <50E449B4.1000803@redhat.com>
Thanks for reviewing, I'll correct the spelling.
>> +
>> +##
>> # @NewImageMode
>> #
>> # An enumeration that tells QEMU how to set the backing file path in
>> -# a new image file.
>> +# a new image file, or how to use internal snapshot record.
>> #
>> -# @existing: QEMU should look for an existing image file.
>> +# @existing: QEMU should look for an existing image file or internal snapshot
>> +# record. In external snapshot case, qemu will skip create new image
>> +# file, In internal snapshot case qemu will try use the existing
>
> s/In/in/
>
>> +# one. if not found operation would fail.
>
> s/. if/. If/; s/would/will/
>
>> #
>> -# @absolute-paths: QEMU should create a new image with absolute paths
>> -# for the backing file.
>> +# @absolute-paths: QEMU should create a new image with absolute paths for
>> +# the backing file in external snapshot case, or create a new
>> +# snapshot record in internal snapshot case which will
>> +# overwrite internal snapshot record if it already exist.
>
> Doesn't quite make sense - internal snapshots don't record a path, so
> why is absolute-paths the right mode for requesting the creation of a
> new snapshot? I think it would make more sense if you add a new mode,
> and then declare that absolute-paths is invalid for internal snapshots,
> and that the new mode is invalid for external snapshots.
>
OK,
>> #
>> -# Since: 1.1
>> +# Since: 1.1, internal support since 1.4.
>> ##
>> { 'enum': 'NewImageMode'
>> 'data': [ 'existing', 'absolute-paths' ] }
>> @@ -1478,16 +1497,39 @@
>> #
>> # @device: the name of the device to generate the snapshot from.
>> #
>> -# @snapshot-file: the target of the new image. A new file will be created.
>> +# @snapshot-file: the target name of the snapshot. In external case, it is
>> +# the new file's name, A new file will be created. In internal
>
> s/A/a/
>
> and a new file is only created according to mode.
>
OK.
>> +# case, it is the internal snapshot record's name and if it is
>> +# 'blank' name will be generated according to time.
>
> Ugg. Passing an empty string for snapshot-file as a special case seems
> awkward; it might be better to make it an optional argument via
> '*snapshot-file', where the argument is mandatory for external, but
I think *snapshot-file is great, but it will change the interface
which already exist triggering compatialbility issue, is this allowed?
> omitting the argument on internal allows the fallback naming. Or why do
> you even need to worry about fallback naming? Requiring the user to
> always provide a record name may be easier to support (certainly fewer
> corner cases to worry about).
>
If cost is low, I think providing it is not bad, and thus hmp/qmp
can have same capability.
>> #
>> # @format: #optional the format of the snapshot image, default is 'qcow2'.
>> #
>> -# @mode: #optional whether and how QEMU should create a new image, default is
>> -# 'absolute-paths'.
>> +# @mode: #optional whether QEMU should create a new snapshot or use existing
>> +# one, default is 'absolute-paths'.
>
> Does this default still make sense for internal snapshots, or do you
> need to document that the default mode differs depending on the type of
> snapshot being taken?
>
I'll add another optional argument and keeps mode only for external
snapshot.
>> +#
>> +# @type: #optional internal snapshot or external, default is 'external'.
>
> Mention that this field is new since 1.4.
>
OK.
>> +#
>> ##
>> { 'type': 'BlockdevSnapshot',
>> 'data': { 'device': 'str', 'snapshot-file': 'str', '*format': 'str',
>> - '*mode': 'NewImageMode' } }
>> + '*mode': 'NewImageMode', '*type': 'SnapshotType'} }
>> +
>> +##
>> +# @BlockdevSnapshotDelete
>> +#
>> +# @device: the name of the device to delete the snapshot from.
>> +#
>> +# @snapshot-file: the target name of the snapshot. In external case, it is
>> +# the file's name to be merged, In internal case, it is the
>> +# internal snapshot record's name.
>
> What happens if there is no record name (since the qcow2 file does not
> require one)?
I think snapshot id should be provided then.
>> +#
>> +# @type: #optional internal snapshot or external, default is
>> +# 'external', note that delete 'external' snapshot is not supported
>> +# now for that it is the same to commit it.
>
> If external is not supported, then why do you even need this parameter?
> Besides, shouldn't it be pretty obvious from the snapshot-file argument
> whether the snapshot exists internally or externally, without needing
> the user to tell you that?
>
I thought it is not easy to tell the difference just from file, could
u tip how?
>> +##
>> +{ 'type': 'BlockdevSnapshotDelete',
>> + 'data': { 'device': 'str', 'snapshot-file': 'str',
>> + '*type': 'SnapshotType'} }
>>
>> ##
>> # @BlockdevAction
>> @@ -1498,6 +1540,7 @@
>> { 'union': 'BlockdevAction',
>> 'data': {
>> 'blockdev-snapshot-sync': 'BlockdevSnapshot',
>> + 'blockdev-snapshot-delete-sync': 'BlockdevSnapshotDelete',
>> } }
>>
>> ##
>> @@ -1530,23 +1573,54 @@
>> #
>> # @device: the name of the device to generate the snapshot from.
>> #
>> -# @snapshot-file: the target of the new image. If the file exists, or if it
>> -# is a device, the snapshot will be created in the existing
>> -# file/device. If does not exist, a new file will be created.
>> +# @snapshot-file: the target name of the snapshot. In external case, it is
>> +# the new file's name, A new file will be created. If the file
>> +# exists, or if it is a device, the snapshot will be created in
>> +# the existing file/device. If does not exist, a new file will
>> +# be created. In internal case, it is the internal snapshot
>> +# record's name, if it is 'blank' name will be generated
>> +# according to time.
>
> Again, special casing the empty string seems awkward; making the field
> optional for the internal case might make more sense.
>
OK, if API compatible issue is acceptable.
>> #
>> # @format: #optional the format of the snapshot image, default is 'qcow2'.
>
> Is this field compatible with internal snapshots?
>
no, I'll doc it.
>> #
>> # @mode: #optional whether and how QEMU should create a new image, default is
>> # 'absolute-paths'.
>> #
>> +# @type: #optional internal snapshot or external, default is
>> +# 'external'.
>
> Mention that this field was added in 1.4.
>
OK.
>> +#
>> # Returns: nothing on success
>> # If @device is not a valid block device, DeviceNotFound
>> #
>> -# Since 0.14.0
>> +# Since 0.14.0, internal snapshot supprt since 1.4.
>> ##
>> { 'command': 'blockdev-snapshot-sync',
>> 'data': { 'device': 'str', 'snapshot-file': 'str', '*format': 'str',
>> - '*mode': 'NewImageMode'} }
>> + '*mode': 'NewImageMode', '*type': 'SnapshotType'} }
>> +
>> +##
>> +# @blockdev-snapshot-delete-sync
>> +#
>> +# Delete a synchronous snapshot of a block device.
>
> Wrong. Rather, this is a synchronous operation that deletes a snapshot,
> regardless of whether the snapshot was created synchronously or
> asynchronously.
>
OK, the doc will be changed to tip better.
> Remember, the original goal was to come up with a way to take snapshots
> in a way that didn't require blocking until the operation was done; and
> once such an interface is present, then that becomes a new operation
> blockdev-snapshot-async (or more than one command, in order to drive the
> sequence of operations needed). blockdev-snapshot-sync would then be
> rewritten as a wrapper that calls the underlying sequence of operations
> in one command, blocking until complete.
>
> But for deletion, we might as well do it right from the beginning. I
> wonder if you can even design things to just have
> 'blockdev-snapshot-delete' without needing to distinguish between a sync
> or async operation.
>
There is already API as blockdev-snapshot-sync, this will break
the mirror, do you think it is OK? Actually I think it is OK
to redesign API including old one as blockdev-snapshot,
blockdev-snapshot-delete, but again it brings compatible issue.
Or another solution which keep API unchanged as:
blockdev-snapshot-sync
blockdev-snapshot-delete-sync
blockdev-snapshot-async
blockdev-snapshot-delete-async
>> +#
>> +# @device: the name of the device to delete the snapshot from.
>> +#
>> +# @snapshot-file: the target name of the snapshot. In external case, it is
>> +# the file's name to be merged, In internal case, it is the
>> +# internal snapshot record's name.
>> +#
>> +# @type: #optional internal snapshot or external, default is
>> +# 'external', note that delete 'external' snapshot is not supported
>> +# now for that it is the same to commit it.
>
> Again, do you really need this field, or can it be inferred from
> snapshot-file?
>
>> +#
>> +# Returns: nothing on success
>> +# If @device is not a valid block device, DeviceNotFound
>> +#
>> +# Since 1.4
>> +##
>> +{ 'command': 'blockdev-snapshot-delete-sync',
>> + 'data': { 'device': 'str', 'snapshot-file': 'str',
>> + '*type': 'SnapshotType'} }
>>
>> ##
>> # @human-monitor-command:
>>
>
--
Best Regards
Wenchao Xia
next prev parent reply other threads:[~2013-01-04 6:03 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-17 6:25 [Qemu-devel] [PATCH 0/6] snapshot: take snapshots in unified way Wenchao Xia
2012-12-17 6:25 ` [Qemu-devel] [PATCH 1/6] snapshot: export function in block.c Wenchao Xia
2012-12-21 18:13 ` Juan Quintela
2012-12-25 4:31 ` Wenchao Xia
2013-01-04 14:49 ` Stefan Hajnoczi
2013-01-05 8:26 ` Wenchao Xia
2013-01-07 16:43 ` Kevin Wolf
2013-01-08 2:25 ` Wenchao Xia
2013-01-08 10:37 ` Kevin Wolf
2013-01-09 4:32 ` Wenchao Xia
2012-12-17 6:25 ` [Qemu-devel] [PATCH 2/6] snapshot: add error set function Wenchao Xia
2012-12-20 21:36 ` Eric Blake
2012-12-21 2:37 ` Wenchao Xia
2013-01-04 14:55 ` Stefan Hajnoczi
2013-01-05 8:27 ` Wenchao Xia
2012-12-17 6:25 ` [Qemu-devel] [PATCH 3/6] snapshot: design of common API to take snapshots Wenchao Xia
2012-12-21 18:48 ` Eric Blake
2012-12-25 5:25 ` Wenchao Xia
2012-12-21 18:49 ` Juan Quintela
2012-12-25 5:24 ` Wenchao Xia
2012-12-17 6:25 ` [Qemu-devel] [PATCH 4/6] snapshot: implemention " Wenchao Xia
2012-12-17 6:36 ` Dietmar Maurer
2012-12-17 7:38 ` Wenchao Xia
2012-12-17 7:52 ` Dietmar Maurer
2012-12-17 8:52 ` Wenchao Xia
2012-12-17 9:58 ` Dietmar Maurer
2012-12-20 22:19 ` Eric Blake
2012-12-21 3:01 ` Wenchao Xia
2012-12-21 6:20 ` Dietmar Maurer
2013-01-04 16:13 ` Stefan Hajnoczi
2012-12-17 10:32 ` Dietmar Maurer
2012-12-18 10:29 ` Wenchao Xia
2012-12-18 10:36 ` Dietmar Maurer
2012-12-19 3:34 ` Wenchao Xia
2012-12-19 4:55 ` Dietmar Maurer
2012-12-19 5:37 ` Wenchao Xia
2012-12-21 18:48 ` Juan Quintela
2012-12-25 5:16 ` Wenchao Xia
2012-12-17 6:25 ` [Qemu-devel] [PATCH 5/6] snapshot: qmp interface Wenchao Xia
2013-01-02 14:52 ` Eric Blake
2013-01-04 6:02 ` Wenchao Xia [this message]
2013-01-04 13:57 ` Eric Blake
2013-01-04 16:22 ` Stefan Hajnoczi
2013-01-05 8:38 ` Wenchao Xia
2012-12-17 6:25 ` [Qemu-devel] [PATCH 6/6] snapshot: human monitor interface Wenchao Xia
2013-01-04 15:44 ` Stefan Hajnoczi
2013-01-05 8:36 ` Wenchao Xia
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=50E6707A.4080302@linux.vnet.ibm.com \
--to=xiawenc@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/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).