radfish-idrac 0.2.2 → 0.2.3
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 +27 -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: 9e06ed50701a0a34c99711a2cba0e5ee4238667d75988b7c78f06b66c6f08cf9
|
4
|
+
data.tar.gz: a4e88ec48073815ff1e368d5bd93b1c4d14b9b5dd44bcb0324e0aa037e79430d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b189ac7729869a390ff50e4043a4eccd92dbf3fcab823d338130895a735ff7f1d30dd3d03aa3b5611d4eb5f54e8e8cab4e57307eebd82b33153049f1930c633
|
7
|
+
data.tar.gz: 451835735540908ea5a129e50dacc003088d2411d03eb89826ec4d423de594d49767c353dda430329a40df05639a9e7b8bfb76a075dc5bd091cbdad71a51fc22
|
@@ -334,6 +334,33 @@ module Radfish
|
|
334
334
|
# Convert to OpenStruct for consistency
|
335
335
|
volume_data.map { |volume| OpenStruct.new(volume) }
|
336
336
|
end
|
337
|
+
|
338
|
+
def volume_drives(volume)
|
339
|
+
# Resolve the physical drives that make up a volume
|
340
|
+
raise ArgumentError, "Volume required" unless volume
|
341
|
+
controller_id = extract_controller_identifier(volume.controller)
|
342
|
+
# Get all drives on the controller
|
343
|
+
drives = @idrac_client.drives(controller_id)
|
344
|
+
# The IDRAC client drive entries include 'odata_id'; volumes include Links.Drives as '@odata.id'
|
345
|
+
refs = nil
|
346
|
+
raw = volume.adapter_data
|
347
|
+
if raw.respond_to?(:[])
|
348
|
+
refs = raw['drives'] || raw[:drives]
|
349
|
+
elsif raw.respond_to?(:drives)
|
350
|
+
refs = raw.drives
|
351
|
+
end
|
352
|
+
return [] unless refs && refs.respond_to?(:map)
|
353
|
+
ref_ids = refs.map { |r| r['@odata.id'] || r[:'@odata.id'] }.compact
|
354
|
+
matched = drives.select do |d|
|
355
|
+
oid = if d.is_a?(Hash)
|
356
|
+
d['odata_id'] || d[:odata_id] || d['@odata.id'] || d[:'@odata.id']
|
357
|
+
elsif d.respond_to?(:[])
|
358
|
+
d['odata_id'] || d['@odata.id']
|
359
|
+
end
|
360
|
+
oid && ref_ids.include?(oid)
|
361
|
+
end
|
362
|
+
matched.map { |drive| OpenStruct.new(drive) }
|
363
|
+
end
|
337
364
|
|
338
365
|
def storage_summary
|
339
366
|
# The iDRAC gem doesn't have a storage_summary method
|