Class: Fog::Proxmox::Compute::Volume

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/proxmox/models/volume.rb

Overview

class Volume model

Instance Method Summary collapse

Constructor Details

#initialize(new_attributes = {}) ⇒ Volume

Returns a new instance of Volume.



42
43
44
45
46
47
48
49
# File 'lib/fog/compute/proxmox/models/volume.rb', line 42

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

#destroyObject



51
52
53
# File 'lib/fog/compute/proxmox/models/volume.rb', line 51

def destroy
  service.delete_volume(node_id, storage_id, volid)
end

#restore(vmid, options = {}) ⇒ Object



55
56
57
# File 'lib/fog/compute/proxmox/models/volume.rb', line 55

def restore(vmid, options = {})
  service.create_server(node_id, options.merge(archive: volid, storage: storage_id, vmid: vmid))
end