src/config/network.rs: always write bridge_ports and bond_slaves
So that we can reliable detect the interface type.
This commit is contained in:
parent
86a5d56c4e
commit
db5672e83e
|
@ -142,31 +142,31 @@ impl Interface {
|
||||||
/// Write attributes not dependening on address family
|
/// Write attributes not dependening on address family
|
||||||
fn write_iface_attributes(&self, w: &mut dyn Write) -> Result<(), Error> {
|
fn write_iface_attributes(&self, w: &mut dyn Write) -> Result<(), Error> {
|
||||||
|
|
||||||
|
static EMPTY_LIST: Vec<String> = Vec::new();
|
||||||
|
|
||||||
match self.interface_type {
|
match self.interface_type {
|
||||||
NetworkInterfaceType::Bridge => {
|
NetworkInterfaceType::Bridge => {
|
||||||
if let Some(true) = self.bridge_vlan_aware {
|
if let Some(true) = self.bridge_vlan_aware {
|
||||||
writeln!(w, "\tbridge-vlan-aware yes")?;
|
writeln!(w, "\tbridge-vlan-aware yes")?;
|
||||||
}
|
}
|
||||||
if let Some(ref ports) = self.bridge_ports {
|
let ports = self.bridge_ports.as_ref().unwrap_or(&EMPTY_LIST);
|
||||||
if ports.is_empty() {
|
if ports.is_empty() {
|
||||||
writeln!(w, "\tbridge-ports none")?;
|
writeln!(w, "\tbridge-ports none")?;
|
||||||
} else {
|
} else {
|
||||||
writeln!(w, "\tbridge-ports {}", ports.join(" "))?;
|
writeln!(w, "\tbridge-ports {}", ports.join(" "))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
NetworkInterfaceType::Bond => {
|
NetworkInterfaceType::Bond => {
|
||||||
let mode = self.bond_mode.unwrap_or(LinuxBondMode::balance_rr);
|
let mode = self.bond_mode.unwrap_or(LinuxBondMode::balance_rr);
|
||||||
writeln!(w, "\tbond-mode {}", bond_mode_to_str(mode))?;
|
writeln!(w, "\tbond-mode {}", bond_mode_to_str(mode))?;
|
||||||
|
|
||||||
if let Some(ref slaves) = self.slaves {
|
let slaves = self.slaves.as_ref().unwrap_or(&EMPTY_LIST);
|
||||||
if slaves.is_empty() {
|
if slaves.is_empty() {
|
||||||
writeln!(w, "\tbond-slaves none")?;
|
writeln!(w, "\tbond-slaves none")?;
|
||||||
} else {
|
} else {
|
||||||
writeln!(w, "\tbond-slaves {}", slaves.join(" "))?;
|
writeln!(w, "\tbond-slaves {}", slaves.join(" "))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue