Class: Fog::Compute::XenServer::VDI
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::XenServer::VDI
show all
- Defined in:
- lib/fog/xenserver/models/compute/vdi.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #service
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
#connection, #connection=, #prepare_service_value
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #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
50
51
52
53
54
55
56
57
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 50
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
89
90
91
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 89
def destroy
service.destroy_vdi reference
end
|
#parent ⇒ Object
67
68
69
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 67
def parent
service.vdis.get __parent
end
|
#save ⇒ Object
83
84
85
86
87
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 83
def save
requires :name, :storage_repository
ref = service.create_vdi attributes
merge_attributes service.vdis.get(ref).attributes
end
|
#set_attribute(name, *val) ⇒ Object
59
60
61
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 59
def set_attribute(name, *val)
data = service.set_attribute( 'VDI', reference, name, *val )
end
|
#snapshot_of ⇒ Object
63
64
65
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 63
def snapshot_of
service.vdis.get __sr
end
|
#snapshots ⇒ Object
71
72
73
74
75
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 71
def snapshots
__snapshots.collect do |ref|
service.vdis.get ref
end
end
|
#sr ⇒ Object
97
98
99
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 97
def sr
storage_repository
end
|
#storage_repository ⇒ Object
93
94
95
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 93
def storage_repository
service.storage_repositories.get __sr
end
|
#vbds ⇒ Object
77
78
79
80
81
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 77
def vbds
__vbds.collect do |ref|
service.vbds.get ref
end
end
|