[libvirt-glib PATCHv2 5/6] gconfig: Add GVirConfigDomainSnapshotDisk getters/setters

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

 



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

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c
index a21f0d6..2e6a3f9 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c
@@ -86,3 +86,88 @@ 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);
+}
+
+GVirConfigDomainDiskFormat gvir_config_domain_snapshot_disk_get_driver_type(GVirConfigDomainSnapshotDisk *disk)
+{
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK(disk),
+                         GVIR_CONFIG_DOMAIN_DISK_FORMAT_RAW);
+
+    return gvir_config_object_get_attribute_genum(GVIR_CONFIG_OBJECT(disk),
+                                                  "driver", "type",
+                                                  GVIR_CONFIG_TYPE_DOMAIN_DISK_FORMAT,
+                                                  GVIR_CONFIG_DOMAIN_DISK_FORMAT_RAW);
+}
+
+
+void gvir_config_domain_snapshot_disk_set_driver_type(GVirConfigDomainSnapshotDisk *disk,
+                                                      GVirConfigDomainDiskFormat type)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_SNAPSHOT_DISK(disk));
+
+    gvir_config_object_add_child_with_attribute_enum(GVIR_CONFIG_OBJECT(disk),
+                                                     "driver", "type",
+                                                     GVIR_CONFIG_TYPE_DOMAIN_DISK_FORMAT,
+                                                     type);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h b/libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.h
index 9a73336..9c59c50 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);
+
+GVirConfigDomainDiskFormat gvir_config_domain_snapshot_disk_get_driver_type(GVirConfigDomainSnapshotDisk *disk);
+void gvir_config_domain_snapshot_disk_set_driver_type(GVirConfigDomainSnapshotDisk *disk,
+                                                      GVirConfigDomainDiskFormat 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 0a0b1f1..f5a1b6c 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -565,6 +565,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.2.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]