Class: Virt::KVM::Host

Inherits:
Host show all
Defined in:
lib/virt/kvm/host.rb

Instance Attribute Summary

Attributes inherited from Host

#connection

Attributes inherited from Connection

#connection, #type

Instance Method Summary collapse

Methods inherited from Host

#defined_guests, #find_guest_by_id, #find_guest_by_name, #guests, #initialize, #name, #running_guests, #storage_pool, #storage_pools, #volumes

Methods inherited from Connection

#closed?, #disconnect, #host, #initialize, #secure?, #version

Constructor Details

This class inherits a constructor from Virt::Host

Instance Method Details

#create_guest(opts) ⇒ Object



22
23
24
# File 'lib/virt/kvm/host.rb', line 22

def create_guest opts
  Virt::KVM::Guest.new opts
end

#interface(iface) ⇒ Object



11
12
13
# File 'lib/virt/kvm/host.rb', line 11

def interface iface
  connection.lookup_interface_by_name(iface)
end

#interfacesObject

Available libvirt interfaces, excluding lo



5
6
7
8
9
# File 'lib/virt/kvm/host.rb', line 5

def interfaces
  connection.list_interfaces.delete_if{|i| i == "lo"}.sort
rescue => e
  raise "This function is not supported by the hypervisor: #{e}"
end

#networksObject

libvirt internal networks



16
17
18
19
20
# File 'lib/virt/kvm/host.rb', line 16

def networks
  connection.list_networks.map do |network|
    connection.lookup_network_by_name(network).bridge_name
  end
end