app/models/manageiq/providers/lenovo/physical_infra_manager/parser/physical_server_parser.rb
#
# parse a node object to a hash with physical servers data
#
# @param [Hash] node_hash - hash containing physical server raw data
# @param [Hash] rack - parsed physical rack data
# @param [Hash] chassis - parsed physical chassis data
#
# @return [Hash] containing the physical server information
#
parse a node object to a hash with physical servers data
parse a node object to a hash with physical servers data
def parse_physical_server(node_hash, compliance, rack = nil, chassis = nil)
        node = XClarityClient::Node.new(node_hash)
        result = parse(node, parent::ParserDictionaryConstants::PHYSICAL_SERVER)
        result[:physical_rack]              = rack if rack
        result[:physical_chassis]           = chassis if chassis
        result[:ems_compliance_name]        = compliance[:policy_name]
        result[:ems_compliance_status]      = compliance[:status]
        result[:vendor]                     = "lenovo"
        result[:type]                       = parent::ParserDictionaryConstants::MIQ_TYPES["physical_server"]
        result[:power_state]                = parent::ParserDictionaryConstants::POWER_STATE_MAP[node.powerStatus]
        result[:health_state]               = parent::ParserDictionaryConstants::HEALTH_STATE_MAP[node.cmmHealthState.nil? ? node.cmmHealthState : node.cmmHealthState.downcase]
        result[:host]                       = get_host_relationship(node.serialNumber)
        result[:location_led_state]         = find_loc_led_state(node.leds)
        result[:computer_system][:hardware] = get_hardwares(node)
        result
      end
def parse_physical_server ( node_hash , compliance , rack = nil , chassis = nil ) node = XClarityClient :: Node . new ( node_hash ) result = parse ( node , parent :: ParserDictionaryConstants :: PHYSICAL_SERVER ) result [ :physical_rack ] = rack if rack result [ :physical_chassis ] = chassis if chassis result [ :ems_compliance_name ] = compliance [ :policy_name ] result [ :ems_compliance_status ] = compliance [ :status ] result [ :vendor ] = "lenovo" result [ :type ] = parent :: ParserDictionaryConstants :: MIQ_TYPES [ "physical_server" ] result [ :power_state ] = parent :: ParserDictionaryConstants :: POWER_STATE_MAP [ node . powerStatus ] result [ :health_state ] = parent :: ParserDictionaryConstants :: HEALTH_STATE_MAP [ node . cmmHealthState . nil? ? node . cmmHealthState : node . cmmHealthState . downcase ] result [ :host ] = get_host_relationship ( node . serialNumber ) result [ :location_led_state ] = find_loc_led_state ( node . leds ) result [ :computer_system ] [ :hardware ] = get_hardwares ( node ) result end
parse a node object to a hash with physical servers data
parse a node object to a hash with physical servers data
# Keep track of the rack where this server is in, if it is in any rack
containing the physical server information
containing the physical server information
Hash
node_hash
compliance
rack
chassis
parsed physical chassis data
parsed physical chassis data