Class: Fog::Libvirt::Compute::Network

Inherits:
Model
  • Object
show all
Includes:
Util
Defined in:
lib/fog/libvirt/models/compute/network.rb

Instance Method Summary collapse

Methods included from Util

#randomized_name, #xml_element, #xml_elements

Constructor Details

#initialize(attributes = {}) ⇒ Network



15
16
17
# File 'lib/fog/libvirt/models/compute/network.rb', line 15

def initialize(attributes = {})
  super
end

Instance Method Details

#dhcp_leases(mac, flags = 0) ⇒ Object



19
20
21
# File 'lib/fog/libvirt/models/compute/network.rb', line 19

def dhcp_leases(mac, flags = 0)
  service.dhcp_leases(uuid, mac, flags)
end

#saveObject

Raises:

  • (Fog::Errors::Error)


23
24
25
# File 'lib/fog/libvirt/models/compute/network.rb', line 23

def save
  raise Fog::Errors::Error.new('Creating a new network is not yet implemented. Contributions welcome!')
end

#shutdownObject



27
28
29
# File 'lib/fog/libvirt/models/compute/network.rb', line 27

def shutdown
  service.destroy_network(uuid)
end

#to_xmlObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/libvirt/models/compute/network.rb', line 31

def to_xml
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.network do
      xml.name(name)
      xml.bridge(:name => bridge_name, :stp => 'on', :delay => '0')
    end
  end

  builder.to_xml
end