1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/compute/libvirt.rb

50 lines
1 KiB
Ruby
Raw Normal View History

module Fog
module Compute
class Libvirt < Fog::Service
requires :libvirt_uri
model_path 'fog/compute/models/libvirt'
model :server
collection :servers
model :network
collection :networks
model :interface
collection :interfaces
model :volume
collection :volumes
model :pool
collection :pools
class Mock
def initialize(options={})
Fog::Mock.not_implemented
end
end
class Real
def initialize(options={})
@uri = options[:libvirt_uri]
#libvirt is part of the gem => ruby-libvirt
require 'libvirt'
@connection = ::Libvirt::open(@uri)
end
# hack to provide 'requests'
def method_missing(method_sym, *arguments, &block)
if @connection.respond_to?(method_sym)
@connection.send(method_sym, *arguments)
else
super
end
end
end
end
end
end