api2/network: add bond-primary parameter

needed for 'active-backup' bond mode

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2020-09-16 14:12:29 +02:00
committed by Dietmar Maurer
parent 36700a0a87
commit 85959a99ea
5 changed files with 55 additions and 4 deletions

View File

@ -67,6 +67,7 @@ impl Interface {
bridge_vlan_aware: None,
slaves: None,
bond_mode: None,
bond_primary: None,
}
}
@ -169,6 +170,11 @@ impl Interface {
NetworkInterfaceType::Bond => {
let mode = self.bond_mode.unwrap_or(LinuxBondMode::balance_rr);
writeln!(w, "\tbond-mode {}", bond_mode_to_str(mode))?;
if let Some(primary) = &self.bond_primary {
if mode == LinuxBondMode::active_backup {
writeln!(w, "\tbond-primary {}", primary)?;
}
}
let slaves = self.slaves.as_ref().unwrap_or(&EMPTY_LIST);
if slaves.is_empty() {