Files

Class/Module Index [+]

Quicksearch

Fog::Compute::Libvirt::Interfaces

Public Instance Methods

all(filter=nil) click to toggle source
# File lib/fog/libvirt/models/compute/interfaces.rb, line 12
def all(filter=nil)
  data=[]
  if filter.nil?
    connection.raw.list_interfaces.each do |ifname|
      interface=connection.raw.lookup_interface_by_name(ifname)
      data << { :raw => interface }
    end
    connection.raw.list_defined_interfaces.each do |ifname|
      interface=connection.raw.lookup_interface_by_name(ifname)
      data << { :raw => interface }
    end

  else
    interface=nil
    begin
      interface=get_by_name(filter[:name]) if filter.has_key?(:name)
      interface=get_by_mac(filter[:mac]) if filter.has_key?(:mac)
    rescue ::Libvirt::RetrieveError
      return nil
    end
    data << { :raw => interface}
  end

  load(data)
end
get(key) click to toggle source
# File lib/fog/libvirt/models/compute/interfaces.rb, line 38
def get(key)
  self.all(:name => name).first
end
get_by_mac(mac) click to toggle source

Retrieve the interface by name

# File lib/fog/libvirt/models/compute/interfaces.rb, line 51
def get_by_mac(mac)
  interface=connection.raw.lookup_interface_by_mac(mac)
  return interface
  #          new(:raw => interface)
end
get_by_name(name) click to toggle source

private # Making these private, screws up realod

Retrieve the interface by name
# File lib/fog/libvirt/models/compute/interfaces.rb, line 44
def get_by_name(name)
  interface=connection.raw.lookup_interface_by_name(name)
  return interface
  #          new(:raw => interface)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.