Class: Fog::Proxmox::Compute::Volume
- Inherits:
-
Model
- Object
- Model
- Fog::Proxmox::Compute::Volume
- Defined in:
- lib/fog/proxmox/compute/models/volume.rb
Overview
class Volume model: pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/node/storage/storage/content/volume size is in bytes
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(new_attributes = {}) ⇒ Volume
constructor
A new instance of Volume.
- #restore(vmid, options = {}) ⇒ Object
- #template? ⇒ Boolean
Constructor Details
#initialize(new_attributes = {}) ⇒ Volume
Returns a new instance of Volume.
45 46 47 48 49 50 51 52 |
# File 'lib/fog/proxmox/compute/models/volume.rb', line 45 def initialize(new_attributes = {}) prepare_service_value(new_attributes) Fog::Proxmox::Attributes.set_attr_and_sym('node_id', attributes, new_attributes) Fog::Proxmox::Attributes.set_attr_and_sym('storage_id', attributes, new_attributes) Fog::Proxmox::Attributes.set_attr_and_sym('volid', attributes, new_attributes) requires :node_id, :storage_id, :volid super(new_attributes) end |
Instance Method Details
#destroy ⇒ Object
54 55 56 |
# File 'lib/fog/proxmox/compute/models/volume.rb', line 54 def destroy service.delete_volume(node_id, storage_id, volid) end |
#restore(vmid, options = {}) ⇒ Object
58 59 60 |
# File 'lib/fog/proxmox/compute/models/volume.rb', line 58 def restore(vmid, = {}) service.create_server(node_id, .merge(archive: volid, storage: storage_id, vmid: vmid)) end |
#template? ⇒ Boolean
62 63 64 |
# File 'lib/fog/proxmox/compute/models/volume.rb', line 62 def template? Fog::Proxmox::DiskHelper.template?(volid) end |