Skip to content

Commit

Permalink
refactor: refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Sopena Ballesteros committed Jan 10, 2024
1 parent 824cfee commit ac09457
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/cli/commands/add_hw_component_cluster.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, process::exit, sync::Arc, time::Instant};
use std::{collections::HashMap, sync::Arc, time::Instant};

use comfy_table::Color;
use dialoguer::{theme::ColorfulTheme, Confirm};
Expand Down Expand Up @@ -166,7 +166,7 @@ pub async fn exec(
// *********************************************************************************************************
// PREPARE INFORMATION TO SHOW

let mut nodes_moved_from_parent_hsm = hw_component_counters_moved_from_parent_hsm
let nodes_moved_from_parent_hsm = hw_component_counters_moved_from_parent_hsm
.iter()
.map(|(xname, _)| xname)
.cloned()
Expand Down Expand Up @@ -210,6 +210,8 @@ pub async fn exec(

log::info!("----- SOLUTION -----");

log::info!("Hw components in HSM '{}'", parent_hsm_group_name);

/* log::info!("Hw components in HSM '{}'", target_hsm_group_name);
let hw_configuration_table = crate::cli::commands::get_hw_configuration_cluster::get_table(
Expand Down
17 changes: 9 additions & 8 deletions src/cli/commands/apply_hw_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::{collections::HashMap, sync::Arc, time::Instant};
use tokio::sync::Semaphore;

use crate::cli::commands::apply_hw_cluster::utils::{
calculate_all_deltas, calculate_hsm_hw_component_count,
calculate_hsm_hw_component_count,
calculate_hsm_hw_component_normalized_density_score_from_hsm_node_hw_component_count_vec,
calculate_hsm_total_number_hw_components, get_hsm_hw_component_count_filtered_by_user_request,
get_node_hw_component_count, upscale_node_migration,
get_node_hw_component_count,
};

pub async fn exec(
Expand Down Expand Up @@ -359,12 +359,13 @@ pub async fn exec(
// FIND NODES TO MOVE FROM PARENT TO TARGET HSM GROUP

// Migrate nodes
let hw_component_counters_to_move_out_from_target_parent_hsm = crate::cli::commands::remove_hw_component_cluster::downscale_node_migration(
&user_defined_target_hsm_hw_component_count_hashmap,
&user_defined_target_hsm_hw_component_vec,
&mut target_parent_hsm_node_hw_component_count_vec,
&target_parent_hsm_hw_component_normalized_scores_hashmap,
);
let hw_component_counters_to_move_out_from_target_parent_hsm =
crate::cli::commands::remove_hw_component_cluster::downscale_node_migration(
&user_defined_target_hsm_hw_component_count_hashmap,
&user_defined_target_hsm_hw_component_vec,
&mut target_parent_hsm_node_hw_component_count_vec,
&target_parent_hsm_hw_component_normalized_scores_hashmap,
);

// *********************************************************************************************************
// PREPARE INFORMATION TO SHOW
Expand Down
1 change: 1 addition & 0 deletions src/cli/commands/get_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub async fn exec(
output_opt: Option<&String>,
status: bool,
) {

// Take all nodes for all hsm_groups found and put them in a Vec
let mut hsm_groups_node_list: Vec<String> =
hsm::group::shasta::utils::get_member_vec_from_hsm_name_vec(
Expand Down

0 comments on commit ac09457

Please sign in to comment.