Class: Pvectl::Repositories::Disk
- Defined in:
- lib/pvectl/repositories/disk.rb
Overview
Repository for physical disks on Proxmox nodes.
Uses the ‘/nodes/node/disks/list` API endpoint to fetch physical disk information per node.
Instance Method Summary collapse
-
#list(node: nil) ⇒ Array<Models::PhysicalDisk>
Lists physical disks, optionally filtered by node.
-
#smart(node_name, disk_path) ⇒ Hash{Symbol => untyped}
Fetches SMART data for a specific disk on a node.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Pvectl::Repositories::Base
Instance Method Details
#list(node: nil) ⇒ Array<Models::PhysicalDisk>
Lists physical disks, optionally filtered by node.
When node is nil, iterates over all online nodes in the cluster. When node is specified, queries only that node.
29 30 31 32 33 34 35 |
# File 'lib/pvectl/repositories/disk.rb', line 29 def list(node: nil) if node disks_for_node(node) else online_nodes.flat_map { |node_name| disks_for_node(node_name) } end end |
#smart(node_name, disk_path) ⇒ Hash{Symbol => untyped}
Fetches SMART data for a specific disk on a node.
42 43 44 45 46 47 |
# File 'lib/pvectl/repositories/disk.rb', line 42 def smart(node_name, disk_path) response = connection.client["nodes/#{node_name}/disks/smart"].get(params: { disk: disk_path }) extract_data(response) rescue StandardError {} end |