radfish-supermicro 0.1.6 → 0.2.1
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/supermicro/version.rb +2 -2
- data/lib/radfish/supermicro_adapter.rb +27 -7
- 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: eb355208e731336ea71522b738643717ba63056f8ed04126db23e9b2333bba2f
|
4
|
+
data.tar.gz: 9dfba4b3ca23d6a3eae1ff1d6b196585bccdbc06256928481401b035cf0babb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fda793041d25007df301a82e637124f68847ba61185c3600a07b72f0b784c362f020e286de0190dbe46e796aca396607b996ab4a7c20ac2ac7d5921e6dee2de
|
7
|
+
data.tar.gz: 5ac4f1cda800abe4743116b84233a82baa1baf1f205d82106e170caf9dac92a44c8e3833c08a7d9e990b27b1afa6d12f602311f368c779946b282b0c3e99d0ae
|
@@ -320,9 +320,11 @@ module Radfish
|
|
320
320
|
end
|
321
321
|
end
|
322
322
|
|
323
|
-
def drives(
|
324
|
-
# The Supermicro gem
|
325
|
-
raise ArgumentError, "Controller
|
323
|
+
def drives(controller)
|
324
|
+
# The Supermicro gem requires a controller identifier; derive it from the controller
|
325
|
+
raise ArgumentError, "Controller required" unless controller
|
326
|
+
controller_id = extract_controller_identifier(controller)
|
327
|
+
raise ArgumentError, "Controller identifier missing" unless controller_id
|
326
328
|
|
327
329
|
drive_data = @supermicro_client.drives(controller_id)
|
328
330
|
|
@@ -330,9 +332,11 @@ module Radfish
|
|
330
332
|
drive_data.map { |drive| OpenStruct.new(drive) }
|
331
333
|
end
|
332
334
|
|
333
|
-
def volumes(
|
334
|
-
# The Supermicro gem
|
335
|
-
raise ArgumentError, "Controller
|
335
|
+
def volumes(controller)
|
336
|
+
# The Supermicro gem requires a controller identifier; derive it from the controller
|
337
|
+
raise ArgumentError, "Controller required" unless controller
|
338
|
+
controller_id = extract_controller_identifier(controller)
|
339
|
+
raise ArgumentError, "Controller identifier missing" unless controller_id
|
336
340
|
|
337
341
|
volume_data = @supermicro_client.volumes(controller_id)
|
338
342
|
|
@@ -343,6 +347,22 @@ module Radfish
|
|
343
347
|
def storage_summary
|
344
348
|
@supermicro_client.storage_summary
|
345
349
|
end
|
350
|
+
|
351
|
+
private
|
352
|
+
|
353
|
+
def extract_controller_identifier(controller)
|
354
|
+
raw = controller.respond_to?(:adapter_data) ? controller.adapter_data : controller
|
355
|
+
if defined?(OpenStruct) && raw.is_a?(OpenStruct)
|
356
|
+
table = raw.instance_variable_get(:@table)
|
357
|
+
table && (table[:"@odata.id"] || table["@odata.id"]) || controller.id
|
358
|
+
elsif raw.respond_to?(:[])
|
359
|
+
raw['@odata.id'] || raw[:'@odata.id'] || controller.id
|
360
|
+
else
|
361
|
+
controller.id
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
public
|
346
366
|
|
347
367
|
# Virtual Media
|
348
368
|
|
@@ -711,4 +731,4 @@ module Radfish
|
|
711
731
|
# Register the adapter
|
712
732
|
Radfish.register_adapter('supermicro', SupermicroAdapter)
|
713
733
|
Radfish.register_adapter('smc', SupermicroAdapter)
|
714
|
-
end
|
734
|
+
end
|