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

Daniel P. Berrange berrange at redhat.com
Wed Oct 26 15:33:39 UTC 2011


On Wed, Oct 26, 2011 at 01:17:37AM +0300, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
> 
> ---
>  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;
> +}

You've got the flags parameter here, but for some reason
you've not passed it down to the libvirt API calls :-)

> 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);

The header files shouldn't have G_GNUC_UNUSED - only the method
impl wants that.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list