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

Re: [libvirt] [libvirt-glib] [PATCH v2 1/4] GVirDomainSnapshot: Add _get_is_current



Series looks good to me apart from that naming comment in 4/4.
If someone does not like the use of gboolean *is_current as a return
value in
gboolean gvir_domain_snapshot_get_is_current(GVirDomainSnapshot *snapshot,
                                             guint flags,
                                             gboolean *is_current,
                                             GError **error) {

now would be a good time to complain ;)

Christophe

On Thu, Aug 07, 2014 at 12:20:13PM +0200, Timm Bäder wrote:
> Add a way to determine if the given GVirDomainSnapshot is the current
> snapshot of its GVirDomain.
> ---
>  libvirt-gobject/libvirt-gobject-domain-snapshot.c | 33 +++++++++++++++++++++++
>  libvirt-gobject/libvirt-gobject-domain-snapshot.h |  4 +++
>  libvirt-gobject/libvirt-gobject.sym               |  1 +
>  3 files changed, 38 insertions(+)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
> index 7bb89f1..c53e877 100644
> --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
> +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
> @@ -235,3 +235,36 @@ gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot,
>      }
>      return TRUE;
>  }
> +
> +
> +/**
> + * gvir_domain_snapshot_get_is_current:
> + * @snapshot: The domain snapshot
> + * @flags: Currently unused, pass 0
> + * @is_current: (out): %TRUE if the given snapshot is the current snapshot
> + * of its domain, %FALSE otherwise.
> + * @error: (allow-none): Place-holder for error or %NULL
> + *
> + * Returns: %TRUE on success, %FALSE otherwise.
> + */
> +gboolean gvir_domain_snapshot_get_is_current(GVirDomainSnapshot *snapshot,
> +                                             guint flags,
> +                                             gboolean *is_current,
> +                                             GError **error) {
> +    gint status;
> +
> +    g_return_val_if_fail(GVIR_IS_DOMAIN_SNAPSHOT(snapshot), FALSE);
> +    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
> +
> +    status = virDomainSnapshotIsCurrent(snapshot->priv->handle, flags);
> +    if (status == -1) {
> +        gvir_set_error(error, GVIR_DOMAIN_SNAPSHOT_ERROR, 0,
> +                       "Could not determine if `%s' is the current snapshot",
> +                       gvir_domain_snapshot_get_name(snapshot));
> +        return FALSE;
> +    }
> +
> +    *is_current = status;
> +
> +    return TRUE;
> +}
> diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.h b/libvirt-gobject/libvirt-gobject-domain-snapshot.h
> index b3ebe7f..0a0bb96 100644
> --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.h
> +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.h
> @@ -85,6 +85,10 @@ gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot,
>                                        guint flags,
>                                        GError **error);
>  
> +gboolean gvir_domain_snapshot_get_is_current(GVirDomainSnapshot *snapshot,
> +                                             guint flags,
> +                                             gboolean *is_current,
> +                                             GError **error);
>  G_END_DECLS
>  
>  #endif /* __LIBVIRT_GOBJECT_DOMAIN_SNAPSHOT_H__ */
> diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
> index b0c55b5..c740f88 100644
> --- a/libvirt-gobject/libvirt-gobject.sym
> +++ b/libvirt-gobject/libvirt-gobject.sym
> @@ -242,6 +242,7 @@ LIBVIRT_GOBJECT_0.1.9 {
>  	gvir_domain_get_snapshots;
>  	gvir_domain_snapshot_delete;
>  	gvir_domain_snapshot_delete_flags_get_type;
> +	gvir_domain_snapshot_get_is_current;
>  	gvir_domain_snapshot_list_flags_get_type;
>  	gvir_storage_pool_state_get_type;
>  	gvir_storage_vol_resize_flags_get_type;
> -- 
> 2.0.4
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgp3fsDk5X0FG.pgp
Description: PGP signature


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