add_hw_component

Function add_hw_component 

Source
pub async fn add_hw_component(
    infra: &InfraContext<'_>,
    shasta_token: &str,
    target_group_name: &str,
    parent_group_name: &str,
    pattern: &str,
    dryrun: bool,
    create_group: bool,
) -> Result<AddHwResult, Error>
Expand description

Move enough nodes out of parent_group_name into target_group_name to add the components described by pattern (<component>:<delta> pairs) to the target.

The target group is created on demand when create_group is set; missing it otherwise yields NotFound. The parent group’s post-move hw component summary is computed up front so the algorithm can reject patterns that would over-draw the parent (InsufficientResources). Selection uses scarcity-weighted scores so common components get pulled first and rare ones are preserved. In dryrun mode the planned move is returned without any backend mutation.