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.

Signed-off-by: Mark Michelson <[email protected]>
  • Loading branch information
putnopvut committed Aug 31, 2021
1 parent a764fa3 commit 2a59825
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 @@ -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:
Expand Down

0 comments on commit 2a59825

Please sign in to comment.