[libvirt] [libvirt-glib PATCH] Add API to get security models from host capabilities
Christophe Fergeau
cfergeau at redhat.com
Mon Jun 16 09:18:24 UTC 2014
Hey,
Looks good to me, one addition below:
On Thu, Jun 05, 2014 at 08:42:24AM +0200, Cédric Bosdonnat wrote:
> diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities-host.c b/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
> index 6a15206..46d2bc1 100644
> --- a/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
> +++ b/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
> @@ -77,3 +77,54 @@ gvir_config_capabilities_host_get_cpu(GVirConfigCapabilitiesHost *host)
>
> return GVIR_CONFIG_CAPABILITIES_CPU(object);
> }
> +
> +struct GetSecModelData {
> + GVirConfigXmlDoc *doc;
> + const gchar *schema;
> + GList *secmodels;
> + GType type;
> +};
> +
> +static gboolean add_secmodel(xmlNodePtr node, gpointer opaque)
> +{
> + struct GetSecModelData* data = (struct GetSecModelData*)opaque;
> + GVirConfigObject *secmodel;
> +
> + if (g_strcmp0((const gchar *)node->name, "secmodel") != 0)
> + return TRUE;
> +
> + secmodel = gvir_config_object_new_from_tree
> + (data->type,
> + data->doc,
> + data->schema,
> + node);
> + if (secmodel != NULL)
> + data->secmodels = g_list_append(data->secmodels, secmodel);
> + else
> + g_debug("Failed to parse %s node", node->name);
> +
> + return TRUE;
> +}
> +
For good introspection, you will need something like this here:
diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities-host.c b/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
index 07719d0..a5d58e8 100644
--- a/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
+++ b/libvirt-gconfig/libvirt-gconfig-capabilities-host.c
@@ -106,6 +106,15 @@ static gboolean add_secmodel(xmlNodePtr node, gpointer opaque)
return TRUE;
}
+/**
+ * gvir_config_capabilities_host_get_secmodels:
+ * @host: a #GVirConfigCapabilitiesHost
+ *
+ * Get the security models listed in @host capabilities.
+ *
+ * Returns: (element-type LibvirtGConfig.CapabilitiesHostSecModel) (transfer full):
+ * a newly allocated #GList of #GVirConfigCapabilitiesHostSecModel.
+ */
GList *
gvir_config_capabilities_host_get_secmodels(GVirConfigCapabilitiesHost *host)
{
ACK with this (or a variant of this if you want to improve the
documentation text) squashed in.
Christophe
-------------- 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/20140616/c0689c64/attachment-0001.sig>
More information about the libvir-list
mailing list