Re: [libvirt-glib] [PATCHv2 1/2] libvirt-gobject-domain: Add _fetch_snapshots

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

 



On Fri, Jun 27, 2014 at 04:35:06PM +0200, Timm Bäder wrote:
> This function can be used to fetch the snapshots of a domain (according
> to the given GVirDomainSnapshotListFlags) and save them in a
> domain-internal GHashTable. A function to access them from outside will
> be added in a later patch.
> ---
>  libvirt-gobject/libvirt-gobject-domain.c | 61 ++++++++++++++++++++++++++++++++
>  libvirt-gobject/libvirt-gobject-domain.h | 36 +++++++++++++++++++
>  libvirt-gobject/libvirt-gobject.sym      |  2 ++
>  3 files changed, 99 insertions(+)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
> index c6e30e5..a527d4e 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.c
> +++ b/libvirt-gobject/libvirt-gobject-domain.c
> @@ -38,6 +38,7 @@ struct _GVirDomainPrivate
>  {
>      virDomainPtr handle;
>      gchar uuid[VIR_UUID_STRING_BUFLEN];
> +    GHashTable *snapshots;
>  };
>  
>  G_DEFINE_TYPE(GVirDomain, gvir_domain, G_TYPE_OBJECT);
> @@ -121,6 +122,10 @@ static void gvir_domain_finalize(GObject *object)
>  
>      g_debug("Finalize GVirDomain=%p", domain);
>  
> +    if (priv->snapshots) {
> +        g_hash_table_unref (priv->snapshots);
> +    }
> +
>      virDomainFree(priv->handle);
>  
>      G_OBJECT_CLASS(gvir_domain_parent_class)->finalize(object);
> @@ -1514,3 +1519,59 @@ gvir_domain_create_snapshot(GVirDomain *dom,
>      g_free(custom_xml);
>      return dom_snapshot;
>  }
> +
> +
> +
> +/**
> + * gvir_domain_fetch_snapshots:
> + * @dom: The domain
> + * @list_flags: bitwise-OR of #GVirDomainSnapshotListFlags
> + * @error: (allow-none): Place-holder for error or NULL
> + *
> + * Returns: TRUE on success, FALSE otherwise.
> + */
> +gboolean gvir_domain_fetch_snapshots(GVirDomain *dom,
> +                                     guint list_flags,
> +                                     GError **error)
> +{
> +    GVirDomainPrivate *priv;
> +    virDomainSnapshotPtr *snapshots = NULL;
> +    GVirDomainSnapshot *snap;

It looks like the declaration of 'snap' can be moved to the inner for()
block.

ACK with this changed (I'll do it before pushing if you don't have push
access to libvirt.org).

Christophe

Attachment: pgpQVwJzxEYmC.pgp
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]