[bin/agent] Use MAC from Admin interface

Issue: https://mirantis.jira.com/browse/PRD-2165
Tested by hands.

Change-Id: I290f8348f70141cdf3f81416f571dd61ab931798
This commit is contained in:
Andrey Danin 2013-10-15 20:50:36 +04:00
parent 90f3da425e
commit fc2f834244
1 changed files with 16 additions and 0 deletions

View File

@ -364,6 +364,21 @@ class NodeAgent
nil
end
def _master_mac detailed_data
detailed_data.each do |k, v|
if k.to_s =~ /^interfaces$/
detailed_data[k].each do |i|
begin
net = IPAddr.new "#{i[:ip]}/#{i[:netmask]}"
return i[:mac] if net.include? @api_ip
rescue
end
end
end
end
nil
end
def _data
res = {
:mac => (@os[:macaddress] rescue nil),
@ -374,6 +389,7 @@ class NodeAgent
detailed_data = _detailed
res.merge!({
:ip => ((_master_ip detailed_data or @os[:ipaddress]) rescue nil),
:mac => ((_master_mac detailed_data or @os[:mac]) rescue nil),
:manufacturer => _manufacturer,
:platform_name => _product_name,
:meta => detailed_data