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

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

 



On Mon, May 18, 2015 at 03:11:07PM +0100, Zeeshan Ali (Khattak) wrote:
> Add binding for virStoragePoolGetAutostart & virStoragePoolSetAutostart.
> ---
>  libvirt-gobject/libvirt-gobject-storage-pool.c | 52 ++++++++++++++++++++++++++
>  libvirt-gobject/libvirt-gobject-storage-pool.h |  5 +++
>  libvirt-gobject/libvirt-gobject.sym            |  6 +++
>  3 files changed, 63 insertions(+)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
> index f3eac0d..e520c6a 100644
> --- a/libvirt-gobject/libvirt-gobject-storage-pool.c
> +++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
> @@ -1048,6 +1048,58 @@ 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)
> +{
> +    gboolean ret = FALSE;

I'd use 'int' instead of gboolean here as virStoragePoolGetAutostart
expects a int * as its last arg

> +
> +    g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), ret);
> +    g_return_val_if_fail(err == NULL || *err == NULL, ret);
> +
> +    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 FALSE;
> +    }
> +
> +    return ret;

You can return !!ret here if you want to be absolutely sure that you
return TRUE.

> +}
> +
> +/**
> + * gvir_storage_pool_set_autostart:
> + * @pool: the storage pool
> + * @autostart: New value for autostart flag

for the autostart flag ?

Looks good otherwise, ACK.

Christophe

Attachment: pgpwBPAFWYPqb.pgp
Description: PGP signature

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