Module node_ops

Module node_ops 

Source
Expand description

Node-expression resolution: parsing hostlist strings, NID-to-xname translation, HSM-group expansion, and the authorization helpers that validate the caller can act on the resolved set.

The functions here form the “front of the funnel” for any command that takes --xnames, --nids, or --hsm-group. The two entry points are:

  • from_user_hosts_expression_to_xname_vec(infra, token, expression, include_siblings) → sorted, deduplicated xname vec. Used by every command whose input is a free-form --xnames string.
  • resolve_target_nodes(infra, token, hosts_expression, group_name, settings_group_name) → xname vec via a 3-way priority cascade. Used by commands that accept either a hosts expression or a group name (kernel-parameters, boot-parameters, etc.).

§Expression grammar

A hosts expression is whatever [hostlist_parser::parse] accepts, restricted to one of these shapes after expansion:

  • NIDsnidNNNNNN, exactly 9 characters, e.g. nid000123. Hostlist notation expands to a list (nid[001-008] → eight NIDs). NIDs are translated to xnames by looking each short NID up in [ComponentTrait::get_node_metadata_available].
  • xnames — the full HPE Cray xname regex (x\d{4}c[0-7]s([0-9]|[1-5][0-9]|6[0-4])b[0-1]n[0-7]). Hostlist notation works here too (x1000c[0-7]s0b0n0).

Group names are not accepted by the hosts-expression path — they go through resolve_target_nodes’s group_name_arg_opt branch instead.

With is_include_siblings = true, every resolved xname is broadened to its blade prefix (first 10 chars: xNNNNcSsBb) and every node sharing that prefix is included.

Functions§

from_hosts_expression_to_xname_vec
Translates a ‘host expression’ into a list of xnames.
from_user_hosts_expression_to_xname_vec
Convenience wrapper that fetches node metadata from the backend and resolves a hosts expression to a sorted, deduplicated list of xnames.
get_curated_group_from_xname_hostlist
Group the supplied xnames by their parent HSM group.
get_xname_from_nid_hostlist
Resolve a NID hostlist expression to xnames by cross-referencing available node metadata.
get_xname_from_xname_hostlist
Filter available node metadata to only those xnames present in node_vec.
resolve_target_nodes
Resolve target nodes from either a hosts expression, an explicit HSM group name, or the settings-level HSM group.