From 2a598257a5dc3dc36f683a79879cddd257e09579 Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Tue, 31 Aug 2021 14:07:33 -0400 Subject: [PATCH] ovn-tester: Provision ports simultaneously. If we need to provision ports on multiple workers, we may as well do it all at once. Signed-off-by: Mark Michelson --- ovn-tester/ovn_workload.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ovn-tester/ovn_workload.py b/ovn-tester/ovn_workload.py index 67d0f752..a51d65ee 100644 --- a/ovn-tester/ovn_workload.py +++ b/ovn-tester/ovn_workload.py @@ -634,12 +634,14 @@ async def create_cluster_join_switch(self, sw_name): ) async def provision_ports(self, n_ports, passive=False): - ret_list = [] + tasks = [] + ctx = ovn_context.active_context for _ in range(n_ports): worker = self.select_worker_for_port() - ports = await worker.provision_ports(self, 1, passive) - ret_list.append(ports[0]) - return ret_list + tasks.append(ctx.create_task(worker.provision_ports(self, 1, + passive))) + results = await asyncio.gather(*tasks) + return [ports[0] for ports in results] async def unprovision_ports(self, ports): for port in ports: