[libvirt] [libvirt-glib 11/10] Add gvir_config_storage_pool_set_pool_type

Christophe Fergeau cfergeau at redhat.com
Fri Dec 9 13:20:23 UTC 2011


---
 libvirt-gconfig/libvirt-gconfig-storage-pool.c |   12 ++++++++++++
 libvirt-gconfig/libvirt-gconfig-storage-pool.h |   12 ++++++++++++
 libvirt-gconfig/libvirt-gconfig.sym            |    2 ++
 libvirt-gconfig/tests/test-domain-create.c     |    1 +
 4 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.c b/libvirt-gconfig/libvirt-gconfig-storage-pool.c
index 97bcbb4..95609bb 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-pool.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.c
@@ -74,6 +74,18 @@ GVirConfigStoragePool *gvir_config_storage_pool_new_from_xml(const gchar *xml,
     return GVIR_CONFIG_STORAGE_POOL(object);
 }
 
+void gvir_config_storage_pool_set_pool_type(GVirConfigStoragePool *pool,
+                                            GVirConfigStoragePoolType type)
+{
+    g_return_if_fail(GVIR_IS_CONFIG_STORAGE_POOL(pool));
+
+    gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(pool),
+                                               "type",
+                                               GVIR_TYPE_CONFIG_STORAGE_POOL_TYPE,
+                                               type,
+                                               NULL);
+}
+
 void gvir_config_storage_pool_set_name(GVirConfigStoragePool *pool,
                                        const char *name)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.h b/libvirt-gconfig/libvirt-gconfig-storage-pool.h
index 3f2a5bd..84f6c80 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-pool.h
+++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.h
@@ -59,6 +59,16 @@ struct _GVirConfigStoragePoolClass
     gpointer padding[20];
 };
 
+typedef enum {
+    GVIR_CONFIG_STORAGE_POOL_TYPE_DIR,
+    GVIR_CONFIG_STORAGE_POOL_TYPE_FS,
+    GVIR_CONFIG_STORAGE_POOL_TYPE_NETFS,
+    GVIR_CONFIG_STORAGE_POOL_TYPE_LOGICAL,
+    GVIR_CONFIG_STORAGE_POOL_TYPE_DISK,
+    GVIR_CONFIG_STORAGE_POOL_TYPE_ISCSI,
+    GVIR_CONFIG_STORAGE_POOL_TYPE_SCSI,
+    GVIR_CONFIG_STORAGE_POOL_TYPE_MPATH
+} GVirConfigStoragePoolType;
 
 GType gvir_config_storage_pool_get_type(void);
 
@@ -74,6 +84,8 @@ void gvir_config_storage_pool_set_capacity(GVirConfigStoragePool *pool,
                                            guint64 capacity);
 void gvir_config_storage_pool_set_name(GVirConfigStoragePool *pool,
                                        const char *name);
+void gvir_config_storage_pool_set_pool_type(GVirConfigStoragePool *pool,
+                                            GVirConfigStoragePoolType type);
 void gvir_config_storage_pool_set_source(GVirConfigStoragePool *pool,
                                          GVirConfigStoragePoolSource *source);
 void gvir_config_storage_pool_set_target(GVirConfigStoragePool *pool,
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index d0c35d2..297c1f4 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -216,12 +216,14 @@ LIBVIRT_GCONFIG_0.0.1 {
 	gvir_config_storage_permissions_set_owner;
 
 	gvir_config_storage_pool_get_type;
+	gvir_config_storage_pool_type_get_type;
 	gvir_config_storage_pool_new;
 	gvir_config_storage_pool_new_from_xml;
 	gvir_config_storage_pool_set_allocation;
 	gvir_config_storage_pool_set_available;
 	gvir_config_storage_pool_set_capacity;
 	gvir_config_storage_pool_set_name;
+	gvir_config_storage_pool_set_pool_type;
 	gvir_config_storage_pool_set_source;
 	gvir_config_storage_pool_set_target;
 	gvir_config_storage_pool_set_uuid;
diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index ea3a3ea..c5f0027 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -176,6 +176,7 @@ int main(void)
     GVirConfigStoragePermissions *perms;
 
     pool = gvir_config_storage_pool_new();
+    gvir_config_storage_pool_set_pool_type(pool, GVIR_CONFIG_STORAGE_POOL_TYPE_DIR);
 
     pool_source = gvir_config_storage_pool_source_new();
     gvir_config_storage_pool_source_set_directory(pool_source, "/foo/bar");
-- 
1.7.7.3




More information about the libvir-list mailing list