Skip to content

Commit df2fc21

Browse files
refactor(machine): separate Machine fields into config/status sub-messages
Add `MachineConfig` and `MachineStatus` to `forge.Machine` and the corresponding structs to `carbide-api-model`. Protobuf Changes: - Add `MachineConfig` for operator-set desired state (maintenance, instance-type assignment, firmware policy, DPF toggle). - Add `MachineStatus` for system-observed state. - Populate both in the `From<Machine>` RPC conversion while keeping all original flat fields as `[deprecated = true]` aliases so rest-api consumers are unaffected until a follow-up PR migrates them. See #2793 - Add `LifecycleStatus lifecycle` to `MachineStatus`, making machines consistent with Rack, Switch, VPC, and every other managed resource type that already carries a structured lifecycle sub-message. Ingestion-time fields (`rack_id`, `hw_sku`, `placement_in_rack`, `bmc_info`, `machine_type`, `inventory`) are set once from the expected-machine record or hardware topology and are not operator-mutable. They remain as non-deprecated `Machine` fields rather than being placed in `MachineConfig` or `MachineStatus`. api-model changes: - Extract `MachineConfig` (`config.rs`) and `MachineStatus` (`status.rs`) from the flat `Machine` struct; all internal call-sites updated to `machine.config.X` / `machine.status.X`. - `rack_id`, `hw_sku`, and `placement_in_rack` stay as direct fields on `Machine` — not in `MachineConfig` Other changes: * Pre-compute `rpc_state`, `rpc_state_version`, and `rpc_state_reason` in `From<Machine>` so they are shared between the deprecated fields and the new `status.lifecycle` without repeating the derivation. Mirror each into the `status` sub-message so both paths stay in sync: `status.health` and `status.lifecycle.sla`alongside `health`/`state_sla` on the host path; `status.associated_host_machine_id` and `status.lifecycle.sla` alongside the flat fields on the DPU path.
1 parent 874659f commit df2fc21

98 files changed

Lines changed: 1680 additions & 651 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/admin-cli/src/debug_bundle/cmds.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ struct MachineAnalysis {
580580
}
581581

