Re: [libvirt-glib 1/3] API to get capabilities from connection

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

 



ACK on this one, dunno if we'll want an async variant of this.

Christophe

On Tue, May 01, 2012 at 08:30:38PM +0300, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx>
> 
> ---
>  libvirt-gconfig/libvirt-gconfig-capabilities.c |    4 ---
>  libvirt-gobject/libvirt-gobject-connection.c   |   32 ++++++++++++++++++++++++
>  libvirt-gobject/libvirt-gobject-connection.h   |    3 ++
>  libvirt-gobject/libvirt-gobject.sym            |    1 +
>  4 files changed, 36 insertions(+), 4 deletions(-)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities.c b/libvirt-gconfig/libvirt-gconfig-capabilities.c
> index 4c4df68..3d9d036 100644
> --- a/libvirt-gconfig/libvirt-gconfig-capabilities.c
> +++ b/libvirt-gconfig/libvirt-gconfig-capabilities.c
> @@ -54,8 +54,6 @@ GVirConfigCapabilities *gvir_config_capabilities_new(void)
>  {
>      GVirConfigObject *object;
>  
> -    /* FIXME: what is the XML root of the capability node? I suspect it is
> -     * either 'guest' or 'host' */
>      object = gvir_config_object_new(GVIR_CONFIG_TYPE_CAPABILITIES,
>                                      "capabilities",
>                                      DATADIR "/libvirt/schemas/capability.rng");
> @@ -67,8 +65,6 @@ GVirConfigCapabilities *gvir_config_capabilities_new_from_xml(const gchar *xml,
>  {
>      GVirConfigObject *object;
>  
> -    /* FIXME: what is the XML root of the capability node? I suspect it is
> -     * either 'guest' or 'host' */
>      object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_CAPABILITIES,
>                                               "capabilities",
>                                               DATADIR "/libvirt/schemas/capability.rng",
> diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
> index baeeb1c..4f04f98 100644
> --- a/libvirt-gobject/libvirt-gobject-connection.c
> +++ b/libvirt-gobject/libvirt-gobject-connection.c
> @@ -1387,3 +1387,35 @@ GVirNodeInfo *gvir_connection_get_node_info(GVirConnection *conn,
>  
>      return ret;
>  }
> +
> +/**
> + * gvir_connection_get_capabilities:
> + * @conn: the connection
> + * @err: return location for any #GError
> + *
> + * Return value: (transfer full): a #GVirConfigCapabilities or NULL
> + */
> +GVirConfigCapabilities *gvir_connection_get_capabilities(GVirConnection *conn,
> +                                                         GError **err)
> +{
> +    GVirConfigCapabilities *caps;
> +    char *caps_xml;
> +
> +    g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
> +    g_return_val_if_fail(err == NULL || *err == NULL, NULL);
> +    g_return_val_if_fail(conn->priv->conn, NULL);
> +
> +    caps_xml = virConnectGetCapabilities(conn->priv->conn);
> +    if (caps_xml == NULL) {
> +        gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
> +                               0,
> +                               "Unable to get capabilities");
> +        return NULL;
> +    }
> +
> +    caps = gvir_config_capabilities_new_from_xml(caps_xml, err);
> +    free(caps_xml);
> +
> +    return caps;
> +}
> +
> diff --git a/libvirt-gobject/libvirt-gobject-connection.h b/libvirt-gobject/libvirt-gobject-connection.h
> index 3cc60a2..8c48f67 100644
> --- a/libvirt-gobject/libvirt-gobject-connection.h
> +++ b/libvirt-gobject/libvirt-gobject-connection.h
> @@ -191,6 +191,9 @@ GVirStream *gvir_connection_get_stream(GVirConnection *conn,
>  GVirNodeInfo *gvir_connection_get_node_info(GVirConnection *conn,
>                                              GError **err);
>  
> +GVirConfigCapabilities *gvir_connection_get_capabilities(GVirConnection *conn,
> +                                                         GError **err);
> +
>  G_END_DECLS
>  
>  #endif /* __LIBVIRT_GOBJECT_CONNECTION_H__ */
> diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
> index f43836f..0c9fc37 100644
> --- a/libvirt-gobject/libvirt-gobject.sym
> +++ b/libvirt-gobject/libvirt-gobject.sym
> @@ -31,6 +31,7 @@ LIBVIRT_GOBJECT_0.0.8 {
>  	gvir_connection_create_storage_pool;
>  	gvir_connection_start_domain;
>  	gvir_connection_get_node_info;
> +	gvir_connection_get_capabilities;
>  
>  	gvir_domain_device_get_type;
>  	gvir_domain_device_get_domain;
> -- 
> 1.7.7.6
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpu7jP_QwZwQ.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]