Class: Construqt::Flavour::Ubuntu::Bond

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/construqt/flavour/ubuntu/flavour_ubuntu.rb

Instance Method Summary collapse

Constructor Details

#initialize(cfg) ⇒ Bond

Returns a new instance of Bond.



90
91
92
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu.rb', line 90

def initialize(cfg)
  super(cfg)
end

Instance Method Details

#build_config(host, bond) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu.rb', line 94

def build_config(host, bond)
  bond_delegate = bond.delegate
  bond_delegate.interfaces.each do |i|
    host.result.etc_network_interfaces.get(i).lines.add("bond-master #{bond_delegate.name}")
  end

  mac_address = bond_delegate.mac_address || Construqt::Util.generate_mac_address_from_name("#{host.name} #{bond_delegate.name}")
  host.result.etc_network_interfaces.get(bond_delegate).lines.add(<<BOND)
pre-up ip link set dev #{bond_delegate.name} mtu #{bond_delegate.mtu} address #{mac_address}
bond-mode #{bond_delegate.mode||'active-backup'}
bond-miimon 100
bond-lacp-rate 1
bond-slaves none
BOND
  Device.build_config(host, bond)
end