Class: Fog::Compute::VcloudDirector::Disk
- Defined in:
- lib/fog/vcloud_director/models/compute/disk.rb
Overview
there is no lazy_load in disks
Instance Attribute Summary
Attributes inherited from Model
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
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Compute::VcloudDirector::Model
Instance Method Details
#all_disks ⇒ Object
36 37 38 |
# File 'lib/fog/vcloud_director/models/compute/disk.rb', line 36 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.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fog/vcloud_director/models/compute/disk.rb', line 23 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
40 41 42 43 44 45 46 |
# File 'lib/fog/vcloud_director/models/compute/disk.rb', line 40 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 |