migrate_nodes

Function migrate_nodes 

Source
pub async fn migrate_nodes(
    infra: &InfraContext<'_>,
    token: &str,
    target_group_name_vec: &[String],
    parent_group_name_vec: &[String],
    hosts_expression: &str,
    dry_run: bool,
    create_group: bool,
) -> Result<(Vec<String>, Vec<NodeMigrationResult>), Error>
Expand description

Move the nodes resolved from hosts_expression out of any group in parent_name_vec and into every group in target_group_name_vec.

The xname set is curated through node_ops::get_curated_group_from_xname_hostlist and then filtered to the requested parents — nodes that don’t currently belong to one of those parents are silently skipped, which keeps the call idempotent when the user passes the same expression twice. Each target_name is required to exist unless create_group is true (in dry-run mode the missing-group case is reported as a BadRequest so the operator sees what would have been created). Returns the moved xnames and one NodeMigrationResult per (target, parent) pair, with both membership lists sorted for stable rendering.