From c9e2f8140beb15e15f7e6102eba6c7e8e2b2cece Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Mon, 24 Mar 2025 10:11:04 +0200 Subject: [PATCH 1/2] ccmlib/node: make it possible to get host id for a node that is down Current host_id(0 implementation works only if a node is UP since it contacts the node itself. Change it so that the id is looked up in the logs and only if this fails we try to contact the node. This way we can check host id even for a node that is down. --- ccmlib/scylla_node.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ccmlib/scylla_node.py b/ccmlib/scylla_node.py index 8d1cf3ca..fbaf679c 100644 --- a/ccmlib/scylla_node.py +++ b/ccmlib/scylla_node.py @@ -1449,6 +1449,10 @@ def rollback(self, upgrade_to_version): def hostid(self, timeout=60, force_refresh=False): if self.node_hostid and not force_refresh: return self.node_hostid + m = self.grep_log("init - Setting local host id to (.+?)$") + if m: + self.node_hostid = m[-1][1].group(1) + return self.node_hostid try: node_address = self.address() url = f"http://{node_address}:{self.api_port}/storage_service/hostid/local" From 6ecff0b8907550a826c490f6d03557f1d55244ce Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Mon, 24 Mar 2025 10:15:59 +0200 Subject: [PATCH 2/2] ccmlib/node: check for both IP and ID in the log output We are changing ScyllaDB to use ids internally, so some logs are changing to use ids instead of ips. Prepare for that. --- ccmlib/node.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ccmlib/node.py b/ccmlib/node.py index cabec0e3..1ecd58af 100644 --- a/ccmlib/node.py +++ b/ccmlib/node.py @@ -522,7 +522,7 @@ def watch_log_for_death(self, nodes, from_mark=None, timeout=600, filename='syst the log is watched from the beginning. """ tofind = nodes if isinstance(nodes, list) else [nodes] - tofind = [f"{node.address()}.* now (dead|DOWN)" for node in tofind] + tofind = [f"({node.address()}|{node.hostid()}).* now (dead|DOWN)" for node in tofind] self.watch_log_for(tofind, from_mark=from_mark, timeout=timeout, filename=filename) def watch_log_for_alive(self, nodes, from_mark=None, timeout=120, filename='system.log'): @@ -531,7 +531,7 @@ def watch_log_for_alive(self, nodes, from_mark=None, timeout=120, filename='syst nodes are marked UP. This method works similarly to watch_log_for_death. """ tofind = nodes if isinstance(nodes, list) else [nodes] - tofind = [f"{node.address()}.* now UP" for node in tofind] + tofind = [f"({node.address()}|{node.hostid()}).* now UP" for node in tofind] self.watch_log_for(tofind, from_mark=from_mark, timeout=timeout, filename=filename) def wait_for_binary_interface(self, **kwargs):