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.



100
101
102
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu.rb', line 100

def initialize(cfg)
  super(cfg)
end

Instance Method Details

#build_config(host, bond) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu.rb', line 104

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