---
libvirt-gobject/libvirt-gobject-domain-snapshot.c | 29 +++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain-snapshot.h | 16 +++++++++++++
libvirt-gobject/libvirt-gobject.sym | 6 +++++
3 files changed, 51 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
index fcf70ed..f835b58 100644
--- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
+++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
@@ -205,3 +205,32 @@ GVirConfigDomainSnapshot *gvir_domain_snapshot_get_config
free(xml);
return conf;
}
+
+/**
+ * gvir_domain_snapshot_delete:
+ * @snapshot: The domain snapshot
+ * @flags: Bitwise or of #GVirDomainSnapshotDeleteFlags
+ * @error: (allow-none): Place-holder for error or NULL
+ *
+ * Returns: TRUE on success, FALSE otherwise
+ */
+gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot,
+ guint flags,
+ 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, flags);
+ if (status < 0) {
+ gvir_set_error(error, GVIR_DOMAIN_SNAPSHOT_ERROR, 0,
+ "Unable to delete snapshot `%s'",
+ gvir_domain_snapshot_get_name(snapshot));
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.h
b/libvirt-gobject/libvirt-gobject-domain-snapshot.h
index 5bd827c..b3ebe7f 100644
--- a/libvirt-gobject/libvirt-gobject-domain-snapshot.h
+++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.h
@@ -58,6 +58,18 @@ struct _GVirDomainSnapshotClass
gpointer padding[20];
};
+/**
+ * GVirDomainSnapshotDeleteFlags:
+ * @GVIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN: Also delete children
+ * @GVIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY: Delete just metadata
+ * @GVIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY: Delete just children
+ */
+typedef enum {
+ GVIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN = 1,
+ GVIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY = 2,
+ GVIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY = 4
+} GVirDomainSnapshotDeleteFlags;
+
GType gvir_domain_snapshot_get_type(void);
GType gvir_domain_snapshot_handle_get_type(void);
@@ -69,6 +81,10 @@ GVirConfigDomainSnapshot *gvir_domain_snapshot_get_config
guint flags,
GError **err);
+gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot,
+ guint flags,
+ 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 f2419ac..232e63b 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -234,4 +234,10 @@ LIBVIRT_GOBJECT_0.1.5 {
gvir_connection_open_read_only_finish;
} LIBVIRT_GOBJECT_0.1.4;
+LIBVIRT_GOBJECT_0.1.9 {
+ global:
+ gvir_domain_snapshot_delete_flags_get_type;
+ gvir_domain_snapshot_delete;
+} LIBVIRT_GOBJECT_0.1.5;
+
# .... define new API here using predicted next version number ....
--
2.0.0