582582
/// Helper function to get BMC IP and MAC address from machine_id
583+
#[allow(deprecated)]
583584
async fn get_bmc_ip_from_host_id(
584585
api_client: &ApiClient,
585586
host_id: &str,
@@ -1698,6 +1699,7 @@ impl<'a> ZipBundleCreator<'a> {
16981699
Ok(())
16991700
}
17001701

1702+
#[allow(deprecated)]
17011703
fn add_machine_analysis_json(
17021704
&self,
17031705
zip: &mut ZipWriter<File>,
@@ -1801,6 +1803,7 @@ impl<'a> ZipBundleCreator<'a> {
18011803
}
18021804

18031805
#[allow(clippy::too_many_arguments)]
1806+
#[allow(deprecated)]
18041807
fn add_metadata(
18051808
&self,
18061809
zip: &mut ZipWriter<File>,

crates/admin-cli/src/dpu/network/cmd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ pub async fn show_dpu_network_config(
196196
Ok(())
197197
}
198198

199+
#[allow(deprecated)]
199200
pub async fn show_dpu_status(
200201
api_client: &ApiClient,
201202
output_file: &mut Box<dyn tokio::io::AsyncWrite + Unpin>,

crates/admin-cli/src/dpu/reprovision/cmd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub async fn reprovision(api_client: &ApiClient, reprov: Args) -> CarbideCliResu
4848
}
4949
}
5050

51+
#[allow(deprecated)]
5152
async fn apply_health_report(
5253
api_client: &ApiClient,
5354
id: carbide_uuid::machine::MachineId,

crates/admin-cli/src/dpu/status/cmd.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct DpuStatus {
4545
}
4646

4747
impl From<Machine> for DpuStatus {
48+
#[allow(deprecated)]
4849
fn from(machine: Machine) -> Self {
4950
let state = match machine.state.split_once(' ') {
5051
Some((state, _)) => state.to_owned(),
@@ -105,6 +106,7 @@ impl From<DpuStatus> for Row {
105106
}
106107
}
107108

109+
#[allow(deprecated)]
108110
pub fn get_dpu_version_status(build_info: &BuildInfo, machine: &Machine) -> String {
109111
let mut version_statuses = Vec::default();
110112

crates/admin-cli/src/dpu/versions/cmd.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct DpuVersions {
5858
}
5959

6060
impl From<Machine> for DpuVersions {
61+
#[allow(deprecated)]
6162
fn from(machine: Machine) -> Self {
6263
let state = match machine.state.split_once(' ') {
6364
Some((state, _)) => state.to_owned(),
@@ -144,6 +145,7 @@ pub fn generate_firmware_status_table(machines: Vec<Machine>) -> Box<Table> {
144145
Box::new(table)
145146
}
146147

148+
#[allow(deprecated)]
147149
pub async fn handle_dpu_versions(
148150
output_file: &mut Box<dyn tokio::io::AsyncWrite + Unpin>,
149151
output_format: OutputFormat,

crates/admin-cli/src/host/reprovision/cmd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use crate::errors::{CarbideCliError, CarbideCliResult};
2424
use crate::machine::{HealthReportTemplates, get_health_report};
2525
use crate::rpc::ApiClient;
2626

27+
#[allow(deprecated)]
2728
pub async fn trigger_reprovisioning_set(
2829
data: ReprovisionSet,
2930
api_client: &ApiClient,

crates/admin-cli/src/inventory/cmds.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ struct DpuMachineInfo<'a> {
8888
}
8989

9090
/// Generate element containing all information needed to write a Machine Host.
91+
#[allow(deprecated)]
9192
fn get_host_machine_info<'a>(
9293
machines: &'a [&'a ::rpc::Machine],
9394
) -> HashMap<&'a str, HostMachineInfo<'a>> {
@@ -127,6 +128,7 @@ fn get_host_machine_info<'a>(
127128
}
128129

129130
/// Generate element containing all information needed to write a Machine Host.
131+
#[allow(deprecated)]
130132
fn get_dpu_machine_info<'a>(
131133
machines: &'a [&'a ::rpc::Machine],
132134
) -> HashMap<&'a str, DpuMachineInfo<'a>> {
@@ -153,6 +155,7 @@ fn get_dpu_machine_info<'a>(
153155
}
154156

155157
/// Generate element containing all information needed to write a BMC Host.
158+
#[allow(deprecated)]
156159
fn get_bmc_info<'a>(
157160
machines: &[&'a ::rpc::Machine],
158161
managed_hosts: &'a [ExploredManagedHost],
@@ -330,6 +333,7 @@ type CreateInventoryReturnType<'a> = (
330333
);
331334

332335
/// Generate inventory item for instances.
336+
#[allow(deprecated)]
333337
fn create_inventory_for_instances<'a>(
334338
instances: &'a InstanceList,
335339
machines: &'a MachineList,

crates/admin-cli/src/machine/hardware_info/cmd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub async fn handle_update_machine_hardware_info_gpus(
4242
.await
4343
}
4444

45+
#[allow(deprecated)]
4546
pub async fn handle_show_machine_hardware_info(
4647
api_client: &ApiClient,
4748
output_file: &mut Box<dyn tokio::io::AsyncWrite + Unpin>,

crates/admin-cli/src/machine/metadata/cmd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ pub async fn metadata_remove_labels(
117117
Ok(())
118118
}
119119

120+
#[allow(deprecated)]
120121
pub async fn metadata_from_expected_machine(
121122
api_client: &ApiClient,
122123
cmd: MachineMetadataCommandFromExpectedMachine,

crates/admin-cli/src/machine/nvlink_info/cmd.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use super::args::{NvlinkInfoArgs, NvlinkInfoPopulateArgs};
2222
use crate::errors::{CarbideCliError, CarbideCliResult};
2323
use crate::rpc::ApiClient;
2424

25+
#[allow(deprecated)]
2526
pub async fn handle_nvlink_info_show(
2627
args: NvlinkInfoArgs,
2728
api_client: &ApiClient,
@@ -58,6 +59,7 @@ pub async fn handle_nvlink_info_show(
5859
Ok(())
5960
}
6061

62+
#[allow(deprecated)]
6163
pub async fn handle_nvlink_info_populate(
6264
args: NvlinkInfoPopulateArgs,
6365
_output_format: OutputFormat,

0 commit comments

Comments
 (0)