From 77dae13cba03b6c6692fd2debeae2fc224931b71 Mon Sep 17 00:00:00 2001 From: Ian Letourneau Date: Wed, 5 Nov 2025 17:46:07 -0500 Subject: [PATCH] fix(host_network): remove extra fields from bond config to prevent clashes --- harmony/src/infra/network_manager.rs | 4 +--- harmony/src/modules/okd/crd/nmstate.rs | 1 + harmony/src/modules/okd/host_network.rs | 2 +- harmony_types/src/net.rs | 10 +++++++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/harmony/src/infra/network_manager.rs b/harmony/src/infra/network_manager.rs index 5b1b825..484d6b0 100644 --- a/harmony/src/infra/network_manager.rs +++ b/harmony/src/infra/network_manager.rs @@ -135,8 +135,6 @@ impl OpenShiftNmStateNetworkManager { description: Some(format!("Member of bond {bond_name}")), r#type: nmstate::InterfaceType::Ethernet, state: "up".to_string(), - mtu: Some(switch_port.interface.mtu), - mac_address: Some(switch_port.interface.mac_address.to_string()), ipv4: Some(nmstate::IpStackSpec { enabled: Some(false), ..Default::default() @@ -162,7 +160,7 @@ impl OpenShiftNmStateNetworkManager { interfaces.push(nmstate::Interface { name: bond_name.to_string(), - description: Some(format!("Network bond for host {host}")), + description: Some(format!("HARMONY - Network bond for host {host}")), r#type: nmstate::InterfaceType::Bond, state: "up".to_string(), copy_mac_from, diff --git a/harmony/src/modules/okd/crd/nmstate.rs b/harmony/src/modules/okd/crd/nmstate.rs index f0eb4ae..3055766 100644 --- a/harmony/src/modules/okd/crd/nmstate.rs +++ b/harmony/src/modules/okd/crd/nmstate.rs @@ -417,6 +417,7 @@ pub struct EthernetSpec { #[serde(rename_all = "kebab-case")] pub struct BondSpec { pub mode: String, + #[serde(alias = "port")] pub ports: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub options: Option>, diff --git a/harmony/src/modules/okd/host_network.rs b/harmony/src/modules/okd/host_network.rs index 9d48035..33d1ef5 100644 --- a/harmony/src/modules/okd/host_network.rs +++ b/harmony/src/modules/okd/host_network.rs @@ -1,5 +1,5 @@ use async_trait::async_trait; -use harmony_types::id::Id; +use harmony_types::{id::Id, net::MacAddress, switch::PortLocation}; use log::{debug, info, warn}; use serde::Serialize; diff --git a/harmony_types/src/net.rs b/harmony_types/src/net.rs index 51de86e..6086e54 100644 --- a/harmony_types/src/net.rs +++ b/harmony_types/src/net.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)] pub struct MacAddress(pub [u8; 6]); impl MacAddress { @@ -19,6 +19,14 @@ impl From<&MacAddress> for String { } } +impl std::fmt::Debug for MacAddress { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_tuple("MacAddress") + .field(&String::from(self)) + .finish() + } +} + impl std::fmt::Display for MacAddress { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str(&String::from(self))