[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [libvirt-glib 2/3] gconfig: Add GVirConfigDomainSnapshotDisk getters/setters



---
 .../libvirt-gconfig-domain-snapshot-disk.c         | 81 ++++++++++++++++++++++
 .../libvirt-gconfig-domain-snapshot-disk.h         | 16 +++++
 libvirt-gconfig/libvirt-gconfig.sym                |  9 +++
 3 files changed, 106 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c
index a21f0d6..8a346d3 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c
@@ -86,3 +86,84 @@ gvir_config_domain_snapshot_disk_new_from_tree(GVirConfigXmlDoc *doc,
 
     return GVIR_CONFIG_DOMAIN_SNAPSHOT_DISK(object);
 }
+
+
+const char *gvir_config_domain_snapshot_disk_get_name(GVirConfigDomainSnapshotDisk *disk)
+{
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK(disk), NULL);
+
+    return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(disk),
+                                               "name");
+}
+
+
+void gvir_config_domain_snapshot_disk_set_name(GVirConfigDomainSnapshotDisk *disk,
+                                               const char *name)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK(disk));
+
+    gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(disk),
+                                        "name", name);
+}
+
+
+GVirConfigDomainDiskSnapshotType gvir_config_domain_snapshot_disk_get_snapshot_type(GVirConfigDomainSnapshotDisk *disk)
+{
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK(disk),
+                         GVIR_CONFIG_DOMAIN_DISK_SNAPSHOT_NO);
+
+    return gvir_config_object_get_attribute_genum(GVIR_CONFIG_OBJECT(disk),
+                                                  NULL,
+                                                  "snapshot",
+                                                  GVIR_CONFIG_TYPE_DOMAIN_DISK_SNAPSHOT_TYPE,
+                                                  GVIR_CONFIG_DOMAIN_DISK_SNAPSHOT_NO);
+}
+
+
+void gvir_config_domain_snapshot_disk_set_snapshot_type(GVirConfigDomainSnapshotDisk *disk,
+                                                        GVirConfigDomainDiskSnapshotType type)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK(disk));
+
+    gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(disk), "snapshot",
+                                               GVIR_CONFIG_TYPE_DOMAIN_DISK_SNAPSHOT_TYPE,
+                                               type, NULL);
+}
+
+
+const char *gvir_config_domain_snapshot_disk_get_source_file(GVirConfigDomainSnapshotDisk *disk)
+{
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK(disk), NULL);
+
+    return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(disk),
+                                            "source", "file");
+}
+
+
+void gvir_config_domain_snapshot_disk_set_source_file(GVirConfigDomainSnapshotDisk *disk,
+                                                      const char *filename)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK(disk));
+
+    gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(disk),
+                                                "source", "file", filename);
+}
+
+
+const char *gvir_config_domain_snapshot_disk_get_driver_type(GVirConfigDomainSnapshotDisk *disk)
+{
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK(disk), NULL);
+
+    return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(disk),
+                                            "driver", "type");
+}
+
+
+void gvir_config_domain_snapshot_disk_set_driver_type(GVirConfigDomainSnapshotDisk *disk,
+                                                      const char *type)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK(disk));
+
+    gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(disk),
+                                                "driver", "type", type);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h
index 9a73336..288a606 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h
@@ -63,6 +63,22 @@ GVirConfigDomainSnapshotDisk *gvir_config_domain_snapshot_disk_new(void);
 GVirConfigDomainSnapshotDisk *gvir_config_domain_snapshot_disk_new_from_xml(const gchar *xml,
                                                                             GError **error);
 
+const char *gvir_config_domain_snapshot_disk_get_name(GVirConfigDomainSnapshotDisk *disk);
+void gvir_config_domain_snapshot_disk_set_name(GVirConfigDomainSnapshotDisk *disk,
+                                               const char *name);
+
+GVirConfigDomainDiskSnapshotType gvir_config_domain_snapshot_disk_get_snapshot_type(GVirConfigDomainSnapshotDisk *disk);
+void gvir_config_domain_snapshot_disk_set_snapshot_type(GVirConfigDomainSnapshotDisk *disk,
+                                                        GVirConfigDomainDiskSnapshotType type);
+
+const char *gvir_config_domain_snapshot_disk_get_source_file(GVirConfigDomainSnapshotDisk *disk);
+void gvir_config_domain_snapshot_disk_set_source_file(GVirConfigDomainSnapshotDisk *disk,
+                                                      const char *filename);
+
+const char *gvir_config_domain_snapshot_disk_get_driver_type(GVirConfigDomainSnapshotDisk *disk);
+void gvir_config_domain_snapshot_disk_set_driver_type(GVirConfigDomainSnapshotDisk *disk,
+                                                      const char *type);
+
 G_END_DECLS
 
 #endif /* __LIBVIRT_GCONFIG_DOMAIN_SNAPSHOT_DISK_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 9352e34..e8b4efe 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -561,6 +561,15 @@ LIBVIRT_GCONFIG_0.1.7 {
 	gvir_config_domain_snapshot_disk_get_type;
 	gvir_config_domain_snapshot_disk_new;
 	gvir_config_domain_snapshot_disk_new_from_xml;
+
+	gvir_config_domain_snapshot_disk_get_driver_type;
+	gvir_config_domain_snapshot_disk_set_driver_type;
+	gvir_config_domain_snapshot_disk_get_name;
+	gvir_config_domain_snapshot_disk_set_name;
+	gvir_config_domain_snapshot_disk_get_snapshot_type;
+	gvir_config_domain_snapshot_disk_set_snapshot_type;
+	gvir_config_domain_snapshot_disk_get_source_file;
+	gvir_config_domain_snapshot_disk_set_source_file;
 } LIBVIRT_GCONFIG_0.1.6;
 
 # .... define new API here using predicted next version number ....
-- 
1.8.1.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]