qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V3 6/9] qmp: add interface blockdev-snapshot-del


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH V3 6/9] qmp: add interface blockdev-snapshot-delete-internal-sync
Date: Thu, 4 Jul 2013 14:42:45 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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/



reply via email to

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