Module: Virtuoso

Defined in:
lib/virtuoso.rb,
lib/virtuoso/error.rb,
lib/virtuoso/api/vm.rb,
lib/virtuoso/version.rb,
lib/virtuoso/virtualbox.rb,
lib/virtuoso/virtualbox/vm.rb,
lib/virtuoso/api/hypervisor.rb,
lib/virtuoso/virtualbox/hypervisor.rb

Defined Under Namespace

Modules: API, Error, VirtualBox

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.connect(url = nil) ⇒ Object

Connects to a hypervisor given by the URL to a libvirt instance, and returns the proper hypervisor class based on the connection.



16
17
18
19
20
21
# File 'lib/virtuoso.rb', line 16

def self.connect(url=nil)
  mapping = { "VBOX" => :VirtualBox }
  conn = Libvirt.connect(url)
  raise Error::UnsupportedHypervisorError, "Unsupported hypervisor: #{conn.hypervisor}" if !mapping[conn.hypervisor]
  const_get(mapping[conn.hypervisor]).const_get(:Hypervisor).new(conn)
end