Persisting bond options to the netdev file, and updating the test.

This commit is contained in:
Sam Tresler 2015-06-23 11:21:26 -04:00
parent 41289286ca
commit 081f77a102
2 changed files with 12 additions and 2 deletions

View File

@ -130,7 +130,17 @@ type bondInterface struct {
}
func (b *bondInterface) Netdev() string {
return fmt.Sprintf("[NetDev]\nKind=bond\nName=%s\n", b.name)
config := fmt.Sprintf("[NetDev]\nKind=bond\nName=%s\n", b.name)
if b.hwaddr != nil {
config += fmt.Sprintf("MACAddress=%s\n", b.hwaddr.String())
}
config += fmt.Sprintf("\n[Bond]\n")
for _, name := range sortedKeys(b.options) {
config += fmt.Sprintf("%s=%s\n", name, b.options[name])
}
return config
}
func (b *bondInterface) Type() string {

View File

@ -52,7 +52,7 @@ func TestInterfaceGenerators(t *testing.T) {
},
{
name: "testname",
netdev: "[NetDev]\nKind=bond\nName=testname\n",
netdev: "[NetDev]\nKind=bond\nName=testname\n\n[Bond]\n",
network: "[Match]\nName=testname\n\n[Network]\nBond=testbond1\nVLAN=testvlan1\nVLAN=testvlan2\nDHCP=true\n",
kind: "bond",
iface: &bondInterface{logicalInterface: logicalInterface{