[libvirt] [libvirt-glib] [PATCH 0/4] Add more snapshot API

From: Timm Bäder <mail@baedert.org> The following 4 patches add some more snapshot API to libvirt-glib. I wasn't sure where to put _revert_to really, the libvirt API sounds like it belongs into GVirDomain (i.e. gvir_domain_revert_to_snapshot), but virDomainRevertToSnapshot only takes a pointer to the snapshot. The implementation of gvir_domain_snapshot_set_config does not allow renaming of the snapshot as that will just create a new snapshot in any case (should that by documented?). But it looks like the same is true for gvir_domain_set_config? Timm Bäder (4): GVirDomainSnapshot: Add _is_current GVirDomainSnapshot: Add _revert_to GVirDomainSnapshot: Add _set_config GVirDomain: Add _has_current_snapshot libvirt-gobject/libvirt-gobject-domain-snapshot.c | 120 ++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain-snapshot.h | 26 +++++ libvirt-gobject/libvirt-gobject-domain.c | 30 ++++++ libvirt-gobject/libvirt-gobject-domain.h | 3 + libvirt-gobject/libvirt-gobject.sym | 4 + 5 files changed, 183 insertions(+) -- 2.0.3

From: Timm Bäder <mail@baedert.org> Add a way to determine if the given GVirDomainSnapshot is the current snapshot of its GVirDomain. --- libvirt-gobject/libvirt-gobject-domain-snapshot.c | 29 +++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain-snapshot.h | 3 +++ libvirt-gobject/libvirt-gobject.sym | 1 + 3 files changed, 33 insertions(+) diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c index 7bb89f1..69b6e5a 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c @@ -235,3 +235,32 @@ gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot, } return TRUE; } + + +/** + * gvir_domain_snapshot_is_current: + * @snapshot: The domain snapshot + * @flags: Currently unused, pass 0 + * @error: (allow-none): Place-holder for error or NULL + * + * Returns: TRUE if the given snapshot is the current snapshot + * of its domain or FALSE if it is not or an error occurs. + */ +gboolean gvir_domain_snapshot_is_current(GVirDomainSnapshot *snapshot, + guint flags, + 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; + } + + return status; +} diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.h b/libvirt-gobject/libvirt-gobject-domain-snapshot.h index b3ebe7f..bf697b3 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.h +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.h @@ -85,6 +85,9 @@ gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot, guint flags, GError **error); +gboolean gvir_domain_snapshot_is_current(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 6aa8b86..641c4da 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_list_flags_get_type; + gvir_domain_snapshot_is_current; } LIBVIRT_GOBJECT_0.1.5; # .... define new API here using predicted next version number .... -- 2.0.3

