class OVIRT::Interface

Attributes

interface[R]
mac[R]
name[R]
network[R]
vm[R]

Public Class Methods

new(client, xml) click to toggle source
# File lib/ovirt/interface.rb, line 6
def initialize(client, xml)
  super(client, xml[:id], xml[:href], (xml/'name').first.text)
  parse_xml_attributes!(xml)
  self
end
to_xml(opts={}) click to toggle source
# File lib/ovirt/interface.rb, line 12
def self.to_xml(opts={})
  builder = Nokogiri::XML::Builder.new do
    nic{
      name_(opts[:name] || 'eth0')
      network{
        name_(opts[:network] || 'ovirtmgmt')
      }
    }
  end
  Nokogiri::XML(builder.to_xml).root.to_s
end

Public Instance Methods

parse_xml_attributes!(xml) click to toggle source
# File lib/ovirt/interface.rb, line 24
def parse_xml_attributes!(xml)
 @name = (xml/'name').first.text
 @mac = (xml/'mac').first[:address]
 @interface = (xml/'interface').first.text
 @network = (xml/'network').first[:id]
 @vm = Link::new(@client, (xml/'vm').first[:id], (xml/'vm').first[:href])
end