qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V2 09/12] qmp: add interface blockdev-snapshot-d


From: Wenchao Xia
Subject: Re: [Qemu-devel] [PATCH V2 09/12] qmp: add interface blockdev-snapshot-delete-internal-sync
Date: Mon, 17 Jun 2013 11:25:26 +0800
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

于 2013-6-15 17:55, Eric Blake 写道:
On 06/14/2013 12:39 PM, Wenchao Xia wrote:
Snapshot ID can't be specified in this interface.

Why not?  If it is possible to look up by id in isolation, then it
should be possible to delete by id in isolation.  Also, if it is
possible to create a snapshot that has an id but no name (and I think
qcow2 allows such snapshots, even if we don't want to expose that corner
case of creation via normal QMP), then it is mandatory to have a way to
delete by id, since there is no name to delete by.

  OK, qemu-img allows create snapshot with name="" before, so we need
take care for that corener case in this interface. Here is the redesign:

##
# @blockdev-snapshot-delete-internal-sync
#
# Synchronously delete an internal snapshot of a block device, when the ormat
# of the image used support it.
#
# @device: the name of the device to delete the snapshot from
#
# @name: the snapshot's name to be deleted
#
# @id: optional the snapshot's ID to be deleted. If specified, qemu will
#      try delete the snapshot matching both @name and @id.
#
# Returns: nothing on success
#          If @device is not a valid block device, DeviceNotFound
#          If snapshot not found, generic error will be returned
#
# Since 1.6
##
{ 'command': 'blockdev-snapshot-delete-internal-sync',
  'data': { 'device': 'str', 'name': 'str', '*id': 'str' } }

  Then caller specify name='' and id=[ID] to handle the corner case.



Signed-off-by: Wenchao Xia <address@hidden>
---
  blockdev.c       |   12 ++++++++++++
  qapi-schema.json |   19 +++++++++++++++++++
  qmp-commands.hx  |   30 ++++++++++++++++++++++++++++++
  3 files changed, 61 insertions(+), 0 deletions(-)


+++ b/qapi-schema.json
@@ -1712,6 +1712,25 @@
    'data': { 'device': 'str', '*name': 'str'} }

  ##
+# @blockdev-snapshot-delete-internal-sync
+#
+# Synchronously delete an internal snapshot of a block device, when the format
+# of the image used support it.

Should this command be made available via 'transaction'?  That is, if I
have a two-disk VM, and use 'transaction' to take a snapshot of both
disks at once, shouldn't I also have a way to delete the snapshots of
both at once, or gracefully fail without data loss if the second one has
problems?

  I think adding it in transaction is not very useful but brings more
complexity. Transcation is used to guareentee all operations are taken
in one time point, for example, snapshot creation use it to make sure
all are consistent to VM. But for deletion, this requirement do not
exist.



+#
+# @device: the name of the device to delete the snapshot from
+#
+# @name: the snapshot's name to be deleted
+#
+# Returns: nothing on success
+#          If @device is not a valid block device, DeviceNotFound
+#          If snapshot not found, generic error will be returned
+#
+# Since 1.6
+##
+{ 'command': 'blockdev-snapshot-delete-internal-sync',
+  'data': { 'device': 'str', 'name': 'str'} }

I'm not convinced that this interface is powerful enough.



--
Best Regards

Wenchao Xia




reply via email to

[Prev in Thread] Current Thread [Next in Thread]