class OVIRT::InstanceType

Instance types are added to oVirt 3.5 and have been updated in oVirt 3.6

Attributes

boot_menu[R]

oVirt 3.5 attributes

cores[R]

Common attributes to all oVirt version supported at this time

cpu_shares[R]

oVirt 3.5 attributes

creation_time[R]

Common attributes to all oVirt version supported at this time

delete_protected[R]
description[R]

Common attributes to all oVirt version supported at this time

display[R]
ha[R]
ha_priority[R]
io_threads[R]

oVirt 3.6 attributes

memory[R]

Common attributes to all oVirt version supported at this time

memory_guaranteed[R]

oVirt 3.6 attributes

migration[R]

oVirt 3.6 attributes

migration_downtime[R]
name[R]

Common attributes to all oVirt version supported at this time

origin[R]

oVirt 3.5 attributes

os[R]

Common attributes to all oVirt version supported at this time

sso[R]
stateless[R]

oVirt 3.5 attributes

status[R]

oVirt 3.5 attributes

timezone[R]
type[R]

oVirt 3.5 attributes

usb[R]

Public Class Methods

new(client, xml) click to toggle source
Calls superclass method OVIRT::BaseObject::new
   # File lib/ovirt/instance_type.rb
15 def initialize(client, xml)
16   super(client, xml[:id], xml[:href], (xml/'name').first.text)
17   parse_xml_attributes!(xml)
18   self
19 end

Private Instance Methods

parse_xml_attributes!(xml) click to toggle source
   # File lib/ovirt/instance_type.rb
22 def parse_xml_attributes!(xml)
23   # Common attributes
24   @description = ((xml/'description').first.text rescue '')
25   @memory = (xml/'memory').first.text
26   @cores = ((xml/'cpu/topology').first[:cores].to_i * (xml/'cpu/topology').first[:sockets].to_i rescue nil)
27   @os = {
28       :type => (xml/'os').first[:type],
29       :boot => (xml/'os/boot').collect {|boot| boot[:dev] }
30   }
31   @creation_time = (xml/'creation_time').text
32   @ha = parse_bool((xml/'high_availability/enabled').first.text)
33   @ha_priority = ((xml/'high_availability/priority').first.text rescue nil)
34   @display = {
35     :type => (xml/'display/type').first.text,
36     :monitors => (xml/'display/monitors').first.text,
37     :single_qxl_pci => parse_bool((xml/'display/single_qxl_pci').first.text),
38     :smartcard_enabled => parse_bool((xml/'display/smartcard_enabled').first.text),
39 
40   }
41   @usb = parse_bool((xml/'usb/enabled').first.text)
42   @migration_downtime = ((xml/'migration_downtime').first.text)
43 
44   # oVirt 3.5 attributes
45   @type = ((xml/'type').first.text rescue nil)
46   @status = ((xml/'status').first.text rescue nil)
47   @cpu_shares = (((xml/'cpu_shares').first.text) rescue nil)
48   potential_bool = ((xml/'bios/boot_menu/enabled').first.text rescue nil)
49   @boot_menu = potential_bool.nil? ? nil : parse_bool(potential_bool)
50   @origin = ((xml/'origin').text rescue nil)
51   potential_bool = ((xml/'stateless').first.text rescue nil)
52   @stateless = potential_bool.nil? ? nil : parse_bool(potential_bool)
53   potential_bool = ((xml/'delete_protected').first.text rescue nil)
54   @delete_protected = potential_bool.nil? ? nil : parse_bool(potential_bool)
55   #@sso = ((xml/'sso/methods').first.text rescue nil)
56   @timezone = ((xml/'timezone').first.text rescue nil)
57   potential_bool = ((xml/'display/allow_override').first.text rescue nil)
58   @display[:allow_override] = potential_bool.nil? ? nil : parse_bool(potential_bool)
59   potential_bool = ((xml/'display/file_transfer_enabled').first.text rescue nil)
60   @display[:file_transfer_enabled] = potential_bool.nil? ? nil : parse_bool(potential_bool)
61   potential_bool = ((xml/'display/copy_paste_enabled').first.text rescue nil)
62   @display[:copy_paste_enabled] = potential_bool.nil? ? nil : parse_bool(potential_bool)
63 
64   # oVirt 3.6 attributes
65   @migration = {
66     :auto_converge => ((xml/'migration/auto_converge').first.text rescue nil),
67     :compressed => ((xml/'migration/compressed').first.text rescue nil)
68   }
69   @io_threads = ((xml/'io/threads').first.text rescue nil)
70   @memory_guaranteed = ((xml/'memory_policy/guaranteed').first.text rescue nil)
71 end