[ovs-dev] [PATCH 1/1] xenserver: Reduce number of xapi DB calls in plugin

Rob Hoes Rob.Hoes at citrix.com
Tue Dec 6 09:36:29 UTC 2011


Hi Ben,

The get_all_records_where functions are indeed not very well documented, probably because the way to use them is a little awkward. I think we should at some point introduce new APIs to selectively query the database and discourage the use of get_all (because it does not scale). Currently get_all_records_where is the only way to do it.

This will work on older versions of XenServer (including 5.6.100), and even on versions so old that I have never actually seen them myself :)

Cheers,
Rob

On 5 Dec 2011, at 18:09, Ben Pfaff wrote:

> On Mon, Dec 05, 2011 at 02:43:12PM +0000, Dominic Curran wrote:
>> @@ -100,10 +99,9 @@ def update(session, args):
>>     host_mgmt_device = None
>>     pool_mgmt_macs = {}
>>     if new_controller:
>> -        for n in session.xenapi.PIF.get_all():
>> -            rec = session.xenapi.PIF.get_record(n)
>> -            if rec.get('management', False):
>> -                pool_mgmt_macs[rec.get('MAC')] = rec.get('device')
>> +        recs = session.xenapi.PIF.get_all_records_where('field "management"="true"')
>> +        for rec in recs:
>> +            pool_mgmt_macs[rec.get('MAC')] = rec.get('device')
> 
> Currently Open vSwitch supports XenServer back to version 5.6.100.  I
> consulted the API reference for 5.6 here:
> 	http://community.citrix.com/download/attachments/38633496/xenenterpriseapi.pdf?version=3
> and did not see any documentation for get_all_records_where() on the
> PIF class, only on the Message class.
> 
> This is also true in the documentation for XenServer 6.0, but it
> worked fine for me on 6.0.
> 
> Are you sure that this will work with current and former XenServer
> releases?  (Should you update the documentation?)
> 
> Thanks,
> 
> Ben.




More information about the dev mailing list