# File lib/fog/ecloud/models/compute/server.rb, line 111 def add_disk(size) if @disk_change == :deleted raise RuntimeError, "Can't add a disk w/o saving changes or reloading" else @disk_change = :added load_unless_loaded! virtual_hardware[:Item] << { :ResourceType => '17', :AddressOnParent => (disk_mess.map { |dm| dm[:AddressOnParent] }.sort.last.to_i + 1).to_s, :VirtualQuantity => size.to_s } end true end
# File lib/fog/ecloud/models/compute/server.rb, line 81 def cpus if cpu_mess { :count => cpu_mess[:VirtualQuantity].to_i, :units => cpu_mess[:AllocationUnits] } end end
# File lib/fog/ecloud/models/compute/server.rb, line 88 def cpus=(qty) @changed = true cpu_mess[:VirtualQuantity] = qty.to_s end
# File lib/fog/ecloud/models/compute/server.rb, line 71 def delete requires :href connection.delete_vapp( href) end
# File lib/fog/ecloud/models/compute/server.rb, line 124 def delete_disk(number) if @disk_change == :added raise RuntimeError, "Can't delete a disk w/o saving changes or reloading" else @disk_change = :deleted load_unless_loaded! unless number == 0 virtual_hardware[:Item].delete_if { |vh| vh[:ResourceType] == '17' && vh[:AddressOnParent].to_i == number } end end true end
# File lib/fog/ecloud/models/compute/server.rb, line 105 def disks disk_mess.map do |dm| { :number => dm[:AddressOnParent], :size => dm[:VirtualQuantity].to_i, :resource => dm[:HostResource] } end end
# File lib/fog/ecloud/models/compute/server.rb, line 19 def friendly_status load_unless_loaded! case status when '0' 'creating' when '2' 'off' when '4' 'on' else 'unkown' end end
# File lib/fog/ecloud/models/compute/server.rb, line 64 def graceful_restart requires :href shutdown wait_for { off? } power_on end
# File lib/fog/ecloud/models/compute/server.rb, line 93 def memory if memory_mess { :amount => memory_mess[:VirtualQuantity].to_i, :units => memory_mess[:AllocationUnits] } end end
# File lib/fog/ecloud/models/compute/server.rb, line 100 def memory=(amount) @changed = true memory_mess[:VirtualQuantity] = amount.to_s end
# File lib/fog/ecloud/models/compute/server.rb, line 76 def name=(new_name) attributes[:name] = new_name @changed = true end
# File lib/fog/ecloud/models/compute/server.rb, line 43 def off? load_unless_loaded! status == '2' end
# File lib/fog/ecloud/models/compute/server.rb, line 38 def on? load_unless_loaded! status == '4' end
# File lib/fog/ecloud/models/compute/server.rb, line 52 def power_off power_operation( :power_off => :powerOff ) end
# File lib/fog/ecloud/models/compute/server.rb, line 48 def power_on power_operation( :power_on => :powerOn ) end
# File lib/fog/ecloud/models/compute/server.rb, line 60 def power_reset power_operation( :power_reset => :reset ) end
# File lib/fog/ecloud/models/compute/server.rb, line 33 def ready? load_unless_loaded! status == '2' end
# File lib/fog/ecloud/models/compute/server.rb, line 137 def reload reset_tracking super end
# File lib/fog/ecloud/models/compute/server.rb, line 142 def save if new_record? #Lame ... raise RuntimeError, "Should not be here" else if on? if @changed raise RuntimeError, "Can't save cpu, name or memory changes while the VM is on." end end connection.configure_vapp( href, _compose_vapp_data ) end reset_tracking end
Generated with the Darkfish Rdoc Generator 2.