[ovs-dev] [PATCH 1/1] xenserver: Reduce number of xapi DB calls in plugin
Ben Pfaff
blp at nicira.com
Mon Dec 5 18:09:25 UTC 2011
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