Skip to content

Instantly share code, notes, and snippets.

@lcx
Created July 13, 2017 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcx/708eee5fc66d0985ce18c84388547641 to your computer and use it in GitHub Desktop.
Save lcx/708eee5fc66d0985ce18c84388547641 to your computer and use it in GitHub Desktop.
def scan_disks!
output = `sudo /usr/sbin/storcli /c0 /eall /sall show J`
parsed_output = JSON.parse(output)
critical "Can't get device ID from storcli" unless parsed_output["Controllers"][0]["Command Status"]["Status"]=="Success"
parsed_output["Controllers"][0]["Response Data"]["Drive Information"].each do |drive|
@devices << Disk.new(drive["DID"])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment