--- libvirt-gobject/libvirt-gobject-domain.c | 39 ++++++++++++++++++++++++++++++ libvirt-gobject/libvirt-gobject-domain.h | 4 +++ 2 files changed, 43 insertions(+) diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c index eda2427..ea621ff 100644 --- a/libvirt-gobject/libvirt-gobject-domain.c +++ b/libvirt-gobject/libvirt-gobject-domain.c @@ -1270,3 +1270,42 @@ GList *gvir_domain_get_devices(GVirDomain *domain, return g_list_reverse (ret); } + +/** + * gvir_domain_snapshot_create_xml: + * @dom: the domain + * @conf: configuration of domain + * @flags: the flags + * @err: (allow-none):Place-holder for error or NULL + * + * Returns: snapshot of existing domain + */ +GVirConfigDomainSnapshot *gvir_domain_snapshot_create_xml(GVirDomain *dom, + GVirConfigDomain *conf, + guint flags, + GError **err) +{ + GVirDomainPrivate *priv; + virDomainSnapshot *snapshot; + gchar *xml_desc; + + g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE); + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN (conf), FALSE); + g_return_val_if_fail(err == NULL || *err == NULL, NULL); + + priv = dom->priv; + xml_desc = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf)); + + if(!(snapshot = virDomainSnapshotCreateXML(priv->handle, xml_desc, flags))) { + gvir_set_error_literal(err, GVIR_DOMAIN_ERROR, + 0, + "Unable to create snapshot of domain"); + return NULL; + + } + + GVirConfigDomainSnapshot *conf_snapshot = gvir_config_domain_snapshot_new_from_xml(xml_desc, err); + + g_free(xml_desc); + return conf_snapshot; +} diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h index 49516a7..6540f64 100644 --- a/libvirt-gobject/libvirt-gobject-domain.h +++ b/libvirt-gobject/libvirt-gobject-domain.h @@ -220,6 +220,10 @@ gboolean gvir_domain_get_saved(GVirDomain *dom); GList *gvir_domain_get_devices(GVirDomain *domain, GError **err); +GVirConfigDomainSnapshot *gvir_domain_snapshot_create_xml(GVirDomain *dom, + GVirConfigDomain *conf, + guint flags, + GError **err); G_END_DECLS #endif /* __LIBVIRT_GOBJECT_DOMAIN_H__ */ -- 1.7.10.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list