Class: Ovirt::StorageDomain

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

.element_nameObject



8
9
10
# File 'lib/ovirt/storage_domain.rb', line 8

def self.element_name
  "storage_domain"
end

.iso_storage_domain(service) ⇒ Object



34
35
36
# File 'lib/ovirt/storage_domain.rb', line 34

def self.iso_storage_domain(service)
  all(service).detect { |s| s[:type] == "iso" }
end

.parse_node_extended(node, hash) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ovirt/storage_domain.rb', line 12

def self.parse_node_extended(node, hash)
  parse_first_node(node, :status,  hash, :node => [:state])
  parse_first_node(node, :storage, hash, :node => [:type, :address, :path])
  parse_first_node(node, :storage, hash, :attribute => [:id])

  node.xpath('storage/volume_group').each do |vg|
    node.xpath('storage').each do |storage_node|
      parse_first_node(storage_node, :volume_group, hash[:storage], :attribute => [:id])
    end

    vg_hash = hash[:storage][:volume_group]
    unless vg_hash.blank?
      parse_first_node(vg, :logical_unit, vg_hash, :attribute => [:id])

      unless vg_hash.blank?
        parse_first_node(vg, :logical_unit, vg_hash,
                         :node => [:address, :port, :target, :username, :serial, :vendor_id, :product_id, :lun_mapping, :portal, :size, :paths])
      end
    end
  end
end

Instance Method Details

#iso_imagesObject



38
39
40
41
# File 'lib/ovirt/storage_domain.rb', line 38

def iso_images
  return [] if self[:type] != "iso"
  @service.standard_collection(relationships[:files], 'file')
end