Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

density_heavy: density_light: Fix startup stages when running in IC mode. #196

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)]
Loading