radfish-supermicro 0.1.5 → 0.2.0
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 +35 -5
- 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: '091a79bdcb460394274e35673826de2b0a0d92276723fda7c5964e436cdb2131'
|
4
|
+
data.tar.gz: 5ed7ad3a21c2362cee2353a9be01b90fa1fe979a6392d30130baaa8e8490829f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ca6e946b739c0d6346c2e5c2ab12d0a54920dff870b92aeadbd26881425aac0be9053f717cc8d54cb8804a46d86a77a3a55fcf6087ba64ff6730dec28979c24
|
7
|
+
data.tar.gz: 13fe882019ca53655ba5d39260abc219f8aa60d861e238e8c2a95f1a0cd097910e2d33a99f51fb977e797f88f72a126aef645af84762f3f3fd7fd01b2b4a480a
|
@@ -320,17 +320,47 @@ module Radfish
|
|
320
320
|
end
|
321
321
|
end
|
322
322
|
|
323
|
-
def drives
|
324
|
-
|
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
|
328
|
+
|
329
|
+
drive_data = @supermicro_client.drives(controller_id)
|
330
|
+
|
331
|
+
# Convert to OpenStruct for consistency
|
332
|
+
drive_data.map { |drive| OpenStruct.new(drive) }
|
325
333
|
end
|
326
334
|
|
327
|
-
def volumes
|
328
|
-
|
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
|
340
|
+
|
341
|
+
volume_data = @supermicro_client.volumes(controller_id)
|
342
|
+
|
343
|
+
# Convert to OpenStruct for consistency
|
344
|
+
volume_data.map { |volume| OpenStruct.new(volume) }
|
329
345
|
end
|
330
346
|
|
331
347
|
def storage_summary
|
332
348
|
@supermicro_client.storage_summary
|
333
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
|
334
364
|
|
335
365
|
# Virtual Media
|
336
366
|
|
@@ -699,4 +729,4 @@ module Radfish
|
|
699
729
|
# Register the adapter
|
700
730
|
Radfish.register_adapter('supermicro', SupermicroAdapter)
|
701
731
|
Radfish.register_adapter('smc', SupermicroAdapter)
|
702
|
-
end
|
732
|
+
end
|