Method: Fog::Compute::Ecloud::Server#add_disk

Defined in:
lib/rackspace-fog/ecloud/models/compute/server.rb

#add_disk(size) ⇒ Object



173
174
175
176
177
178
# File 'lib/rackspace-fog/ecloud/models/compute/server.rb', line 173

def add_disk(size)
  index = disks.map { |d| d[:Index].to_i }.sort[-1] + 1
  vm_disks = disks << {:Index => index, :Size=>{:Unit => "GB", :Value => size}}
  data = connection.virtual_machine_edit_hardware_configuration(href + "/hardwareConfiguration", _configuration_data(:disks => vm_disks)).body
  task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href])[0]
end