class Squall::Hypervisor

OnApp Hypervisor

Public Instance Methods

add_data_store_join(id, data_store_id) click to toggle source

TODO: Add documentation

# File lib/squall/hypervisor.rb, line 89
def add_data_store_join(id, data_store_id)
  request(:post, "/settings/hypervisors/#{id}/data_store_joins.json", query: { data_store_id:  data_store_id })
end
add_network_join(id, options) click to toggle source

TODO: Add documentation

# File lib/squall/hypervisor.rb, line 105
def add_network_join(id, options)
  request(:post, "/settings/hypervisors/#{id}/network_joins.json", query: { network_join: options })
end
create(options = {}) click to toggle source

Public: Create a new Hypervisor.

options - Options for creating the hypervisor:

:label           - Label for the hypervisor
:ip_address      - IP for the hypervisor
:hypervisor_type - Type of the hypervisor

Example

create(
  label:           'myhv',
  ip_address:      '127.0.0.1',
  hypervisor_type: 'xen'
)

Returns a Hash.

# File lib/squall/hypervisor.rb, line 38
def create(options = {})
  req = request(:post, '/settings/hypervisors.json', default_params(options))
  req.first[1]
end
data_store_joins(id) click to toggle source

TODO: Add documentation

# File lib/squall/hypervisor.rb, line 83
def data_store_joins(id)
  response = request(:get, "/settings/hypervisors/#{id}/data_store_joins.json")
  response.collect { |dsj| dsj['data_store_join'] }
end
delete(id) click to toggle source

Public: Delete a hypervisor

id - ID of the hypervisor

Returns a Hash.

# File lib/squall/hypervisor.rb, line 72
def delete(id)
  req = request(:delete, "/settings/hypervisors/#{id}.json")
end
edit(id, options = {}) click to toggle source

Public: Edit a Hypervisor.

id - ID of the hypervisor options - Params for editing the Hypervisor, see `#create`.

Example

edit 1, label: 'myhv', ip_address: '127.0.0.1'

Returns a Hash.

# File lib/squall/hypervisor.rb, line 53
def edit(id, options = {})
  request(:put, "/settings/hypervisors/#{id}.json", default_params(options))
end
list() click to toggle source

Public: Lists all hypervisors.

Returns an Array.

# File lib/squall/hypervisor.rb, line 7
def list
  req = request(:get, '/settings/hypervisors.json')
  req.collect { |hv| hv['hypervisor'] }
end
network_joins(id) click to toggle source

TODO: Add documentation

# File lib/squall/hypervisor.rb, line 99
def network_joins(id)
  response = request(:get, "/settings/hypervisors/#{id}/network_joins.json")
  response.collect { |nj| nj['network_join'] }
end
reboot(id) click to toggle source

Public: Reboot a hypervisor.

id - ID of the hypervisor

Returns a Hash.

# File lib/squall/hypervisor.rb, line 62
def reboot(id)
  response = request(:get, "/settings/hypervisors/#{id}/rebooting.json")
  response['hypervisor']
end
remove_data_store_join(id, data_store_join_id) click to toggle source

TODO: Add documentation

# File lib/squall/hypervisor.rb, line 94
def remove_data_store_join(id, data_store_join_id)
  request(:delete, "/settings/hypervisors/#{id}/data_store_joins/#{data_store_join_id}.json")
end
remove_network_join(id, network_join_id) click to toggle source

TODO: Add documentation

# File lib/squall/hypervisor.rb, line 110
def remove_network_join(id, network_join_id)
  request(:delete, "/settings/hypervisors/#{id}/network_joins/#{network_join_id}.json")
end
show(id) click to toggle source

Public: Retrieves hypervisor info.

id - The id of the hypervisor

Returns a Hash.

# File lib/squall/hypervisor.rb, line 17
def show(id)
  req = request(:get, "/settings/hypervisors/#{id}.json")
  req.first[1]
end
virtual_machines(id) click to toggle source

TODO: Add documentation

# File lib/squall/hypervisor.rb, line 77
def virtual_machines(id)
  response = request(:get, "/settings/hypervisors/#{id}/virtual_machines.json")
  response.collect { |vm| vm['virtual_machine'] }
end