Class: Fog::Compute::XenServer::VDI
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::XenServer::VDI
show all
- Defined in:
- lib/rackspace-fog/xenserver/models/compute/vdi.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
#initialize(attributes = {}) ⇒ VDI
Default VDI type is system Default size 8GB Sharable is false by default read_only is false by default
47
48
49
50
51
52
53
54
|
# File 'lib/rackspace-fog/xenserver/models/compute/vdi.rb', line 47
def initialize(attributes = {})
self.virtual_size ||= '8589934592' unless attributes[:virtual_size]
self.type ||= 'system' unless attributes[:type]
self.read_only ||= false unless attributes[:read_only]
self.sharable ||= false unless attributes[:sharable]
self.other_config ||= {} unless attributes[:other_config]
super
end
|
Instance Method Details
#destroy ⇒ Object
86
87
88
|
# File 'lib/rackspace-fog/xenserver/models/compute/vdi.rb', line 86
def destroy
connection.destroy_vdi reference
end
|
#parent ⇒ Object
64
65
66
|
# File 'lib/rackspace-fog/xenserver/models/compute/vdi.rb', line 64
def parent
connection.vdis.get __parent
end
|
#save ⇒ Object
80
81
82
83
84
|
# File 'lib/rackspace-fog/xenserver/models/compute/vdi.rb', line 80
def save
requires :name, :storage_repository
ref = connection.create_vdi attributes
merge_attributes connection.vdis.get(ref).attributes
end
|
#set_attribute(name, *val) ⇒ Object
56
57
58
|
# File 'lib/rackspace-fog/xenserver/models/compute/vdi.rb', line 56
def set_attribute(name, *val)
data = connection.set_attribute( 'VDI', reference, name, *val )
end
|
#snapshot_of ⇒ Object
60
61
62
|
# File 'lib/rackspace-fog/xenserver/models/compute/vdi.rb', line 60
def snapshot_of
connection.vdis.get __sr
end
|
#snapshots ⇒ Object
68
69
70
71
72
|
# File 'lib/rackspace-fog/xenserver/models/compute/vdi.rb', line 68
def snapshots
__snapshots.collect do |ref|
connection.vdis.get ref
end
end
|
#sr ⇒ Object
94
95
96
|
# File 'lib/rackspace-fog/xenserver/models/compute/vdi.rb', line 94
def sr
storage_repository
end
|
#storage_repository ⇒ Object
90
91
92
|
# File 'lib/rackspace-fog/xenserver/models/compute/vdi.rb', line 90
def storage_repository
connection.storage_repositories.get __sr
end
|
#vbds ⇒ Object
74
75
76
77
78
|
# File 'lib/rackspace-fog/xenserver/models/compute/vdi.rb', line 74
def vbds
__vbds.collect do |ref|
connection.vbds.get ref
end
end
|