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

Add power_state,health_state and vendor properties in parse #40

Merged
merged 3 commits into from
Apr 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ module ManageIQ::Providers::Lenovo
class PhysicalInfraManager::RefreshParser < EmsRefresh::Parsers::Infra
include ManageIQ::Providers::Lenovo::RefreshHelperMethods

POWER_STATE_MAP = {
8 => "on",
5 => "off",
18 => "Standby",
0 => "Unknown"
}.freeze

HEALTH_STATE_MAP = {
"normal" => "Valid",
"non-critical" => "Valid",
"warning" => "Warning",
"critical" => "Critical",
"unknown" => "None",
"minor-failure" => "Critical",
"major-failure" => "Critical",
"non-recoverable" => "Critical",
"fatal" => "Critical"
}.freeze

def initialize(ems, options = nil)
ems_auth = ems.authentications.first

Expand Down Expand Up @@ -76,6 +95,9 @@ def parse_physical_server(node)
:model => node.model,
:serial_number => node.serialNumber,
:field_replaceable_unit => node.FRU,
:power_state => POWER_STATE_MAP[node.powerStatus],
:health_state => HEALTH_STATE_MAP[node.cmmHealthState.downcase],
:vendor => "Lenovo",
:computer_system => {
:hardware => {
:networks => [],
Expand Down