Make bond.create function more efficient
Make bond.create function more efficient

The original code used to call the function Xapi_vm.get_possible_hosts,
which is a very expensive function, more than necessary. This patch
changes that to call the function only when really needed.

This should provide a substantial speed-up in certain cases, especially when
joining a newly installed host to a pool with bonded NICs and many VMs.

Signed-off-by: Rob Hoes <8783b3376fb07d39edffc8d7da68a6de3874a7e6@citrix.com>

jjd27/xen-api,huizh/xen-api,agimofcarmen/xen-api,guard163/xen-api,koushikcgit/xen-api,anoobs/xen-api,cheng--zhang/xen-api,Frezzle/xen-api,jjd27/xen-api,ravippandey/xen-api,cheng--zhang/xen-api,ravippandey/xen-api,djs55/xen-api,thomassa/xen-api,rafalmiel/xen-api,guard163/xen-api,djs55/xen-api,robertbreker/xen-api,Frezzle/xen-api,robertbreker/xen-api,koushikcgit/xen-api,vasilenkomike/xen-api,koushikcgit/xen-api,ravippandey/xen-api,ravippandey/xen-api,salvocambria/xen-api,cheng--zhang/xen-api,euanh/xen-api,guard163/xen-api,simonjbeaumont/xen-api,thomassa/xen-api,koushikcgit/xen-api,agimofcarmen/xen-api,cheng-z/xen-api,thomassa/xen-api,vasilenkomike/xen-api,guard163/xen-api,rafalmiel/xen-api,simonjbeaumont/xen-api,vasilenkomike/xen-api,Frezzle/xen-api,huizh/xen-api,euanh/xen-api,agimofcarmen/xen-api,djs55/xen-api,srowe/xen-api,salvocambria/xen-api,guard163/xen-api,cheng--zhang/xen-api,euanh/xen-api,anoobs/xen-api,djs55/xen-api,anoobs/xen-api,ravippandey/xen-api,cheng--zhang/xen-api,agimofcarmen/xen-api,jjd27/xen-api,Frezzle/xen-api,anoobs/xen-api,Frezzle/xen-api,rafalmiel/xen-api,huizh/xen-api,djs55/xen-api,vasilenkomike/xen-api,jjd27/xen-api,salvocambria/xen-api,anoobs/xen-api,koushikcgit/xen-api,srowe/xen-api,vasilenkomike/xen-api,jjd27/xen-api,euanh/xen-api,salvocambria/xen-api,ravippandey/xen-api,rafalmiel/xen-api,srowe/xen-api,euanh/xen-api,huizh/xen-api,simonjbeaumont/xen-api,robertbreker/xen-api,cheng--zhang/xen-api,vasilenkomike/xen-api,salvocambria/xen-api,cheng-z/xen-api,srowe/xen-api,djs55/xen-api,euanh/xen-api,anoobs/xen-api,koushikcgit/xen-api,jjd27/xen-api,simonjbeaumont/xen-api,cheng-z/xen-api,thomassa/xen-api,robertbreker/xen-api,cheng-z/xen-api,robertbreker/xen-api,thomassa/xen-api,srowe/xen-api,agimofcarmen/xen-api,rafalmiel/xen-api,agimofcarmen/xen-api,cheng-z/xen-api,simonjbeaumont/xen-api,huizh/xen-api,cheng--zhang/xen-api,rafalmiel/xen-api,guard163/xen-api,huizh/xen-api,cheng-z/xen-api,salvocambria/xen-api,robertbreker/xen-api,simonjbeaumont/xen-api,cheng-z/xen-api,thomassa/xen-api