src/api2/config/network.rs: implement update/delete for bridge_ports and bond_slaves

This commit is contained in:
Dietmar Maurer
2020-04-23 11:21:27 +02:00
parent 339965d720
commit 5e4e88e83f
2 changed files with 37 additions and 2 deletions

View File

@ -101,6 +101,22 @@ impl Interface {
Ok(())
}
pub(crate) fn set_bridge_ports(&mut self, ports: Vec<String>) -> Result<(), Error> {
if self.interface_type != NetworkInterfaceType::Bridge {
bail!("interface '{}' is no bridge (type is {:?})", self.name, self.interface_type);
}
self.bridge_ports = Some(ports);
Ok(())
}
pub(crate) fn set_bond_slaves(&mut self, slaves: Vec<String>) -> Result<(), Error> {
if self.interface_type != NetworkInterfaceType::Bond {
bail!("interface '{}' is no bond (type is {:?})", self.name, self.interface_type);
}
self.bond_slaves = Some(slaves);
Ok(())
}
fn push_addon_option(&mut self, text: String) {
if self.method_v4.is_none() && self.method_v6.is_some() {
self.options_v6.push(text);