Skip to content

Commit 2a7523b

Browse files
authored
Merge pull request bn222#384 from almusil/improvements
Deployment speed up
2 parents 2f6ea39 + 744b640 commit 2a7523b

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-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())

common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ def get_future_state(future: Future[bool]) -> str:
680680
else:
681681
return "Fail"
682682

683+
futures = sorted(futures)
683684
state = {name: get_future_state(future) for (name, future) in futures}
684685
logger.info(f"Waiting for {msg}: {state}")
685686
max_tries = 200 * 6

0 commit comments

Comments
 (0)