Class: Fog::Compute::XenServer::VDI

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/xenserver/models/compute/vdi.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ VDI

Default VDI type is system Default size 8GB Sharable is false by default read_only is false by default



49
50
51
52
53
54
55
56
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 49

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

#destroyObject



88
89
90
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 88

def destroy
  service.destroy_vdi reference
end

#parentObject



66
67
68
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 66

def parent
  service.vdis.get __parent
end

#saveObject



82
83
84
85
86
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 82

def save
  requires :name, :storage_repository
  ref = service.create_vdi attributes
  merge_attributes service.vdis.get(ref).attributes
end

#set_attribute(name, *val) ⇒ Object



58
59
60
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 58

def set_attribute(name, *val)
  data = service.set_attribute( 'VDI', reference, name, *val )
end

#snapshot_ofObject



62
63
64
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 62

def snapshot_of
  service.vdis.get __sr
end

#snapshotsObject



70
71
72
73
74
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 70

def snapshots
  __snapshots.map do |ref|
    service.vdis.get ref
  end
end

#srObject



96
97
98
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 96

def sr
  storage_repository
end

#storage_repositoryObject



92
93
94
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 92

def storage_repository
  service.storage_repositories.get __sr
end

#vbdsObject



76
77
78
79
80
# File 'lib/fog/xenserver/models/compute/vdi.rb', line 76

def vbds
  __vbds.map do |ref|
    service.vbds.get ref
  end
end