... which is basically analogous to gvir_domain_set_config
---
libvirt-gobject/libvirt-gobject-domain-snapshot.c | 68 +++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain-snapshot.h | 5 ++
libvirt-gobject/libvirt-gobject.sym | 1 +
3 files changed, 74 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
index dca1086..62efce0 100644
--- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
+++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
@@ -301,3 +301,71 @@ gboolean gvir_domain_snapshot_revert_to(GVirDomainSnapshot
*snapshot,
return TRUE;
}
+
+
+
+/**
+ * gvir_domain_snapshot_set_config:
+ * @snapshot: The domain snapshot
+ * @conf: The new config object
+ * @error: (allow-none): Place-holder for error or %NULL
+ *
+ * Updates the given snapshot's configuration according to the
+ * given GVirConfigDomainSnapshot.
+ *
+ * Returns: %TRUE if no error was reported, %FALSE otherwise.
+ */
+gboolean gvir_domain_snapshot_set_config(GVirDomainSnapshot *snapshot,
+ GVirConfigDomainSnapshot *conf,
+ GError **error)
+{
+ gchar *xml;
+ virConnectPtr conn;
+ virDomainSnapshotPtr handle;
+ virDomainPtr domain;
+ GVirDomainSnapshotPrivate *priv;
+
+ g_return_val_if_fail(GVIR_IS_DOMAIN_SNAPSHOT(snapshot), FALSE);
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_SNAPSHOT(conf), FALSE);
+ g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
+
+ priv = snapshot->priv;
+ handle = priv->handle;
+ domain = virDomainSnapshotGetDomain(handle);
+
+
+ if ((conn = virDomainSnapshotGetConnect(priv->handle)) == NULL) {
+ gvir_set_error_literal(error, GVIR_DOMAIN_SNAPSHOT_ERROR,
+ 0,
+ "Failed to get domain connection");
+ return FALSE;
+ }
+
+
+ /* XXX Changing the name will create a new snapshot */
+ if (g_strcmp0 (gvir_domain_snapshot_get_name(snapshot),
+ gvir_config_domain_snapshot_get_name(conf)) != 0) {
+ gvir_set_error_literal(error, GVIR_DOMAIN_SNAPSHOT_ERROR,
+ 0,
+ "Cannot set config: snapshot names don't
match");
+ return FALSE;
+ }
+
+
+ xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
+
+ handle = virDomainSnapshotCreateXML(domain,
+ xml,
+ VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE);
+ g_free(xml);
+
+ if (handle == NULL) {
+ gvir_set_error(error, GVIR_DOMAIN_SNAPSHOT_ERROR,
+ 0,
+ "Failed to create snapshot `%s' from XML
definition",
+ gvir_domain_snapshot_get_name(snapshot));
+ return FALSE;
+ }
+ virDomainSnapshotFree(handle);
+ return TRUE;
+}
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.h
b/libvirt-gobject/libvirt-gobject-domain-snapshot.h
index 7abe8ca..5ab3025 100644
--- a/libvirt-gobject/libvirt-gobject-domain-snapshot.h
+++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.h
@@ -106,6 +106,11 @@ gboolean gvir_domain_snapshot_get_is_current(GVirDomainSnapshot
*snapshot,
gboolean gvir_domain_snapshot_revert_to(GVirDomainSnapshot *snapshot,
guint flags,
GError **error);
+
+gboolean gvir_domain_snapshot_set_config(GVirDomainSnapshot *snapshot,
+ GVirConfigDomainSnapshot *conf,
+ 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 c1c9421..bd12239 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -246,6 +246,7 @@ LIBVIRT_GOBJECT_0.1.9 {
gvir_domain_snapshot_list_flags_get_type;
gvir_domain_snapshot_revert_flags_get_type;
gvir_domain_snapshot_revert_to;
+ gvir_domain_snapshot_set_config;
gvir_storage_pool_state_get_type;
gvir_storage_vol_resize_flags_get_type;
gvir_storage_vol_type_get_type;
--
2.0.4