Return original interface mac

In order to prevent nailgun get inconsistent network configuration in
case of interface bonding mode return original mac address.

Change-Id: Ib0a5c86484d86bf07098a51de87baae931db66ec
Closes-Bug: #1496279
This commit is contained in:
Michael Polenchuk 2015-09-16 12:40:15 +03:00
parent abab45cf8c
commit e623c89f94
1 changed files with 8 additions and 1 deletions

9
agent
View File

@ -278,7 +278,14 @@ class NodeAgent
int_meta[:state] = intinfo[:state]
(intinfo[:addresses] or {} rescue {}).each do |addr, addrinfo|
if (addrinfo[:family] rescue nil) =~ /lladdr/
int_meta[:mac] = addr
# Get original mac excluding case with empty EEPROM data
perm_addr = `ethtool -P #{int}`
begin
re = eval '/(?<=Permanent address: )(?!00(:00){5}).+/'
rescue SyntaxError
re = perm_addr.match(/(00(:00){5})+/).nil? ? /[0-9a-f]+(:[0-9a-f]+){5}$/ : nil
end
int_meta[:mac] = perm_addr.match(re)[0] rescue addr
int_meta[:pxe] = admin_mac == int_meta[:mac]
begin
int_info = Rethtool::InterfaceSettings.new(int)