Merge pull request #351 from packethost/bond-config-options
Bond options persisted to the generated netdev file.
This commit is contained in:
commit
1063a4b9ee
@ -130,7 +130,17 @@ type bondInterface struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *bondInterface) Netdev() string {
|
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 {
|
func (b *bondInterface) Type() string {
|
||||||
|
@ -52,7 +52,7 @@ func TestInterfaceGenerators(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "testname",
|
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",
|
network: "[Match]\nName=testname\n\n[Network]\nBond=testbond1\nVLAN=testvlan1\nVLAN=testvlan2\nDHCP=true\n",
|
||||||
kind: "bond",
|
kind: "bond",
|
||||||
iface: &bondInterface{logicalInterface: logicalInterface{
|
iface: &bondInterface{logicalInterface: logicalInterface{
|
||||||
|
Loading…
Reference in New Issue
Block a user