Skip to content

Commit

Permalink
ovn-tester: Provision ports simultaneously.
Browse files Browse the repository at this point in the history
If we need to provision ports on multiple workers, we may as well do it
all at once.

Suggested-by: Mohammad Heib <[email protected]>
Signed-off-by: Mark Michelson <[email protected]>
  • Loading branch information
putnopvut committed Sep 2, 2021
1 parent da7dd12 commit 92c0388
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ovn-tester/ovn_workload.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,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:
Expand Down

0 comments on commit 92c0388

Please sign in to comment.