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
47
48
49
50
51
52
53
54
|
# File 'lib/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/fog/xenserver/models/compute/vdi.rb', line 86
def destroy
service.destroy_vdi reference
end
|
#parent ⇒ Object
64
65
66
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 64
def parent
service.vdis.get __parent
end
|
#save ⇒ Object
80
81
82
83
84
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 80
def save
requires :name, :storage_repository
ref = service.create_vdi attributes
merge_attributes service.vdis.get(ref).attributes
end
|
#set_attribute(name, *val) ⇒ Object
56
57
58
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 56
def set_attribute(name, *val)
data = service.set_attribute( 'VDI', reference, name, *val )
end
|
#snapshot_of ⇒ Object
60
61
62
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 60
def snapshot_of
service.vdis.get __sr
end
|
#snapshots ⇒ Object
68
69
70
71
72
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 68
def snapshots
__snapshots.collect do |ref|
service.vdis.get ref
end
end
|
#sr ⇒ Object
94
95
96
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 94
def sr
storage_repository
end
|
#storage_repository ⇒ Object
90
91
92
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 90
def storage_repository
service.storage_repositories.get __sr
end
|
#vbds ⇒ Object
74
75
76
77
78
|
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 74
def vbds
__vbds.collect do |ref|
service.vbds.get ref
end
end
|