cli: Also parse domain names when looking for container node

Previous implementation was searching only for IPv4 addresses when
selecting container nodes from Cluster. It also was only looking at
ClusterNodes which provide morph_chain, which is not always required to be
present on a storage node.

Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
This commit is contained in:
Vitaliy Potyarkin 2025-05-12 18:44:26 +03:00
parent 3a2e3a3f86
commit 974915c1ca

View file

@ -341,11 +341,13 @@ def search_nodes_with_container(
cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, wallet.config_path)
result = cli.container.search_node(rpc_endpoint=endpoint, cid=cid, timeout=timeout)
pattern = r"[0-9]+(?:\.[0-9]+){3}"
nodes_ip = list(set(re.findall(pattern, result.stdout)))
addrs = list(set(re.findall(r"(?<=/ip[46]/)[^/]+(?=/)", result.stdout)))
hostnames = list(set(re.findall(r"(?<=/dns[46]/)[^/]+(?=/)", result.stdout)))
with reporter.step(f"nodes ips = {nodes_ip}"):
nodes_list = cluster.get_nodes_by_ip(nodes_ip)
with reporter.step(f"Return nodes - {nodes_list}"):
return nodes_list
nodes = []
for node in cluster.cluster_nodes:
host = node.host.config
if host.address in addrs or host.hostname in hostnames:
nodes.append(node)
with reporter.step(f"Return nodes - {nodes}"):
return nodes