[virt-tools-list] libosinfo - api revision with glib/gobject
Arjun Roy
arroy at redhat.com
Mon Feb 22 19:56:48 UTC 2010
A proposed revision of the libosinfo API follows.
Modifications made due to suggestions by Dan Berrange in
https://www.redhat.com/archives/virt-tools-list/2010-February/msg00013.html
and
https://www.redhat.com/archives/virt-tools-list/2010-February/msg00000.html
The biggest change is the conversion of the API to use GLib for types and error
handling. The top level types of hypervisor, device and operating system now
each derive from GObject. GError is used for error handling; and any method
returning a list previously now either returns a GPtrArray (when returning a
list of either of the three top main types) or returns a GArray (when returning
other values such as strings). Any C datatype has been replaced with its glib
version.
A couple of methods regarding lists and filtering have been added; specifically,
a method to return a new list as the result of applying a filter to a current
list, and a method to return a new list as the intersection of two existing
lists.
Any comments before porting the API over would be appreciated. A full listing
of the API follows.
-Arjun
/*******************************************************************************
Manipulating the library
******************************************************************************/
osi_lib_t * osi_get_lib_handle(const gchar * data_dir, GError ** error);
gint osi_init_lib(osi_lib_t * lib, GError ** error);
gint osi_close_lib(osi_lib_t * lib, GError ** error);
gint osi_set_lib_param(osi_lib_t * lib, gchar * key, gchar * val, GError ** error);
gchar * osi_get_lib_param(osi_lib_t lib, gchar * key, GError ** error);
/*******************************************************************************
Manipulating hypervisors
******************************************************************************/
GArray * osi_get_all_hypervisor_ids(osi_lib_t * lib, GError ** error);
osi_hypervisor_t * osi_get_hypervisor_by_id(osi_lib_t * lib, gchar * hypervisor_id, GError ** error);
gchar * osi_get_hv_id(osi_hypervisor_t * hv, GError ** error);
GArray * osi_get_hv_device_types(osi_hypervisor_t * hv, GError ** error);
GArray * osi_get_hv_all_property_keys(osi_hypervisor_t * hv, GError ** error);
GArray * osi_get_hv_property_all_values(osi_hypervisor_t * hv, gchar * propname, GError ** error);
gchar * osi_get_hv_property_first_value(osi_hypervisor_t * hv, gchar* propname, GError ** error);
/*******************************************************************************
Manipulating filters
******************************************************************************/
osi_filter_t * osi_get_filter(osi_lib_t * lib, GError ** error);
gint osi_add_filter_constraint(osi_filter_t * filter, gchar * propname, gchar * propval, GError ** error);
gint osi_add_relation_constraint(osi_filter_t * filter, osi_relationship relationship, osi_os_t * os, GError ** error);
gint osi_clear_filter_constraint(osi_filter_t * filter, gchar * propname, GError ** error);
gint osi_clear_relation_constraint(osi_filter_t *filter, osi_relationship relationship, GError ** error);
gint osi_clear_all_constraints(osi_filter_t * filter, GError ** error);
GArray * osi_get_filter_constraint_keys(osi_filter_t * filter, GError ** error);
gchar * osi_get_filter_constraint_value(osi_filter_t * filter, gchar * propname, GError ** error);
osi_os_t * osi_get_relationship_constraint_value(osi_filter_t * filter, osi_relationship relationship, GError ** error);
/*******************************************************************************
Manipulating Devices
******************************************************************************/
GPtrArray * osi_hypervisor_devices(osi_hypervisor_t * hv, gchar * section, osi_filter_t * filter, GError ** error);
GPtrArray * osi_os_devices(osi_os_t * os, osi_hypervisor_t * hv, gchar * section, osi_filter_t * filter, GError ** error);
GPtrArray * osi_device_list_intersect(GPtrArray * devices_one, GPtrArray * devices_two, GError ** error);
GPtrArray * osi_filter_device_list(GPtrArray * devices, osi_filter_t * filter, GError ** error);
osi_device_t * osi_get_device_by_index(GPtrArray * devices, gint index, GError ** error);
gchar * osi_device_id(osi_device_t * device, GError ** error);
osi_device_t * osi_get_device_by_id(osi_lib_t * lib, gchar * device_id, GError ** error);
GArray * osi_get_all_device_property_keys(osi_device_t * device, GError ** error);
GArray * osi_get_device_property_all_values(osi_device_t * device, gchar * property, GError ** error);
gchar * osi_get_device_property_value(osi_device_t * device, gchar * property, GError ** error);
gchar * osi_get_device_driver(osi_device_t * device, osi_hypervisor_t * hv, osi_os_t * os, gchar * type, GError ** error);
osi_device_t * osi_get_preferred_device(osi_os_t * os, osi_hypervisor_t * hv, gchar * section, osi_filter_t * filter, GError ** error);
/*******************************************************************************
Manipulating Operating Systems
******************************************************************************/
GPtrArray * osi_get_os_list(osi_lib_t * lib, osi_filter_t * filter, GError ** error);
GPtrArray * osi_os_list_intersect(GPtrArray * os_list_one, GPtrArray * os_list_two, GError ** err);
GPtrArray * osi_filter_os_list(GPtrArray * os_list, osi_filter_t * filter, GError ** err);
osi_os_t osi_get_os_by_index(GPtrArray * list, gint index, GError ** error);
gchar * osi_get_os_id(osi_os_t * os, GError ** error);
osi_os_t * osi_get_os_by_id(osi_lib_t * lib, gchar * id, GError ** error);
GArray * osi_get_all_os_property_keys(osi_os_t * os, GError ** error);
GArray * osi_get_os_property_all_values(osi_os_t * os, gchar * propname, GError ** error);
gchar * osi_get_os_property_first_value(osi_os_t * os, gchar * propname, GError ** error);
GArray * osi_unique_property_values(osi_lib_t * lib, gchar * propname, GError ** error);
osi_os_t * osi_get_related_os(osi_os_t * os, osi_relationship relationship, GError ** error);
GPtrArray * osi_unique_relationship_values(osi_lib_t * lib, osi_relationship relationship, GError ** error);
More information about the virt-tools-list
mailing list