-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from EsdrasVP/parse_physical_storage
Parse Physical Storage
- Loading branch information
Showing
9 changed files
with
687 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...models/manageiq/providers/lenovo/physical_infra_manager/parser/physical_storage_parser.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module ManageIQ::Providers::Lenovo | ||
class PhysicalInfraManager::Parser::PhysicalStorageParser < PhysicalInfraManager::Parser::ComponentParser | ||
class << self | ||
# | ||
# Parse a storage into a hash | ||
# | ||
# @param [Hash] storage_hash - hash containing physical storage raw data | ||
# @param [Hash] rack - parsed physical rack data | ||
# | ||
# @return [Hash] containing the physical storage information | ||
# | ||
def parse_physical_storage(storage_hash, rack) | ||
storage = XClarityClient::Storage.new(storage_hash) | ||
result = parse(storage, parent::ParserDictionaryConstants::PHYSICAL_STORAGE) | ||
|
||
result[:physical_rack] = rack if rack | ||
result[:type] = parent::ParserDictionaryConstants::MIQ_TYPES["physical_storage"] | ||
result[:health_state] = parent::ParserDictionaryConstants::HEALTH_STATE_MAP[storage.cmmHealthState.nil? ? storage.cmmHealthState : storage.cmmHealthState.downcase] | ||
result[:computer_system][:hardware] = get_hardwares(storage) | ||
|
||
return storage.uuid, result | ||
end | ||
|
||
private | ||
|
||
def get_hardwares(storage) | ||
parsed_storage_network = parse(storage, parent::ParserDictionaryConstants::PHYSICAL_STORAGE_NETWORK) | ||
|
||
{ | ||
:guest_devices => [{ | ||
:device_type => "management", | ||
:network => parsed_storage_network | ||
}] | ||
} | ||
end | ||
end | ||
end | ||
end |
4 changes: 4 additions & 0 deletions
4
app/models/manageiq/providers/lenovo/physical_infra_manager/physical_storage.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module ManageIQ::Providers | ||
class Lenovo::PhysicalInfraManager::PhysicalStorage < ::PhysicalStorage | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.