Skip to content

Commit

Permalink
Merge pull request #196 from dceara/fix-ic-startup-stages
Browse files Browse the repository at this point in the history
density_heavy: density_light: Fix startup stages when running in IC mode.
  • Loading branch information
dceara authored Mar 18, 2024
2 parents a8631ec + fa7c238 commit 5262c02
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
16 changes: 12 additions & 4 deletions ovn-tester/cms/ovn_kubernetes/tests/density_heavy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from ovn_context import Context
from cms.ovn_kubernetes import Namespace
from ovn_ext_cmd import ExtCmd
from ovn_utils import distribute_n_tasks_per_clusters
import ovn_load_balancer as lb
import ovn_exceptions
import netaddr
Expand Down Expand Up @@ -72,13 +73,20 @@ def run(self, clusters, global_cfg):
return

ns = Namespace(clusters, 'ns_density_heavy', global_cfg)
n_startup_per_cluster = distribute_n_tasks_per_clusters(
self.config.n_startup, len(clusters)
)

with Context(
clusters, 'density_heavy_startup', brief_report=True
) as ctx:
for i in range(
0, self.config.n_startup, self.config.pods_vip_ratio
):
self.run_iteration(clusters, ns, i, global_cfg, passive=True)
for i in range(len(clusters)):
for j in range(
0, n_startup_per_cluster[i], self.config.pods_vip_ratio
):
self.run_iteration(
clusters, ns, j, global_cfg, passive=True
)

with Context(
clusters,
Expand Down
7 changes: 6 additions & 1 deletion ovn-tester/cms/ovn_kubernetes/tests/density_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from ovn_context import Context
from cms.ovn_kubernetes import Namespace
from ovn_ext_cmd import ExtCmd
from ovn_utils import distribute_n_tasks_per_clusters


DensityCfg = namedtuple(
Expand All @@ -21,12 +22,16 @@ def __init__(self, config, clusters, global_cfg):

def run(self, clusters, global_cfg):
ns = Namespace(clusters, 'ns_density_light', global_cfg)
n_startup_per_cluster = distribute_n_tasks_per_clusters(
self.config.n_startup, len(clusters)
)

with Context(
clusters, 'density_light_startup', len(clusters), brief_report=True
) as ctx:
for i in ctx:
ports = clusters[i].provision_ports(
self.config.n_startup, passive=True
n_startup_per_cluster[i], passive=True
)
ns.add_ports(ports, i)

Expand Down
5 changes: 5 additions & 0 deletions ovn-tester/ovn_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,3 +912,8 @@ def uuid_transaction(self, func):
def ts_add(self):
log.info('Creating transit switch')
self.uuid_transaction(partial(self.idl.ts_add, 'ts'))


def distribute_n_tasks_per_clusters(n_tasks, n_clusters):
div, rest = divmod(n_tasks, n_clusters)
return [div + 1 if i < rest else div for i in range(n_clusters)]

0 comments on commit 5262c02

Please sign in to comment.