From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uuis8-0007U3-VQ for qemu-devel@nongnu.org; Thu, 04 Jul 2013 08:42:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uuis5-0007Yi-Bc for qemu-devel@nongnu.org; Thu, 04 Jul 2013 08:42:52 -0400 Received: from mail-ee0-x236.google.com ([2a00:1450:4013:c00::236]:58337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uuis5-0007YS-5Z for qemu-devel@nongnu.org; Thu, 04 Jul 2013 08:42:49 -0400 Received: by mail-ee0-f54.google.com with SMTP id t10so753568eei.27 for ; Thu, 04 Jul 2013 05:42:48 -0700 (PDT) Date: Thu, 4 Jul 2013 14:42:45 +0200 From: Stefan Hajnoczi Message-ID: <20130704124245.GC4213@stefanha-thinkpad.redhat.com> References: <1372300908-7546-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1372300908-7546-7-git-send-email-xiawenc@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1372300908-7546-7-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH V3 6/9] qmp: add interface blockdev-snapshot-delete-internal-sync List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: kwolf@redhat.com, phrdina@redhat.com, famz@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, dietmar@proxmox.com On Thu, Jun 27, 2013 at 10:41:45AM +0800, Wenchao Xia wrote: > diff --git a/blockdev.c b/blockdev.c > index ce89f83..35fffd6 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -790,6 +790,67 @@ void qmp_blockdev_snapshot_internal_sync(const char *device, > &snapshot, errp); > } > > +SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device, > + bool has_id, > + const char *id, > + bool has_name, > + const char *name, > + Error **errp) > +{ > + BlockDriverState *bs = bdrv_find(device); > + QEMUSnapshotInfo sn; > + Error *local_err = NULL; > + SnapshotInfo *info = NULL; > + int ret; > + > + if (!bs) { > + error_set(errp, QERR_DEVICE_NOT_FOUND, device); > + return NULL; > + }; Spurious ';' > + > + if (!has_id) { > + id = NULL; > + } > + > + if (!has_name) { > + name = NULL; > + } > + > + if (!id && !name) { > + error_setg(errp, "Name or id must be provided"); > + return NULL; > + } > + > + ret = bdrv_snapshot_find_by_id_and_name(bs, id, name, &sn, &local_err); > + if (error_is_set(&local_err)) { > + error_propagate(errp, local_err); > + return NULL; > + } > + if (!ret) { > + error_setg(errp, > + "Snapshot with id '%s' and name '%s' do not exist on " s/do not exist/does not exist/ > diff --git a/qapi-schema.json b/qapi-schema.json > index fba9b15..ffcdca7 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -1760,6 +1760,33 @@ > '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. The snapshot is identified by name or id or > +# both. One of the name or id is required. It will returns SnapshotInfo of > +# successfully deleted snapshot. Return SnapshotInfo for the successfully deleted snapshot. > +SQMP > +blockdev-snapshot-delete-internal-sync > +-------------------------------------- > + > +Synchronously delete an internal snapshot of a block device when the format of > +image used support it. The snapshot is identified by name or id or both. One s/support/supports/ > +of the name or id is required. If the snapshot is not found, operation will > +fail. s/One of the name or id/One of name or id/ s/operation will fail/the operation will fail/