radfish-idrac 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 138d0be87d1965dcf2d8a915cbeb16c1413deed15fd8c0060aea3cba0057f0e7
4
- data.tar.gz: bcf189950a0e5120eb53b0adb8e8929e47dfa10363dec9639c23c820e4e97746
3
+ metadata.gz: 3287141d4e7316bb871ca1fa86099e81f2148e9cf810d8f2e22f475506d58e38
4
+ data.tar.gz: 167d356a4682cce6b1448142b4ba07b5fef22f0deb030d7b2dd7584516811163
5
5
  SHA512:
6
- metadata.gz: 9cf7f4645456c98bc9fd14fc6a12e4b5d4f94e8744975d21542d1877647059cfb5b72f1d3dbf327d7dd5d1c00a229c72d22b75f13618162120151a5244c18178
7
- data.tar.gz: 81b38c093917298a3efaab297c837b0de1fb6b94d853dcb61e8f6c18cc417c2f141d12b4f694584742cea74f9f45fa0f86954cb4e1c9c04b83ff02dc2990599a
6
+ metadata.gz: 51604ede9e27e2f70aeb760fa165b091f08155335b763b011e2ddee1554bd992730a3ffa9ad4388184d1a2c50d971bce8f52e6e05cbff0121aa60250a96caad0
7
+ data.tar.gz: 943856d3352e504a339495dd0d735aba370373cdb2207b939ced663503adc72dd26a4b0502b85e45b460e52ca76198b338484995c4b65206fd680b01026e9d13
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Radfish
4
4
  module Idrac
5
- VERSION = "0.2.2"
5
+ VERSION = "0.2.4"
6
6
  end
7
7
  end
@@ -331,9 +331,60 @@ module Radfish
331
331
 
332
332
  volume_data = @idrac_client.volumes(controller_id)
333
333
 
334
+ # Normalize key names for expected fields
335
+ volume_data.each do |v|
336
+ # Ensure raid_type/volume_type
337
+ v["raid_type"] ||= v["raid_level"] || v["RAIDType"]
338
+ v["volume_type"] ||= v["VolumeType"] if v["VolumeType"]
339
+ # Operations mapping
340
+ if v["Operations"]&.any?
341
+ v["operation_percent_complete"] ||= v["Operations"].first["PercentageComplete"]
342
+ v["operation_name"] ||= v["Operations"].first["OperationName"]
343
+ end
344
+ # Health normalization
345
+ v["health"] ||= v.dig("Status", "Health")
346
+ # OEM fallbacks
347
+ oem = v.dig("Oem", "Dell", "DellVirtualDisk") || v.dig("Oem", "Dell", "DellVolume")
348
+ if oem
349
+ v["lock_status"] ||= oem["LockStatus"]
350
+ v["stripe_size"] ||= oem["StripeSize"]
351
+ v["operation_name"] ||= oem["OperationName"]
352
+ v["operation_percent_complete"] ||= oem["OperationPercentComplete"]
353
+ v["write_cache_policy"] ||= oem["WriteCachePolicy"]
354
+ v["read_cache_policy"] ||= oem["ReadCachePolicy"]
355
+ end
356
+ end
357
+
334
358
  # Convert to OpenStruct for consistency
335
359
  volume_data.map { |volume| OpenStruct.new(volume) }
336
360
  end
361
+
362
+ def volume_drives(volume)
363
+ # Resolve the physical drives that make up a volume
364
+ raise ArgumentError, "Volume required" unless volume
365
+ controller_id = extract_controller_identifier(volume.controller)
366
+ # Get all drives on the controller
367
+ drives = @idrac_client.drives(controller_id)
368
+ # The IDRAC client drive entries include 'odata_id'; volumes include Links.Drives as '@odata.id'
369
+ refs = nil
370
+ raw = volume.adapter_data
371
+ if raw.respond_to?(:[])
372
+ refs = raw['drives'] || raw[:drives]
373
+ elsif raw.respond_to?(:drives)
374
+ refs = raw.drives
375
+ end
376
+ return [] unless refs && refs.respond_to?(:map)
377
+ ref_ids = refs.map { |r| r['@odata.id'] || r[:'@odata.id'] }.compact
378
+ matched = drives.select do |d|
379
+ oid = if d.is_a?(Hash)
380
+ d['odata_id'] || d[:odata_id] || d['@odata.id'] || d[:'@odata.id']
381
+ elsif d.respond_to?(:[])
382
+ d['odata_id'] || d['@odata.id']
383
+ end
384
+ oid && ref_ids.include?(oid)
385
+ end
386
+ matched.map { |drive| OpenStruct.new(drive) }
387
+ end
337
388
 
338
389
  def storage_summary
339
390
  # The iDRAC gem doesn't have a storage_summary method
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radfish-idrac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel