Class: Ovirt::Nic

Inherits:
Base
  • Object
show all
Defined in:
lib/ovirt/nic.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes, #operations, #relationships, #service

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], all, all_xml_objects, #api_endpoint, api_endpoint, #class_suffix, create_from_xml, #destroy, element_name, element_names, find_by_href, find_by_id, find_by_name, has_first_node?, hash_from_id_and_href, href_from_creation_status_link, #initialize, #keys, #method_missing, object_to_id, #operation, parse_attribute, parse_boolean, parse_first_node, parse_first_node_with_hash, parse_first_text, parse_xml, #relationship, #reload, #replace, set_value, #update, #update!, xml_to_actions, xml_to_hash, xml_to_nokogiri, xml_to_relationships

Methods included from Logging

#logger

Constructor Details

This class inherits a constructor from Ovirt::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ovirt::Base

Class Method Details

.parse_node_extended(node, hash) ⇒ Object



6
7
8
9
# File 'lib/ovirt/nic.rb', line 6

def self.parse_node_extended(node, hash)
  parse_first_node(node, :network, hash, :node      => [:name])
  parse_first_node(node, :mac,     hash, :attribute => [:address])
end

Instance Method Details

#apply_options!(options) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/ovirt/nic.rb', line 17

def apply_options!(options)
  update! do |xml|
    xml.name options[:name]                     if options[:name]
    xml.interface options[:interface]           if options[:interface]
    xml.network(:id => options[:network_id])    if options[:network_id]
    xml.mac(:address => options[:mac_address])  if options[:mac_address]
  end
end

#attributes_for_new_nicObject



11
12
13
14
15
# File 'lib/ovirt/nic.rb', line 11

def attributes_for_new_nic
  attrs = attributes.dup
  attrs[:network_id] = self[:network][:id]
  attrs
end