use crate::{BondConfig, BondInterface, BondOptions};
impl BondInterface {
pub(crate) fn update_bond(&mut self, other: &BondInterface) {
if let Some(bond_conf) = &mut self.bond {
bond_conf.update(other.bond.as_ref());
} else {
self.bond.clone_from(&other.bond);
}
}
}
impl BondConfig {
pub(crate) fn update(&mut self, other: Option<&BondConfig>) {
if let Some(other) = other {
if let Some(mode) = other.mode {
self.mode = Some(mode);
}
if let Some(self_opts) = self.options.as_mut() {
self_opts.update(other.options.as_ref());
} else {
self.options.clone_from(&other.options);
}
if let Some(port) = other.port.as_ref() {
self.port = Some(port.clone());
}
}
}
}
impl BondOptions {
pub(crate) fn update(&mut self, other: Option<&Self>) {
if let Some(other) = other {
if let Some(value) = other.balance_slb {
self.balance_slb = Some(value);
}
}
}
}