[libvirt] [libvirt-glib v2] storage-pool: API to get/set autostart flag

Christophe Fergeau cfergeau at redhat.com
Thu Jun 4 16:46:31 UTC 2015


Looks good, ACK.

Christophe

On Wed, Jun 03, 2015 at 09:46:35PM +0100, Zeeshan Ali (Khattak) wrote:
> Add binding for virStoragePoolGetAutostart & virStoragePoolSetAutostart.
> ---
>  libvirt-gobject/libvirt-gobject-storage-pool.c | 51 ++++++++++++++++++++++++++
>  libvirt-gobject/libvirt-gobject-storage-pool.h |  5 +++
>  libvirt-gobject/libvirt-gobject.sym            |  6 +++
>  3 files changed, 62 insertions(+)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
> index f3eac0d..7f26b1b 100644
> --- a/libvirt-gobject/libvirt-gobject-storage-pool.c
> +++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
> @@ -1048,6 +1048,57 @@ gboolean gvir_storage_pool_delete (GVirStoragePool *pool,
>      return TRUE;
>  }
>  
> +/**
> + * gvir_storage_pool_get_autostart:
> + * @pool: the storage pool
> + * @err: return location for any #GError
> + *
> + * Return value: #True if autostart is enabled, #False otherwise.
> + */
> +gboolean gvir_storage_pool_get_autostart(GVirStoragePool *pool,
> +                                         GError **err)
> +{
> +    int ret;
> +
> +    g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE);
> +    g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
> +
> +    if (virStoragePoolGetAutostart(pool->priv->handle, &ret)) {
> +        gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
> +                               0,
> +                               "Failed to get autostart flag from storage pool");
> +    }
> +
> +    return !!ret;
> +}
> +
> +/**
> + * gvir_storage_pool_set_autostart:
> + * @pool: the storage pool
> + * @autostart: Whether or not to autostart
> + * @err: return location for any #GError
> + *
> + * Sets whether or not storage pool @pool is started automatically on boot.
> + *
> + * Return value: #TRUE on success, #FALSE otherwise.
> + */
> +gboolean gvir_storage_pool_set_autostart(GVirStoragePool *pool,
> +                                         gboolean autostart,
> +                                         GError **err)
> +{
> +    g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE);
> +    g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
> +
> +    if (virStoragePoolSetAutostart(pool->priv->handle, autostart)) {
> +        gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
> +                               0,
> +                               "Failed to set autostart flag on storage pool");
> +        return FALSE;
> +    }
> +
> +    return TRUE;
> +}
> +
>  static void
>  gvir_storage_pool_delete_helper(GSimpleAsyncResult *res,
>                                  GObject *object,
> diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.h b/libvirt-gobject/libvirt-gobject-storage-pool.h
> index f8529f0..f7f879c 100644
> --- a/libvirt-gobject/libvirt-gobject-storage-pool.h
> +++ b/libvirt-gobject/libvirt-gobject-storage-pool.h
> @@ -166,6 +166,11 @@ void gvir_storage_pool_delete_async (GVirStoragePool *pool,
>  gboolean gvir_storage_pool_delete_finish(GVirStoragePool *pool,
>                                           GAsyncResult *result,
>                                           GError **err);
> +gboolean gvir_storage_pool_get_autostart(GVirStoragePool *pool,
> +                                         GError **err);
> +gboolean gvir_storage_pool_set_autostart(GVirStoragePool *pool,
> +                                         gboolean autostart,
> +                                         GError **err);
>  
>  G_END_DECLS
>  
> diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
> index 927cad9..dcda675 100644
> --- a/libvirt-gobject/libvirt-gobject.sym
> +++ b/libvirt-gobject/libvirt-gobject.sym
> @@ -265,4 +265,10 @@ LIBVIRT_GOBJECT_0.2.0 {
>  	gvir_domain_open_graphics_fd;
>  } LIBVIRT_GOBJECT_0.1.9;
>  
> +LIBVIRT_GOBJECT_0.2.1 {
> +  global:
> +	gvir_storage_pool_get_autostart;
> +	gvir_storage_pool_set_autostart;
> +} LIBVIRT_GOBJECT_0.2.0;
> +
>  # .... define new API here using predicted next version number ....
> -- 
> 2.4.2
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150604/ee722f02/attachment-0001.sig>


More information about the libvir-list mailing list