[virt-tools-list] libosinfo - implemented.

Arjun Roy arroy at redhat.com
Fri Feb 5 23:00:55 UTC 2010


On 02/04/2010 07:20 AM, Daniel P. Berrange wrote:
> 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.

Now that I look at it, I agree with you. It looks like the lib_hypervisor was only used in one function, and it's a lot more flexible to just have that function take a handle to a hypervisor in processing the result. So I'll make that change.

> 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 list of Hv devics
>
>  - hvdevs = osi_hv_get_devices(hv)
>
> Get the list of OS devices
>
>  - osdevs = osi_os_get_devices(os)
>

The existing methods take a (possibly null filter) as a parameter, so I think they suffice.

> Get a new list that shows the intersection of the first two
>
>  - supporteddevs = osi_device_list_intersect(hvdevs, osdevs)

That's a good one, and I shall add it.

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

That's another good one, and I shall add it also.

The other issue is that of GObject. I am admittedly not too familiar with it, and didn't know that using it would have huge changes for the API. Regarding that, I'll give it some thought over the weekend (need to get familiar with the framework) and we can talk about that more on Monday.

By which time the changes you suggested in the filter/hv relationship will be present as well, albeit the API won't be in GObject form at that time.

-Arjun




More information about the virt-tools-list mailing list