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 +4 -4
- data/lib/radfish/idrac/version.rb +1 -1
- data/lib/radfish/idrac_adapter.rb +51 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3287141d4e7316bb871ca1fa86099e81f2148e9cf810d8f2e22f475506d58e38
|
4
|
+
data.tar.gz: 167d356a4682cce6b1448142b4ba07b5fef22f0deb030d7b2dd7584516811163
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51604ede9e27e2f70aeb760fa165b091f08155335b763b011e2ddee1554bd992730a3ffa9ad4388184d1a2c50d971bce8f52e6e05cbff0121aa60250a96caad0
|
7
|
+
data.tar.gz: 943856d3352e504a339495dd0d735aba370373cdb2207b939ced663503adc72dd26a4b0502b85e45b460e52ca76198b338484995c4b65206fd680b01026e9d13
|
@@ -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
|