Skip to content

Commit 744b640

Browse files
committed
clusterDeployer: Run set_password in parallel.
During the deployment proces there is a step to set password for all nodes that were created. This step was running in single thread and could take up to 10 minutes from the whole deployment. Make it run in parallel, this significantly shortens the time needed down to ~1 minute. Signed-off-by: Ales Musil <[email protected]>
1 parent d12b90b commit 744b640

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

clusterDeployer.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,8 @@ def create_masters(self) -> None:
367367
logger.info('updating /etc/hosts')
368368
self.update_etc_hosts()
369369

370-
logger.info("Setting password to for root to redhat")
371-
for master in master_nodes:
372-
master.set_password()
370+
nodes_with_futures = [(n.config.name, executor.submit(n.set_password)) for n in master_nodes]
371+
wait_futures("set root password to redhat", nodes_with_futures)
373372

374373
self.update_dnsmasq()
375374

@@ -440,10 +439,8 @@ def create_workers(self) -> None:
440439

441440
self.wait_for_workers()
442441

443-
logger.info("Setting password to for root to redhat")
444-
for h in hosts_with_workers:
445-
for worker in h.k8s_worker_nodes:
446-
worker.set_password()
442+
nodes_with_futures = [(n.config.name, executor.submit(n.set_password)) for n in worker_nodes]
443+
wait_futures("set root password to redhat", nodes_with_futures)
447444

448445
def _wait_master_reboot(self, infra_env: str, node: ClusterNode) -> bool:
449446
def master_ready(ai: AssistedClientAutomation, node_name: str) -> bool:

clusterNode.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ def teardown(self) -> None:
6060
def ensure_reboot(self) -> bool:
6161
return True
6262

63-
def set_password(self, user: str = "root", password: str = "redhat") -> None:
63+
def set_password(self, user: str = "root", password: str = "redhat") -> bool:
6464
rh = host.RemoteHost(self.ip())
6565
rh.ssh_connect("core")
6666
rh.run_or_die(f"echo {user}:{password} | sudo chpasswd")
67+
return True
6768

6869
def print_logs(self) -> None:
6970
rh = host.RemoteHost(self.ip())

0 commit comments

Comments
 (0)