Class: Ovirt::Disk

Inherits:
Base
  • Object
show all
Defined in:
lib/ovirt/disk.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



8
9
10
11
12
13
14
15
16
17
# File 'lib/ovirt/disk.rb', line 8

def self.parse_node_extended(node, hash)
  parse_first_node(node, :status, hash, :node => [:state])
  hash[:storage_domains] = node.xpath('storage_domains/storage_domain').collect { |n| hash_from_id_and_href(n) }

  if hash[:size].to_i.zero?
    node.xpath('lun_storage/logical_unit/size').each do |size|
      hash[:size] = size.text.to_i
    end
  end
end

Instance Method Details

#attributes_for_new_diskObject



19
20
21
22
23
# File 'lib/ovirt/disk.rb', line 19

def attributes_for_new_disk
  attrs = attributes.dup
  attrs[:storage] = self[:storage_domains].first[:id]
  attrs
end