Class: DcmgrResource::Volume

Inherits:
Base
  • Object
show all
Defined in:
app/models/dcmgr_resource/volume.rb

Class Method Summary collapse

Methods inherited from Base

get_resource_state_count, set_debug, total_resource

Class Method Details

.attach(volume_id, instance_id) ⇒ Object



20
21
22
23
24
25
26
# File 'app/models/dcmgr_resource/volume.rb', line 20

def self.attach(volume_id, instance_id)
  @collection ||= self.collection_name
  self.collection_name = File.join(@collection,volume_id)
  result = self.put(:attach, {:volume_id => volume_id,:instance_id => instance_id})
  self.collection_name = @collection
  result.body
end

.create(params) ⇒ Object



7
8
9
10
11
12
13
14
# File 'app/models/dcmgr_resource/volume.rb', line 7

def self.create(params)
  volume = self.new
  volume.volume_size = params[:volume_size]
  volume.snapshot_id = params[:snapshot_id]
  volume.storage_pool_id = params[:storage_pool_id]
  volume.save
  volume
end

.destroy(volume_id) ⇒ Object



16
17
18
# File 'app/models/dcmgr_resource/volume.rb', line 16

def self.destroy(volume_id)
  self.delete(volume_id).body
end

.detach(volume_id) ⇒ Object



28
29
30
31
32
33
34
# File 'app/models/dcmgr_resource/volume.rb', line 28

def self.detach(volume_id)
  @collection ||= self.collection_name
  self.collection_name = File.join(@collection,volume_id)
  result = self.put(:detach, {:volume_id => volume_id})
  self.collection_name = @collection
  result.body
end

.list(params = {}) ⇒ Object



3
4
5
# File 'app/models/dcmgr_resource/volume.rb', line 3

def self.list(params = {})
  self.find(:all,:params => params)
end

.show(volume_id) ⇒ Object



44
45
46
# File 'app/models/dcmgr_resource/volume.rb', line 44

def self.show(volume_id)
  self.get(volume_id)
end

.status(account_id) ⇒ Object



36
37
38
39
40
41
42
# File 'app/models/dcmgr_resource/volume.rb', line 36

def self.status()
  @collection ||= self.collection_name
  self.collection_name = File.join(@collection,)
  result = self.get(:status)
  self.collection_name = @collection
  result
end