Class: Sas2ircu::Card
- Inherits:
-
Object
- Object
- Sas2ircu::Card
- Defined in:
- lib/disk_reporter/sas2ircu_parser.rb
Constant Summary collapse
- CARD_REGEX =
/\s{3}Enclosure#\s+:\s(\d+)\s{3}Logical ID\s+:\s([0-9a-f]+:[0-9a-f]+)\s{3}Numslots\s+:\s(\d+)\s{3}StartSlot\s+:\s(\d+)/.freeze
- BACKPLANE_REGEX =
/Device is a Hard disk\s{3}Enclosure #\s+:\s(\d+)\s{3}Slot #\s+:\s(\d+)\s{3}SAS Address\s+:\s([a-f0-9\-]+)\s{3}State\s+:\s(.+)\s{3}Size \(in MB\)\/\(in sectors\)\s+:\s([0-9]+)\/([0-9]+)\s{3}Manufacturer\s+:\s(.+)\s{3}Model Number\s+:\s(.+)\s{3}Firmware Revision\s+:\s(.+)\s{3}Serial No\s+:\s(.+)\s{3}GUID\s+:\s([0-9a-f]+)\s+Protocol\s+:\s(.+)\s{3}Drive Type\s+:\s(.+)/.freeze
Instance Attribute Summary collapse
-
#backplanes ⇒ Object
Returns the value of attribute backplanes.
-
#drives_by_serial ⇒ Object
Returns the value of attribute drives_by_serial.
-
#drives_by_wnn ⇒ Object
Returns the value of attribute drives_by_wnn.
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(id) ⇒ Card
constructor
A new instance of Card.
- #to_h ⇒ Object
Constructor Details
#initialize(id) ⇒ Card
Returns a new instance of Card.
11 12 13 14 15 16 17 |
# File 'lib/disk_reporter/sas2ircu_parser.rb', line 11 def initialize(id) self.id = id self.backplanes = {} self.drives_by_serial = {} self.drives_by_wnn = {} populate_backplanes end |
Instance Attribute Details
#backplanes ⇒ Object
Returns the value of attribute backplanes.
5 6 7 |
# File 'lib/disk_reporter/sas2ircu_parser.rb', line 5 def backplanes @backplanes end |
#drives_by_serial ⇒ Object
Returns the value of attribute drives_by_serial.
5 6 7 |
# File 'lib/disk_reporter/sas2ircu_parser.rb', line 5 def drives_by_serial @drives_by_serial end |
#drives_by_wnn ⇒ Object
Returns the value of attribute drives_by_wnn.
5 6 7 |
# File 'lib/disk_reporter/sas2ircu_parser.rb', line 5 def drives_by_wnn @drives_by_wnn end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/disk_reporter/sas2ircu_parser.rb', line 5 def id @id end |
Instance Method Details
#to_h ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/disk_reporter/sas2ircu_parser.rb', line 19 def to_h bs = {} backplanes.each do |_k,b| bs[b.enclosure] = b.to_h end { backplanes: bs } end |