Class: Dcmgr::Models::VolumeSnapshot

Inherits:
AccountResource show all
Defined in:
lib/dcmgr/models/volume_snapshot.rb

Constant Summary collapse

STATE_TYPE_REGISTERING =
"registering"
STATE_TYPE_CREATING =
"creating"
STATE_TYPE_AVAILABLE =
"available"
STATE_TYPE_FAILED =
"failed"
STATE_TYPE_DELETING =
"deleting"
STATE_TYPE_DELETED =
"deleted"

Constants inherited from BaseNew

BaseNew::LOCK_TABLES_KEY

Instance Method Summary collapse

Methods inherited from AccountResource

#account

Methods inherited from BaseNew

Proxy, dataset, install_data, install_data_hooks, lock!, unlock!

Instance Method Details

#create_volume(account_id) ⇒ Object

create volume inherite from this snapshot for the account. limitation: inherit volume is created on same storage_pool.



34
35
36
# File 'lib/dcmgr/models/volume_snapshot.rb', line 34

def create_volume()
  storage_pool.create_volume(, self.size, self.canonical_uuid)
end

#delete_snapshotObject



42
43
44
45
# File 'lib/dcmgr/models/volume_snapshot.rb', line 42

def delete_snapshot
  self.state = STATE_TYPE_DELETING
  self.save_changes
end

#origin_volumeObject



38
39
40
# File 'lib/dcmgr/models/volume_snapshot.rb', line 38

def origin_volume
  Volume[origin_volume_id]
end

#to_hash_documentObject



26
27
28
29
30
# File 'lib/dcmgr/models/volume_snapshot.rb', line 26

def to_hash_document
  h = self.values.dup
  h[:id] = h[:uuid] = self.canonical_uuid
  h
end