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