Class: Fog::Compute::VcloudDirector::Disk
- Defined in:
- lib/fog/vcloud_director/models/compute/disk.rb
Overview
there is no lazy_load in disks
Instance Method Summary collapse
- #all_disks ⇒ Object
-
#capacity=(new_capacity) ⇒ Object
TODO Virtual machine disk sizes may only be increased, not decreased.
- #destroy ⇒ Object
Methods inherited from Model
#initialize, #inspect, #lazy_load_attrs, #make_attr_loaded_method, #make_lazy_load_method
Constructor Details
This class inherits a constructor from Fog::Compute::VcloudDirector::Model
Instance Method Details
#all_disks ⇒ Object
34 35 36 |
# File 'lib/fog/vcloud_director/models/compute/disk.rb', line 34 def all_disks attributes[:all_disks] # this is passed at instantiation time end |
#capacity=(new_capacity) ⇒ Object
TODO Virtual machine disk sizes may only be increased, not decreased.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/vcloud_director/models/compute/disk.rb', line 21 def capacity=(new_capacity) has_changed = ( capacity != new_capacity.to_i ) not_first_set = !capacity.nil? attributes[:capacity] = new_capacity.to_i if not_first_set && has_changed data = Fog::Generators::Compute::VcloudDirector::Disks.new(all_disks) num_disk = name.scan(/\d+/).first.to_i data.modify_hard_disk_size(num_disk, new_capacity) response = service.put_disks(attributes[:vm].id, data.disks) service.process_task(response.body) end end |
#destroy ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/fog/vcloud_director/models/compute/disk.rb', line 38 def destroy num_disk = name.scan(/\d+/).first.to_i data = Fog::Generators::Compute::VcloudDirector::Disks.new(all_disks) data.delete_hard_disk(num_disk) response = service.put_disks(attributes[:vm].id, data.disks) service.process_task(response.body) end |