Hey, On Sat, Aug 02, 2014 at 10:41:46AM +0200, mail@baedert.org wrote:
From: Timm Bäder <mail@baedert.org>
Add a way to determine if the given GVirDomainSnapshot is the current snapshot of its GVirDomain. --- libvirt-gobject/libvirt-gobject-domain-snapshot.c | 29 +++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain-snapshot.h | 3 +++ libvirt-gobject/libvirt-gobject.sym | 1 + 3 files changed, 33 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c index 7bb89f1..69b6e5a 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c @@ -235,3 +235,32 @@ gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot, } return TRUE; } + + +/** + * gvir_domain_snapshot_is_current: + * @snapshot: The domain snapshot + * @flags: Currently unused, pass 0 + * @error: (allow-none): Place-holder for error or NULL + * + * Returns: TRUE if the given snapshot is the current snapshot + * of its domain or FALSE if it is not or an error occurs.
Sticking a tri-state value (current, non-current, error) in a boolean does not seem so good. We could go with an enum instead, but this will be less convenient to use. So I'm not really sure which way to go :(
+ */ +gboolean gvir_domain_snapshot_is_current(GVirDomainSnapshot *snapshot, + guint flags, + 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; + } + + return status; +} diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.h b/libvirt-gobject/libvirt-gobject-domain-snapshot.h index b3ebe7f..bf697b3 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.h +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.h @@ -85,6 +85,9 @@ gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot, guint flags, GError **error);
+gboolean gvir_domain_snapshot_is_current(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 6aa8b86..641c4da 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_list_flags_get_type; + gvir_domain_snapshot_is_current;
This needs to come in alphabetical order or make syntax-check will fail. Looks good otherwise. Christophe

On Tue, Aug 5, 2014 at 11:13 AM, Christophe Fergeau <cfergeau@redhat.com> wrote:
Hey,
On Sat, Aug 02, 2014 at 10:41:46AM +0200, mail@baedert.org wrote:
From: Timm Bäder <mail@baedert.org>
Add a way to determine if the given GVirDomainSnapshot is the current snapshot of its GVirDomain. --- libvirt-gobject/libvirt-gobject-domain-snapshot.c | 29 +++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain-snapshot.h | 3 +++ libvirt-gobject/libvirt-gobject.sym | 1 + 3 files changed, 33 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c index 7bb89f1..69b6e5a 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c @@ -235,3 +235,32 @@ gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot, } return TRUE; } + + +/** + * gvir_domain_snapshot_is_current:
Although Christophe doesn't like it but the convention is to always have '_get_" in getter names (and "_set_" in setter) even for booleans ones like this one. Vala assumes this convention to automatically translate property access to getter in generated code, which will be useful when we add properties for these (which IMHO we should). -- Regards, Zeeshan Ali (Khattak) ________________________________________ Befriend GNOME: http://www.gnome.org/friends/

From: Timm Bäder <mail@baedert.org> Add a way to revert a domain to one of its snapshots. --- libvirt-gobject/libvirt-gobject-domain-snapshot.c | 33 +++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain-snapshot.h | 18 +++++++++++++ libvirt-gobject/libvirt-gobject.sym | 1 + 3 files changed, 52 insertions(+) diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c index 69b6e5a..497288f 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c @@ -264,3 +264,36 @@ gboolean gvir_domain_snapshot_is_current(GVirDomainSnapshot *snapshot, return status; } + + + +/** + * gvir_domain_snapshot_revert_to: + * @snapshot: The domain snapshot + * @flags: Bitwise OR of GVirDomainSnapshotRevertFlags + * @error: (allow-none): Place-holder for error or NULL + * + * Returns: TRUE if the snapshot's domain has successfully been + * reverted to the given snapshot, FALSE otherwise, in which case + * @error will be set. + */ +gboolean gvir_domain_snapshot_revert_to(GVirDomainSnapshot *snapshot, + guint flags, + GError **error) { + int status; + + g_return_val_if_fail(GVIR_IS_DOMAIN_SNAPSHOT(snapshot), FALSE); + g_return_val_if_fail((error == NULL) || (*error == NULL), FALSE); + + + status = virDomainRevertToSnapshot(snapshot->priv->handle, + flags); + if (status != 0) { + gvir_set_error(error, GVIR_DOMAIN_SNAPSHOT_ERROR, + 0, "Failed to revert to 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 bf697b3..2db0a38 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.h +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.h @@ -71,6 +71,19 @@ typedef enum { } GVirDomainSnapshotDeleteFlags; +/** + * GVirDomainSnapshotRevertFlags: + * @GVIR_DOMAIN_SNAPSHOT_REVERT_RUNNING: Run after revert + * @GVIR_DOMAIN_SNAPSHOT_REVERT_PAUSED: Pause after revert + * @GVIR_DOMAIN_SNAPSHOT_REVERT_FORCE: Allow risky reverts + */ +typedef enum { + GVIR_DOMAIN_SNAPSHOT_REVERT_RUNNING = 1, + GVIR_DOMAIN_SNAPSHOT_REVERT_PAUSED = 2, + GVIR_DOMAIN_SNAPSHOT_REVERT_FORCE = 4 +} GVirDomainSnapshotRevertFlags; + + GType gvir_domain_snapshot_get_type(void); GType gvir_domain_snapshot_handle_get_type(void); @@ -88,6 +101,11 @@ gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot, gboolean gvir_domain_snapshot_is_current(GVirDomainSnapshot *snapshot, guint flags, GError **error); + + +gboolean gvir_domain_snapshot_revert_to(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 641c4da..0ffbb3f 100644 --- a/libvirt-gobject/libvirt-gobject.sym +++ b/libvirt-gobject/libvirt-gobject.sym @@ -243,6 +243,7 @@ LIBVIRT_GOBJECT_0.1.9 { gvir_domain_snapshot_delete; gvir_domain_snapshot_list_flags_get_type; gvir_domain_snapshot_is_current; + gvir_domain_snapshot_revert_to; } LIBVIRT_GOBJECT_0.1.5; # .... define new API here using predicted next version number .... -- 2.0.3

ACK. On Sat, Aug 02, 2014 at 10:41:47AM +0200, mail@baedert.org wrote:
From: Timm Bäder <mail@baedert.org>
Add a way to revert a domain to one of its snapshots. --- libvirt-gobject/libvirt-gobject-domain-snapshot.c | 33 +++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain-snapshot.h | 18 +++++++++++++ libvirt-gobject/libvirt-gobject.sym | 1 + 3 files changed, 52 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c index 69b6e5a..497288f 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c @@ -264,3 +264,36 @@ gboolean gvir_domain_snapshot_is_current(GVirDomainSnapshot *snapshot,
return status; } + + + +/** + * gvir_domain_snapshot_revert_to: + * @snapshot: The domain snapshot + * @flags: Bitwise OR of GVirDomainSnapshotRevertFlags + * @error: (allow-none): Place-holder for error or NULL + * + * Returns: TRUE if the snapshot's domain has successfully been + * reverted to the given snapshot, FALSE otherwise, in which case + * @error will be set. + */ +gboolean gvir_domain_snapshot_revert_to(GVirDomainSnapshot *snapshot, + guint flags, + GError **error) { + int status; + + g_return_val_if_fail(GVIR_IS_DOMAIN_SNAPSHOT(snapshot), FALSE); + g_return_val_if_fail((error == NULL) || (*error == NULL), FALSE); + + + status = virDomainRevertToSnapshot(snapshot->priv->handle, + flags); + if (status != 0) { + gvir_set_error(error, GVIR_DOMAIN_SNAPSHOT_ERROR, + 0, "Failed to revert to 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 bf697b3..2db0a38 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.h +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.h @@ -71,6 +71,19 @@ typedef enum { } GVirDomainSnapshotDeleteFlags;
+/** + * GVirDomainSnapshotRevertFlags: + * @GVIR_DOMAIN_SNAPSHOT_REVERT_RUNNING: Run after revert + * @GVIR_DOMAIN_SNAPSHOT_REVERT_PAUSED: Pause after revert + * @GVIR_DOMAIN_SNAPSHOT_REVERT_FORCE: Allow risky reverts + */ +typedef enum { + GVIR_DOMAIN_SNAPSHOT_REVERT_RUNNING = 1, + GVIR_DOMAIN_SNAPSHOT_REVERT_PAUSED = 2, + GVIR_DOMAIN_SNAPSHOT_REVERT_FORCE = 4 +} GVirDomainSnapshotRevertFlags; + + GType gvir_domain_snapshot_get_type(void); GType gvir_domain_snapshot_handle_get_type(void);
@@ -88,6 +101,11 @@ gboolean gvir_domain_snapshot_delete (GVirDomainSnapshot *snapshot, gboolean gvir_domain_snapshot_is_current(GVirDomainSnapshot *snapshot, guint flags, GError **error); + + +gboolean gvir_domain_snapshot_revert_to(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 641c4da..0ffbb3f 100644 --- a/libvirt-gobject/libvirt-gobject.sym +++ b/libvirt-gobject/libvirt-gobject.sym @@ -243,6 +243,7 @@ LIBVIRT_GOBJECT_0.1.9 { gvir_domain_snapshot_delete; gvir_domain_snapshot_list_flags_get_type; gvir_domain_snapshot_is_current; + gvir_domain_snapshot_revert_to; } LIBVIRT_GOBJECT_0.1.5;
# .... define new API here using predicted next version number .... -- 2.0.3
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Add a way to revert a domain to one of its snapshots. --- libvirt-gobject/libvirt-gobject-domain-snapshot.c | 35 +++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain-snapshot.h | 18 ++++++++++++ libvirt-gobject/libvirt-gobject.sym | 2 ++ 3 files changed, 55 insertions(+) diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c index c53e877..56c9ddb 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c @@ -268,3 +268,38 @@ gboolean gvir_domain_snapshot_get_is_current(GVirDomainSnapshot *snapshot, return TRUE; } + + + +/** + * gvir_domain_snapshot_revert_to: + * @snapshot: The domain snapshot + * @flags: Bitwise OR of GVirDomainSnapshotRevertFlags + * @cancellable: (allow-none) (transfer none): cancellation object + * @error: (allow-none): Place-holder for error or %NULL + * + * Returns: %TRUE if the snapshot's domain has successfully been + * reverted to the given snapshot, %FALSE otherwise, in which case + * @error will be set. + */ +gboolean gvir_domain_snapshot_revert_to(GVirDomainSnapshot *snapshot, + guint flags, + GCancellable *cancellable, + GError **error) { + int status; + + g_return_val_if_fail(GVIR_IS_DOMAIN_SNAPSHOT(snapshot), FALSE); + g_return_val_if_fail((error == NULL) || (*error == NULL), FALSE); + + + status = virDomainRevertToSnapshot(snapshot->priv->handle, + flags); + if (status != 0) { + gvir_set_error(error, GVIR_DOMAIN_SNAPSHOT_ERROR, + 0, "Failed to revert to 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 0a0bb96..c67b345 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.h +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.h @@ -71,6 +71,19 @@ typedef enum { } GVirDomainSnapshotDeleteFlags; +/** + * GVirDomainSnapshotRevertFlags: + * @GVIR_DOMAIN_SNAPSHOT_REVERT_RUNNING: Run after revert + * @GVIR_DOMAIN_SNAPSHOT_REVERT_PAUSED: Pause after revert + * @GVIR_DOMAIN_SNAPSHOT_REVERT_FORCE: Allow risky reverts + */ +typedef enum { + GVIR_DOMAIN_SNAPSHOT_REVERT_RUNNING = 1, + GVIR_DOMAIN_SNAPSHOT_REVERT_PAUSED = 2, + GVIR_DOMAIN_SNAPSHOT_REVERT_FORCE = 4 +} GVirDomainSnapshotRevertFlags; + + GType gvir_domain_snapshot_get_type(void); GType gvir_domain_snapshot_handle_get_type(void); @@ -89,6 +102,11 @@ gboolean gvir_domain_snapshot_get_is_current(GVirDomainSnapshot *snapshot, guint flags, gboolean *is_current, GError **error); + +gboolean gvir_domain_snapshot_revert_to(GVirDomainSnapshot *snapshot, + guint flags, + GCancellable *cancellable, + 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 c740f88..c1c9421 100644 --- a/libvirt-gobject/libvirt-gobject.sym +++ b/libvirt-gobject/libvirt-gobject.sym @@ -244,6 +244,8 @@ LIBVIRT_GOBJECT_0.1.9 { gvir_domain_snapshot_delete_flags_get_type; gvir_domain_snapshot_get_is_current; gvir_domain_snapshot_list_flags_get_type; + gvir_domain_snapshot_revert_flags_get_type; + gvir_domain_snapshot_revert_to; gvir_storage_pool_state_get_type; gvir_storage_vol_resize_flags_get_type; gvir_storage_vol_type_get_type; -- 2.0.4

From: Timm Bäder <mail@baedert.org> ... which is basically analogous to gvir_domain_set_config --- libvirt-gobject/libvirt-gobject-domain-snapshot.c | 58 +++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain-snapshot.h | 5 ++ libvirt-gobject/libvirt-gobject.sym | 1 + 3 files changed, 64 insertions(+) diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c index 497288f..2c81882 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c @@ -297,3 +297,61 @@ 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; + } + + + xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf)); + + handle = virDomainSnapshotCreateXML(domain, + xml, + VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE); + 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 2db0a38..1af65bb 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_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 0ffbb3f..4ca4175 100644 --- a/libvirt-gobject/libvirt-gobject.sym +++ b/libvirt-gobject/libvirt-gobject.sym @@ -244,6 +244,7 @@ LIBVIRT_GOBJECT_0.1.9 { gvir_domain_snapshot_list_flags_get_type; gvir_domain_snapshot_is_current; gvir_domain_snapshot_revert_to; + gvir_domain_snapshot_set_config; } LIBVIRT_GOBJECT_0.1.5; # .... define new API here using predicted next version number .... -- 2.0.3

On Sat, Aug 02, 2014 at 10:41:48AM +0200, mail@baedert.org wrote:
From: Timm Bäder <mail@baedert.org>
... which is basically analogous to gvir_domain_set_config --- libvirt-gobject/libvirt-gobject-domain-snapshot.c | 58 +++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain-snapshot.h | 5 ++ libvirt-gobject/libvirt-gobject.sym | 1 + 3 files changed, 64 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c index 497288f..2c81882 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c @@ -297,3 +297,61 @@ 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; + } + + + xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf)); + + handle = virDomainSnapshotCreateXML(domain, + xml, + VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE); + free(xml);
g_free here.
+ + if (handle == NULL) { + gvir_set_error(error, GVIR_DOMAIN_SNAPSHOT_ERROR, + 0, + "Failed to create Snapshot `%s' from XML definition",
"snapshot" could have a lower case here. I'm not exactly clear on what this method will be doing according to your 0/4. If it creates a new snapshot rather than modifying an existing one, maybe the name should be different/this should not be wrapped? Christophe

On 05.08, Christophe Fergeau wrote:
On Sat, Aug 02, 2014 at 10:41:48AM +0200, mail@baedert.org wrote:
From: Timm Bäder <mail@baedert.org>
... which is basically analogous to gvir_domain_set_config --- libvirt-gobject/libvirt-gobject-domain-snapshot.c | 58 +++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain-snapshot.h | 5 ++ libvirt-gobject/libvirt-gobject.sym | 1 + 3 files changed, 64 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c index 497288f..2c81882 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c @@ -297,3 +297,61 @@ 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; + } + + + xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf)); + + handle = virDomainSnapshotCreateXML(domain, + xml, + VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE); + free(xml);
g_free here.
+ + if (handle == NULL) { + gvir_set_error(error, GVIR_DOMAIN_SNAPSHOT_ERROR, + 0, + "Failed to create Snapshot `%s' from XML definition",
"snapshot" could have a lower case here.
I'm not exactly clear on what this method will be doing according to your 0/4. If it creates a new snapshot rather than modifying an existing one, maybe the name should be different/this should not be wrapped?
Christophe
Also in reply to the 0/4: It will modify the existing one, as long as you don't change the name. Like if you use get_config, then set_description on that config and then _set_config again, no additional snapshot will be created. If you change only the snapshot's name and then use set_config on it, it'll create a new snapshot that is equivalent to the snapshot you wanted to modify except for the name (and to really "modify" the old snapshot, you now have to delete the old one, which is one reason why we show the description to the user instead of the name in gnome-boxes). I had a conversation with eblake on IRC about this and it seemed like this is the wanted behavior (or at least it's a well-known limitation?). So I guess the name is still correct, but maybe the docs should mention that renaming won't work as expected? Regards, Timm

Hey, Thanks for the detailed explanation! On Tue, Aug 05, 2014 at 03:52:17PM +0200, Timm Bäder wrote:
Also in reply to the 0/4: It will modify the existing one, as long as you don't change the name. Like if you use get_config, then set_description on that config and then _set_config again, no additional snapshot will be created. If you change only the snapshot's name and then use set_config on it, it'll create a new snapshot that is equivalent to the snapshot you wanted to modify except for the name (and to really "modify" the old snapshot, you now have to delete the old one, which is one reason why we show the description to the user instead of the name in gnome-boxes). I had a conversation with eblake on IRC about this and it seemed like this is the wanted behavior (or at least it's a well-known limitation?).
So I guess the name is still correct, but maybe the docs should mention that renaming won't work as expected?
Hmm at this point I'd error out if the name is different. If people complain about this, or if this is too limiting, then we can reconsider with clear use cases to decide how this should behave. How does that sound? Christophe

Thanks for your response. I just wanted to know is there any way to fix this issue. Please provide me with the command that will help me to create "Clone" of VM running on ESXi also if possible also share the way to create "Template" of the VM running on ESXi. It would be easier if we could manager ESXi from "Virtual Machine Manager". -----Original Message----- From: libvir-list-bounces@redhat.com [mailto:libvir-list-bounces@redhat.com] On Behalf Of Christophe Fergeau Sent: 06 August 2014 15:05 To: libvir-list@redhat.com Subject: Re: [libvirt] [libvirt-glib] [PATCH 3/4] GVirDomainSnapshot: Add _set_config Hey, Thanks for the detailed explanation! On Tue, Aug 05, 2014 at 03:52:17PM +0200, Timm Bäder wrote:
Also in reply to the 0/4: It will modify the existing one, as long as you don't change the name. Like if you use get_config, then set_description on that config and then _set_config again, no additional snapshot will be created. If you change only the snapshot's name and then use set_config on it, it'll create a new snapshot that is equivalent to the snapshot you wanted to modify except for the name (and to really "modify" the old snapshot, you now have to delete the old one, which is one reason why we show the description to the user instead of the name in gnome-boxes). I had a conversation with eblake on IRC about this and it seemed like this is the wanted behavior (or at least it's a well-known limitation?).
So I guess the name is still correct, but maybe the docs should mention that renaming won't work as expected?
Hmm at this point I'd error out if the name is different. If people complain about this, or if this is too limiting, then we can reconsider with clear use cases to decide how this should behave. How does that sound? Christophe DISCLAIMER: ----------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or NEC or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of NEC or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. . -----------------------------------------------------------------------------------------------------------------------

Hey Himanshu, On Wed, Aug 06, 2014 at 09:44:20AM +0000, Himanshu Sharma wrote:
Thanks for your response. I just wanted to know is there any way to fix this issue. Please provide me with the command that will help me to create "Clone" of VM running on ESXi also if possible also share the way to create "Template" of the VM running on ESXi. It would be easier if we could manager ESXi from "Virtual Machine Manager".
This ESXi question/problem does not seem to be related to the patch being discussed, maybe you answered to the wrong thread? Christophe

On 06.08, Christophe Fergeau wrote:
Hey,
Thanks for the detailed explanation!
On Tue, Aug 05, 2014 at 03:52:17PM +0200, Timm Bäder wrote:
Also in reply to the 0/4: It will modify the existing one, as long as you don't change the name. Like if you use get_config, then set_description on that config and then _set_config again, no additional snapshot will be created. If you change only the snapshot's name and then use set_config on it, it'll create a new snapshot that is equivalent to the snapshot you wanted to modify except for the name (and to really "modify" the old snapshot, you now have to delete the old one, which is one reason why we show the description to the user instead of the name in gnome-boxes). I had a conversation with eblake on IRC about this and it seemed like this is the wanted behavior (or at least it's a well-known limitation?).
So I guess the name is still correct, but maybe the docs should mention that renaming won't work as expected?
Hmm at this point I'd error out if the name is different. If people complain about this, or if this is too limiting, then we can reconsider with clear use cases to decide how this should behave. How does that sound?
Christophe
That sounds good to me, thanks.

You have any idea how I can clone VM of ESXi from libvirt? -----Original Message----- From: libvir-list-bounces@redhat.com [mailto:libvir-list-bounces@redhat.com] On Behalf Of Christophe Fergeau Sent: 05 August 2014 18:26 To: mail@baedert.org Cc: libvir-list@redhat.com Subject: Re: [libvirt] [libvirt-glib] [PATCH 3/4] GVirDomainSnapshot: Add _set_config On Sat, Aug 02, 2014 at 10:41:48AM +0200, mail@baedert.org wrote:
From: Timm Bäder <mail@baedert.org>
... which is basically analogous to gvir_domain_set_config --- libvirt-gobject/libvirt-gobject-domain-snapshot.c | 58 +++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain-snapshot.h | 5 ++ libvirt-gobject/libvirt-gobject.sym | 1 + 3 files changed, 64 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c index 497288f..2c81882 100644 --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c @@ -297,3 +297,61 @@ 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; + } + + + xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf)); + + handle = virDomainSnapshotCreateXML(domain, + xml, + VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE); + free(xml);
g_free here.
+ + if (handle == NULL) { + gvir_set_error(error, GVIR_DOMAIN_SNAPSHOT_ERROR, + 0, + "Failed to create Snapshot `%s' from XML + definition",
"snapshot" could have a lower case here. I'm not exactly clear on what this method will be doing according to your 0/4. If it creates a new snapshot rather than modifying an existing one, maybe the name should be different/this should not be wrapped? Christophe DISCLAIMER: ----------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or NEC or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of NEC or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. . -----------------------------------------------------------------------------------------------------------------------

On Thu, Aug 7, 2014 at 12:03 PM, Himanshu Sharma <himanshu.sharma@nectechnologies.in> wrote:
You have any idea how I can clone VM of ESXi from libvirt?
Can you please ask in a separate thread (an new email with an appropriate subject line) you exact questions on this list? There are good chances at least some people can answer your questions. Thank you. http://en.wikipedia.org/wiki/Conversation_threading -- Regards, Zeeshan Ali (Khattak) ________________________________________ Befriend GNOME: http://www.gnome.org/friends/

From: Timm Bäder <mail@baedert.org> ... 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. + */ +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", + 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; gvir_domain_snapshot_delete; gvir_domain_snapshot_list_flags_get_type; gvir_domain_snapshot_is_current; -- 2.0.3

On Sat, Aug 02, 2014 at 10:41:49AM +0200, mail@baedert.org wrote:
From: Timm Bäder <mail@baedert.org>
... 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

Hey, On Sat, Aug 02, 2014 at 10:41:45AM +0200, mail@baedert.org wrote:
From: Timm Bäder <mail@baedert.org>
The following 4 patches add some more snapshot API to libvirt-glib.
I wasn't sure where to put _revert_to really, the libvirt API sounds like it belongs into GVirDomain (i.e. gvir_domain_revert_to_snapshot), but virDomainRevertToSnapshot only takes a pointer to the snapshot.
Snapshot XML which you get from libvirt contains a "domain" node with the full domain configuration at the time the snapshot was created, and I think the current domain configuration will be reverted to the configuration stored in the snapshot when we revert to it. I think it's ok to have this under GVirDomainSnapshot. If we put that in GVirDomain, we'd have to make sure the snapshot we are trying to revert to corresponds to the domain we are acting on. Christophe

On Sat, Aug 02, 2014 at 10:41:45AM +0200, mail@baedert.org wrote:
From: Timm Bäder <mail@baedert.org> The implementation of gvir_domain_snapshot_set_config does not allow renaming of the snapshot as that will just create a new snapshot in any case (should that by documented?). But it looks like the same is true for gvir_domain_set_config?
gvir_domain_set_config is a bit different to the snapshot stuff as it uses virDomainDefineXML rather than virDomainCreateXML. I'd expect that as long as the domain UUID is not modified, this will modify an existing domain. Regarding the use of virDomainSnapshotCreateXML, isn't this going to do the right thing as you specified the VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE? (I'm a bit confused by the API doc ;) Christophe
participants (5)
-
Christophe Fergeau
-
Himanshu Sharma
-
mail@baedert.org
-
Timm Bäder
-
Zeeshan Ali (Khattak)