mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
2f0ca69ed6
closes #3295
57 lines
1.3 KiB
Ruby
57 lines
1.3 KiB
Ruby
require 'fog/opennebula/core'
|
|
|
|
module Fog
|
|
module Compute
|
|
class OpenNebula < Fog::Service
|
|
requires :opennebula_endpoint
|
|
recognizes :opennebula_username, :opennebula_password
|
|
|
|
model_path 'fog/opennebula/models/compute'
|
|
model :server
|
|
collection :servers
|
|
model :network
|
|
collection :networks
|
|
model :flavor
|
|
collection :flavors
|
|
model :interface
|
|
collection :interfaces
|
|
model :group
|
|
collection :groups
|
|
|
|
request_path 'fog/opennebula/requests/compute'
|
|
request :list_vms
|
|
request :list_groups
|
|
request :list_networks
|
|
request :vm_allocate
|
|
request :vm_destroy
|
|
request :get_vnc_console
|
|
request :vm_resume
|
|
request :vm_stop
|
|
request :template_pool
|
|
|
|
class Mock
|
|
include Collections
|
|
def initialize(options={})
|
|
require 'opennebula'
|
|
end
|
|
|
|
def client
|
|
return @client
|
|
end
|
|
end
|
|
|
|
class Real
|
|
include Collections
|
|
|
|
def client
|
|
return @client
|
|
end
|
|
|
|
def initialize(options={})
|
|
require 'opennebula'
|
|
@client = ::OpenNebula::Client.new("#{options[:opennebula_username]}:#{options[:opennebula_password]}", options[:opennebula_endpoint])
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|