[virt-tools-list] libosinfo - implemented.

Daniel P. Berrange berrange at redhat.com
Thu Feb 4 15:20:12 UTC 2010


On Wed, Jan 27, 2010 at 10:54:07PM -0500, Arjun Roy wrote:
> Hi all,
> 
> Back in October I posted some thoughts on a library for dealing with OS metadata
> used by the various virt applications.
> 
> As a refresher, here it is:
> https://www.redhat.com/archives/virt-tools-list/2009-October/msg00091.html
> 
> After a few emails back and forth, I revised the proposed API to :
> https://www.redhat.com/archives/virt-tools-list/2009-October/msg00162.html
> 
> I have no implemented the API, mostly as described in the second email, and have
> it hosted at the following location:
> https://fedorahosted.org/libosinfo
> 
> I feel that with a little integration work, this would be very useful for any of
> the virt management applications in use, and would like to hear any comments on
> the implementation.

I've looked at the way the API works in a little more detail and I think
the way filters / hypervisors interoperate could be improved. In particular
I don't like the way you have to call 'osi_set_lib_hypervisor' to filter
the list of OS devices against a hypervisor, because this is modifying the
global state, preventing you easily dealing with multiple HVs. This may
not be required for the provisioning scenario, but in other usage cases I
think this would be a limitation.

I think to address this, the way filters & device lists are handled should
be changed. In psuedo code I'd think something like

Get the initial objets

 - hv = osi_hv_lookup(id)
 - os = osi_os_lookup(id)

Get the list of Hv devics

 - hvdevs = osi_hv_get_devices(hv)

Get the list of OS devices

 - osdevs = osi_os_get_devices(os)

Get a new list that shows the intersection of the first two

 - supporteddevs = osi_device_list_intersect(hvdevs, osdevs)

Create a filter for some kind of desired property set

 - filter = osi_new_filter()
 - osi_filter_add_constraint(filter, foo, bar)
 - osi_filter_add_constraint(filter, foo, bar)
 - osi_filter_add_constraint(filter, foo, bar)

Get a new device list that has the filter applied

 - wanteddevs = osi_device_list_filter(supporteddevs, filter)


The key idea here is that each object is *immutable*. Thus when 
you're applying filters you are in fact creating new objects to 
represent the result, not ever modifying the state of the existing 
object(s).

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the virt-tools-list mailing list