---
 libvirt-gconfig/libvirt-gconfig-device-disk.c |   46 +++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-device-disk.h |   25 +++++++++++++
 libvirt-gconfig/libvirt-gconfig.sym           |    6 +++
 3 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-device-disk.c 
b/libvirt-gconfig/libvirt-gconfig-device-disk.c
index ba2ef47..9981ae8 100644
--- a/libvirt-gconfig/libvirt-gconfig-device-disk.c
+++ b/libvirt-gconfig/libvirt-gconfig-device-disk.c
@@ -27,6 +27,7 @@
 #include <libxml/tree.h>
 
 #include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
 
 extern gboolean debugFlag;
 
@@ -80,3 +81,48 @@ GVirConfigDeviceDisk 
*gvir_config_device_disk_new_from_xml(const gchar *xml,
                                              "disk", NULL, xml, error);
     return GVIR_CONFIG_DEVICE_DISK(object);
 }
+
+void gvir_config_device_disk_set_type(GVirConfigDeviceDisk *disk,
+                                      GVirConfigDeviceDiskType type)
+{
+    xmlNodePtr node;
+    const char *type_str;
+
+    node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(disk));
+    if (node == NULL)
+        return;
+    type_str = gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_DEVICE_DISK_TYPE,
+                                          type);
+    if (type_str != NULL)
+        xmlNewProp(node, (xmlChar*)"type", (xmlChar*)type_str);
+}
+
+void gvir_config_device_disk_set_guest_device_type(GVirConfigDeviceDisk *disk,
+                                                   
GVirConfigDeviceDiskGuestDeviceType type)
+{
+    xmlNodePtr node;
+    const char *type_str;
+
+    node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(disk));
+    if (node == NULL)
+        return;
+    type_str = 
gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_DEVICE_DISK_GUEST_DEVICE_TYPE,
+                                          type);
+    if (type_str != NULL)
+        xmlNewProp(node, (xmlChar*)"device", (xmlChar*)type_str);
+}
+
+void gvir_config_device_disk_set_snapshot_type(GVirConfigDeviceDisk *disk,
+                                               
GVirConfigDeviceDiskSnapshotType type)
+{
+    xmlNodePtr node;
+    const char *type_str;
+
+    node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(disk));
+    if (node == NULL)
+        return;
+    type_str = 
gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_DEVICE_DISK_SNAPSHOT_TYPE,
+                                          type);
+    if (type_str != NULL)
+        xmlNewProp(node, (xmlChar*)"snapshot", (xmlChar*)type_str);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-device-disk.h 
b/libvirt-gconfig/libvirt-gconfig-device-disk.h
index 4e9d622..2850672 100644
--- a/libvirt-gconfig/libvirt-gconfig-device-disk.h
+++ b/libvirt-gconfig/libvirt-gconfig-device-disk.h
@@ -56,6 +56,24 @@ struct _GVirConfigDeviceDiskClass
     gpointer padding[20];
 };
 
+typedef enum {
+    GVIR_CONFIG_DEVICE_DISK_FILE,
+    GVIR_CONFIG_DEVICE_DISK_BLOCK,
+    GVIR_CONFIG_DEVICE_DISK_DIR,
+    GVIR_CONFIG_DEVICE_DISK_NETWORK
+} GVirConfigDeviceDiskType;
+
+typedef enum {
+    GVIR_CONFIG_DEVICE_DISK_GUEST_DEVICE_DISK,
+    GVIR_CONFIG_DEVICE_DISK_GUEST_DEVICE_FLOPPY,
+    GVIR_CONFIG_DEVICE_DISK_GUEST_DEVICE_CDROM
+} GVirConfigDeviceDiskGuestDeviceType;
+
+typedef enum {
+    GVIR_CONFIG_DEVICE_DISK_SNAPSHOT_NO,
+    GVIR_CONFIG_DEVICE_DISK_SNAPSHOT_INTERNAL,
+    GVIR_CONFIG_DEVICE_DISK_SNAPSHOT_EXTERNAL
+} GVirConfigDeviceDiskSnapshotType;
 
 GType gvir_config_device_disk_get_type(void);
 
@@ -63,6 +81,13 @@ GVirConfigDeviceDisk *gvir_config_device_disk_new(void);
 GVirConfigDeviceDisk *gvir_config_device_disk_new_from_xml(const gchar *xml,
                                                            GError **error);
 
+void gvir_config_device_disk_set_type(GVirConfigDeviceDisk *disk,
+                                      GVirConfigDeviceDiskType type);
+void gvir_config_device_disk_set_guest_device_type(GVirConfigDeviceDisk *disk,
+                                                   
GVirConfigDeviceDiskGuestDeviceType type);
+void gvir_config_device_disk_set_snapshot_type(GVirConfigDeviceDisk *disk,
+                                               
GVirConfigDeviceDiskSnapshotType type);
+
 G_END_DECLS
 
 #endif /* __LIBVIRT_GCONFIG_DEVICE_DISK_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.sym 
b/libvirt-gconfig/libvirt-gconfig.sym
index b19e1c1..76ffc4c 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -15,8 +15,14 @@ LIBVIRT_GOBJECT_0.0.1 {
        gvir_config_device_get_type;
 
        gvir_config_device_disk_get_type;
+       gvir_config_device_disk_guest_device_type_get_type;
+       gvir_config_device_disk_snapshot_type_get_type;
+       gvir_config_device_disk_type_get_type;
        gvir_config_device_disk_new;
        gvir_config_device_disk_new_from_xml;
+       gvir_config_device_disk_set_snapshot_type;
+       gvir_config_device_disk_set_guest_device_type;
+       gvir_config_device_disk_set_type;
 
        gvir_config_domain_get_type;
        gvir_config_domain_new;
-- 
1.7.7

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

Reply via email to