[libvirt] [libvirt-glib] [PATCH] GVirDomainSnapshot: add gvir_domain_snapshot_delete
Christophe Fergeau
cfergeau at redhat.com
Fri May 30 12:06:05 UTC 2014
On Thu, May 29, 2014 at 01:46:02PM +0200, Timm Bäder wrote:
> ---
> libvirt-gobject/libvirt-gobject-domain-snapshot.c | 21 +++++++++++++++++++++
> libvirt-gobject/libvirt-gobject-domain-snapshot.h | 3 +++
> libvirt-gobject/libvirt-gobject.sym | 5 +++++
> 3 files changed, 29 insertions(+)
>
> diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
> index ab23342..f46c99b 100644
> --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
> +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
> @@ -206,3 +206,24 @@ GVirConfigDomainSnapshot *gvir_domain_snapshot_get_config
> free(xml);
> return conf;
> }
> +
> +/**
> + * gvir_domain_snapshot_delete:
> + * @snapshot: the domain_snapshot
no need for '_' here
> + * @error: (allow-none): Place-holder for error or NULL
> + */
> +void gvir_domain_snapshot_delete(GVirDomainSnapshot *snapshot, GError **error)
> +{
> + GVirDomainSnapshotPrivate *priv;
> + int status;
> +
> + g_return_if_fail(GVIR_IS_DOMAIN_SNAPSHOT (snapshot));
> + g_return_if_fail(error == NULL || *error == NULL);
> +
> + priv = snapshot->priv;
> + status = virDomainSnapshotDelete(priv->handle, 0);
virDomainSnapshotDelete flags seem to provide useful behaviour, so we
should have a 'flags' argument here as well
> + if (status < 0) {
> + gvir_set_error_literal(error, GVIR_DOMAIN_SNAPSHOT_ERROR, 0,
> + "Unable to delete snapshot");
I'd include the name of the snapshot in the error message.
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140530/7abe1e2a/attachment-0001.sig>
More information about the libvir-list
mailing list