Module: Libvirt

Defined in:
lib/libvirt.rb,
lib/libvirt/node.rb,
lib/libvirt/spec.rb,
lib/libvirt/error.rb,
lib/libvirt/domain.rb,
lib/libvirt/network.rb,
lib/libvirt/version.rb,
lib/libvirt/exception.rb,
lib/libvirt/spec/util.rb,
lib/libvirt/collection.rb,
lib/libvirt/connection.rb,
lib/libvirt/node_device.rb,
lib/libvirt/spec/device.rb,
lib/libvirt/spec/domain.rb,
lib/libvirt/storage_pool.rb,
lib/libvirt/storage_volume.rb,
lib/libvirt/spec/device/disk.rb,
lib/libvirt/spec/device/input.rb,
lib/libvirt/spec/device/sound.rb,
lib/libvirt/spec/device/video.rb,
lib/libvirt/spec/domain/clock.rb,
lib/libvirt/spec/domain/memtune.rb,
lib/libvirt/spec/device/emulator.rb,
lib/libvirt/spec/device/graphics.rb,
lib/libvirt/spec/device/interface.rb,
lib/libvirt/spec/domain/os_booting.rb,
lib/libvirt/spec/device/video_model.rb,
lib/libvirt/collection/domain_collection.rb,
lib/libvirt/collection/network_collection.rb,
lib/libvirt/collection/abstract_collection.rb,
lib/libvirt/collection/nwfilter_collection.rb,
lib/libvirt/collection/interface_collection.rb,
lib/libvirt/collection/node_device_collection.rb,
lib/libvirt/collection/storage_pool_collection.rb,
lib/libvirt/collection/storage_volume_collection.rb

Overview

This module is the namespace for the higher level library on top of libvirt, in typicaly Ruby library style. In contrast with FFI::Libvirt which is a direct layer on top of FFI, this namespace abstracts much of the manual work away (especially pointer handling) and exposes aspects of the API through nice Ruby objects.

Due to the nature of this side of the project, there may be certain features not readily available which are supported by the API. If this is the case, you can use the FFI::Libvirt library alongside this side.

Defined Under Namespace

Modules: Collection, Exception, Spec Classes: Connection, Domain, Error, Network, Node, NodeDevice, StoragePool, StorageVolume

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.connect(*args) ⇒ Object

Connect to a hypervisor using libvirt. This is a shortcut to instantiating a Connection object, therefore for documentation on the arguments and return value for this method, please consult Libvirt::Connection#initialize.



47
48
49
# File 'lib/libvirt.rb', line 47

def self.connect(*args)
  Connection.new(*args)
end

.initialize!Object

Initializes the library by calling virInitialize. Most methods in libvirt actually call this themselves, so its not strictly necessary. However, it is good practice and is highly recommended that this is called at a same place in a multi-threaded environment.



30
31
32
# File 'lib/libvirt.rb', line 30

def self.initialize!
  FFI::Libvirt.virInitialize == 0
end

.versionArray

Returns the version of libvirt on the client machine. This is not the version of the libvirt ruby library. The result is return as an array of [major, minor, patch].

Returns:

  • (Array)


39
40
41
# File 'lib/libvirt.rb', line 39

def self.version
  FFI::Libvirt.version
end