Compare commits

...

1 Commits

Author SHA1 Message Date
063a4d4f5c wip: improving inventory discovery 2026-03-04 07:18:20 -05:00
2 changed files with 7 additions and 4 deletions

View File

@@ -11,7 +11,7 @@ async fn main() {
role: HostRole::Worker, role: HostRole::Worker,
number_desired_hosts: 3, number_desired_hosts: 3,
discovery_strategy: HarmonyDiscoveryStrategy::SUBNET { discovery_strategy: HarmonyDiscoveryStrategy::SUBNET {
cidr: cidrv4!("192.168.0.1/25"), cidr: cidrv4!("192.168.2.0/24"),
port: 25000, port: 25000,
}, },
}; };
@@ -20,7 +20,7 @@ async fn main() {
role: HostRole::ControlPlane, role: HostRole::ControlPlane,
number_desired_hosts: 3, number_desired_hosts: 3,
discovery_strategy: HarmonyDiscoveryStrategy::SUBNET { discovery_strategy: HarmonyDiscoveryStrategy::SUBNET {
cidr: cidrv4!("192.168.0.1/25"), cidr: cidrv4!("192.168.2.0/24"),
port: 25000, port: 25000,
}, },
}; };
@@ -28,7 +28,8 @@ async fn main() {
harmony_cli::run( harmony_cli::run(
Inventory::autoload(), Inventory::autoload(),
LocalhostTopology::new(), LocalhostTopology::new(),
vec![Box::new(discover_worker), Box::new(discover_control_plane)], vec![Box::new(discover_worker)],
//vec![Box::new(discover_worker), Box::new(discover_control_plane)],
None, None,
) )
.await .await

View File

@@ -45,7 +45,7 @@ impl<T: Topology> Interpret<T> for DiscoverHostForRoleInterpret {
topology: &T, topology: &T,
) -> Result<Outcome, InterpretError> { ) -> Result<Outcome, InterpretError> {
info!( info!(
"Launching discovery agent, make sure that your nodes are successfully PXE booted and running inventory agent. They should answer on `http://<node_ip>:8080/inventory`" "Launching discovery agent, make sure that your nodes are successfully PXE booted and running inventory agent. They should answer on `http://<node_ip>:25000/inventory`"
); );
LaunchDiscoverInventoryAgentScore { LaunchDiscoverInventoryAgentScore {
discovery_timeout: None, discovery_timeout: None,
@@ -58,6 +58,8 @@ impl<T: Topology> Interpret<T> for DiscoverHostForRoleInterpret {
let host_repo = InventoryRepositoryFactory::build().await?; let host_repo = InventoryRepositoryFactory::build().await?;
let mut assigned_hosts = 0; let mut assigned_hosts = 0;
// let hosts_for_role = host_repo.get_hosts_for_role(&self.score.role);
loop { loop {
let all_hosts = host_repo.get_all_hosts().await?; let all_hosts = host_repo.get_all_hosts().await?;