[#251] Update get object nodes command call
Signed-off-by: a.berezin <a.berezin@yadro.com>
This commit is contained in:
parent
da16f3c3a5
commit
c9e4c2c7bb
2 changed files with 15 additions and 11 deletions
|
@ -362,6 +362,7 @@ class FrostfsCliObject(CliCommand):
|
||||||
trace: bool = False,
|
trace: bool = False,
|
||||||
root: bool = False,
|
root: bool = False,
|
||||||
verify_presence_all: bool = False,
|
verify_presence_all: bool = False,
|
||||||
|
json: bool = False,
|
||||||
ttl: Optional[int] = None,
|
ttl: Optional[int] = None,
|
||||||
xhdr: Optional[dict] = None,
|
xhdr: Optional[dict] = None,
|
||||||
timeout: Optional[str] = None,
|
timeout: Optional[str] = None,
|
||||||
|
|
|
@ -722,21 +722,27 @@ def get_object_nodes(
|
||||||
|
|
||||||
cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, wallet_config)
|
cli = FrostfsCli(shell, FROSTFS_CLI_EXEC, wallet_config)
|
||||||
|
|
||||||
result_object_nodes = cli.object.nodes(
|
response = cli.object.nodes(
|
||||||
rpc_endpoint=endpoint,
|
rpc_endpoint=endpoint,
|
||||||
cid=cid,
|
cid=cid,
|
||||||
oid=oid,
|
oid=oid,
|
||||||
bearer=bearer,
|
bearer=bearer,
|
||||||
ttl=1 if is_direct else None,
|
ttl=1 if is_direct else None,
|
||||||
|
json=True,
|
||||||
xhdr=xhdr,
|
xhdr=xhdr,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
verify_presence_all=verify_presence_all,
|
verify_presence_all=verify_presence_all,
|
||||||
)
|
)
|
||||||
|
|
||||||
parsing_output = parse_cmd_table(result_object_nodes.stdout, "|")
|
response_json = json.loads(response.stdout)
|
||||||
list_object_nodes = [
|
# Currently, the command will show expected and confirmed nodes.
|
||||||
node for node in parsing_output if node["should_contain_object"] == "true" and node["actually_contains_object"] == "true"
|
# And we (currently) count only nodes which are both expected and confirmed
|
||||||
]
|
object_nodes_id = {
|
||||||
|
required_node
|
||||||
|
for data_object in response_json["data_objects"]
|
||||||
|
for required_node in data_object["required_nodes"]
|
||||||
|
if required_node in data_object["confirmed_nodes"]
|
||||||
|
}
|
||||||
|
|
||||||
netmap_nodes_list = parse_netmap_output(
|
netmap_nodes_list = parse_netmap_output(
|
||||||
cli.netmap.snapshot(
|
cli.netmap.snapshot(
|
||||||
|
@ -745,14 +751,11 @@ def get_object_nodes(
|
||||||
).stdout
|
).stdout
|
||||||
)
|
)
|
||||||
netmap_nodes = [
|
netmap_nodes = [
|
||||||
netmap_node
|
netmap_node for object_node in object_nodes_id for netmap_node in netmap_nodes_list if object_node == netmap_node.node_id
|
||||||
for object_node in list_object_nodes
|
|
||||||
for netmap_node in netmap_nodes_list
|
|
||||||
if object_node["node_id"] == netmap_node.node_id
|
|
||||||
]
|
]
|
||||||
|
|
||||||
result = [
|
object_nodes = [
|
||||||
cluster_node for netmap_node in netmap_nodes for cluster_node in cluster.cluster_nodes if netmap_node.node == cluster_node.host_ip
|
cluster_node for netmap_node in netmap_nodes for cluster_node in cluster.cluster_nodes if netmap_node.node == cluster_node.host_ip
|
||||||
]
|
]
|
||||||
|
|
||||||
return result
|
return object_nodes
|
||||||
|
|
Loading…
Reference in a new issue