Project

General

Profile

« Previous | Next » 

Revision a0f78f20

Added by Marek Hulán almost 9 years ago

Fixes #10607 - match bonds based on identifier only

(cherry picked from commit 7be20b248502eb8682008e1c6b03fef71da4f73d)

View differences:

test/unit/host_test.rb
assert_equal 'eth1', virtual.attached_to
end
test "#set_interfaces matches bonds based on identifier and even updates its mac" do
# interface with empty identifier was renamed to eth5 (same MAC)
host = FactoryGirl.create(:host, :hostgroup => FactoryGirl.create(:hostgroup), :mac => '00:00:00:11:22:33')
hash = { :bond0 => {:macaddress => 'aa:bb:cc:44:55:66', :ipaddress => '10.10.0.3', :virtual => true},
:eth5 => {:macaddress => '00:00:00:11:22:33', :ipaddress => '10.10.0.1', :virtual => false, :identifier => 'eth5'},
}.with_indifferent_access
parser = stub(:interfaces => hash, :ipmi_interface => {}, :suggested_primary_interface => hash.to_a.first)
bond0 = FactoryGirl.create(:nic_bond, :host => host, :mac => '00:00:00:44:55:66', :ip => '10.10.0.2', :identifier => 'bond0')
host.set_interfaces(parser)
host.interfaces.reload
assert_equal 1, host.interfaces.bonds.size
bond0.reload
assert_equal 'aa:bb:cc:44:55:66', bond0.mac
assert_equal '10.10.0.3', bond0.ip
end
test "#set_interfaces updates associated virtuals identifier on identifier change mutualy exclusively" do
# eth4 was renamed to eth5 and eth5 renamed to eth4
host = FactoryGirl.create(:host, :hostgroup => FactoryGirl.create(:hostgroup))

Also available in: Unified diff