[libosinfo 2/2] Add API to build & start storage pools

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

 



From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx>

---
 libvirt-gobject/libvirt-gobject-storage-pool.c |   44 ++++++++++++++++++++++++
 libvirt-gobject/libvirt-gobject-storage-pool.h |    8 ++++
 libvirt-gobject/libvirt-gobject.sym            |    2 +
 3 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
index bd3be94..a1c7c6b 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.c
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
@@ -518,3 +518,47 @@ GVirStorageVol *gvir_storage_pool_create_volume
 
     return g_object_ref(volume);
 }
+
+/**
+ * gvir_storage_pool_build:
+ * @pool: the storage pool to build
+ * @flags:  the flags
+ * @err: return location for any #GError
+ *
+ * Return value: #True on success, #False otherwise.
+ */
+gboolean gvir_storage_pool_build (GVirStoragePool *pool,
+                                  guint64 flags G_GNUC_UNUSED,
+                                  GError **err)
+{
+    if (virStoragePoolBuild(pool->priv->handle, 0)) {
+        *err = gvir_error_new_literal(GVIR_STORAGE_POOL_ERROR,
+                                      0,
+                                      "Failed to build storage pool");
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+/**
+ * gvir_storage_pool_start:
+ * @pool: the storage pool to start
+ * @flags:  the flags
+ * @err: return location for any #GError
+ *
+ * Return value: #True on success, #False otherwise.
+ */
+gboolean gvir_storage_pool_start (GVirStoragePool *pool,
+                                  guint64 flags G_GNUC_UNUSED,
+                                  GError **err)
+{
+    if (virStoragePoolCreate(pool->priv->handle, 0)) {
+        *err = gvir_error_new_literal(GVIR_STORAGE_POOL_ERROR,
+                                      0,
+                                      "Failed to start storage pool");
+        return FALSE;
+    }
+
+    return TRUE;
+}
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.h b/libvirt-gobject/libvirt-gobject-storage-pool.h
index 620f888..2e9cca2 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.h
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.h
@@ -88,6 +88,14 @@ GVirStorageVol *gvir_storage_pool_create_volume
                                  GVirConfigStorageVol *conf,
                                  GError **err);
 
+gboolean gvir_storage_pool_build (GVirStoragePool *pool,
+                                  guint64 flags G_GNUC_UNUSED,
+                                  GError **err);
+
+gboolean gvir_storage_pool_start (GVirStoragePool *pool,
+                                  guint64 flags G_GNUC_UNUSED,
+                                  GError **err);
+
 G_END_DECLS
 
 #endif /* __LIBVIRT_GOBJECT_STORAGE_POOL_H__ */
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index f1fa78b..4b1b84c 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -89,6 +89,8 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_storage_pool_get_volumes;
 	gvir_storage_pool_get_volume;
 	gvir_storage_pool_create_volume;
+	gvir_storage_pool_build;
+	gvir_storage_pool_start;
 
 	gvir_storage_vol_get_type;
 	gvir_storage_vol_handle_get_type;
-- 
1.7.6.4

--
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]