2014-05-07 11:31:23 -04:00
|
|
|
require 'fog/opennebula/core'
|
2014-04-02 08:57:15 -04:00
|
|
|
|
|
|
|
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
|
2014-04-24 04:49:02 -04:00
|
|
|
model :group
|
|
|
|
collection :groups
|
2014-11-26 10:09:12 -05:00
|
|
|
|
2014-04-02 08:57:15 -04:00
|
|
|
request_path 'fog/opennebula/requests/compute'
|
|
|
|
request :list_vms
|
2014-04-24 04:49:02 -04:00
|
|
|
request :list_groups
|
|
|
|
request :list_networks
|
2014-04-02 08:57:15 -04:00
|
|
|
request :vm_allocate
|
|
|
|
request :vm_destroy
|
|
|
|
request :get_vnc_console
|
|
|
|
request :vm_resume
|
|
|
|
request :vm_stop
|
|
|
|
request :template_pool
|
|
|
|
|
|
|
|
class Mock
|
|
|
|
include Collections
|
2014-05-14 02:16:00 -04:00
|
|
|
def initialize(options={})
|
2014-06-17 12:35:33 -04:00
|
|
|
require 'opennebula'
|
2014-05-14 02:16:00 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def client
|
|
|
|
return @client
|
|
|
|
end
|
2014-04-02 08:57:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
class Real
|
|
|
|
include Collections
|
|
|
|
|
|
|
|
def client
|
2014-05-14 02:16:00 -04:00
|
|
|
return @client
|
2014-04-02 08:57:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(options={})
|
2014-06-17 12:35:33 -04:00
|
|
|
require 'opennebula'
|
2014-04-02 08:57:15 -04:00
|
|
|
@client = ::OpenNebula::Client.new("#{options[:opennebula_username]}:#{options[:opennebula_password]}", options[:opennebula_endpoint])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|