Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associate ph server to host #37

Merged
merged 12 commits into from
May 4, 2017
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ def parse_physical_server(node)
:model => node.model,
:serial_number => node.serialNumber,
:field_replaceable_unit => node.FRU,
:computer_system => {:hardware => {:networks => [], :firmwares => []}},
:host => get_host_relationship(node),
:power_state => POWER_STATE_MAP[node.powerStatus],
:health_state => HEALTH_STATE_MAP[node.cmmHealthState.downcase],
:vendor => "Lenovo",
Expand All @@ -129,6 +131,12 @@ def parse_physical_server(node)
return node.uuid, new_result
end

def get_host_relationship(node)
# Assign a physicalserver and host if server already exists and
# some host match with physical Server's serial number
Host.find_by(:service_tag => node.serialNumber)
end

def all_server_resources
return @all_server_resources if @all_server_resources

Expand Down