On Sat, Aug 02, 2014 at 10:41:49AM +0200, mail@xxxxxxxxxxx wrote: > From: Timm Bäder <mail@xxxxxxxxxxx> > > ... which uses virDomainHasCurrentSnapshot to determine if the given > domain has a current snapshot or not. > --- > libvirt-gobject/libvirt-gobject-domain.c | 30 ++++++++++++++++++++++++++++++ > libvirt-gobject/libvirt-gobject-domain.h | 3 +++ > libvirt-gobject/libvirt-gobject.sym | 1 + > 3 files changed, 34 insertions(+) > > diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c > index 6aeb4fc..5689154 100644 > --- a/libvirt-gobject/libvirt-gobject-domain.c > +++ b/libvirt-gobject/libvirt-gobject-domain.c > @@ -1686,3 +1686,33 @@ gboolean gvir_domain_fetch_snapshots_finish(GVirDomain *dom, > > return g_task_propagate_boolean(G_TASK(res), error); > } > + > + > +/** > + * gvir_domain_has_current_snapshot: > + * @dom: a #GVirDomain > + * @flags: Unused, pass 0 > + * @error: (allow-none): Place-holder for error or NULL > + * > + * Returns: TRUE if the domain has a current snapshot, FALSE if not > + * and if an error occurred, in which case @error will be set. > + */ Same concern as in 1/4 about this tri-state return value. > +gboolean gvir_domain_has_current_snapshot(GVirDomain *dom, > + guint flags, > + GError **error) { > + int status; > + g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE); > + g_return_val_if_fail(error == NULL || *error == NULL, FALSE); > + > + status = virDomainHasCurrentSnapshot(dom->priv->handle, > + flags); > + > + if (status == -1) { > + gvir_set_error(error, GVIR_DOMAIN_ERROR, 0, > + "Unable if domain `%s' has a current snapshot", "Unable to check if ..." ? > + gvir_domain_get_name(dom)); > + return FALSE; > + } > + > + return status; > +} > diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h > index 9846375..e6e21fd 100644 > --- a/libvirt-gobject/libvirt-gobject-domain.h > +++ b/libvirt-gobject/libvirt-gobject-domain.h > @@ -380,6 +380,9 @@ gboolean gvir_domain_fetch_snapshots_finish(GVirDomain *dom, > GAsyncResult *res, > GError **error); > > +gboolean gvir_domain_has_current_snapshot(GVirDomain *dom, > + guint flags, > + GError **error); > > G_END_DECLS > > diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym > index 4ca4175..7bf6282 100644 > --- a/libvirt-gobject/libvirt-gobject.sym > +++ b/libvirt-gobject/libvirt-gobject.sym > @@ -240,6 +240,7 @@ LIBVIRT_GOBJECT_0.1.9 { > gvir_domain_fetch_snapshots_async; > gvir_domain_fetch_snapshots_finish; > gvir_domain_get_snapshots; > + gvir_domain_has_current_snapshot; This file is indented with tabs, but the line you added has spaces. Christophe
Attachment:
pgp7hgvi6K7R4.pgp
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list