class OVIRT::InstanceType
Instance types are added to oVirt 3.5 and have been updated in oVirt 3.6
Attributes
cores[R]
Common attributes to all oVirt version supported at this time
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 27 @sockets = (xml/'cpu/topology').first[:sockets].to_i 28 @os = { 29 :type => (xml/'os').first[:type], 30 :boot => (xml/'os/boot').collect {|boot| boot[:dev] } 31 } 32 @creation_time = (xml/'creation_time').text 33 @ha = parse_bool((xml/'high_availability/enabled').first.text) 34 @ha_priority = ((xml/'high_availability/priority').first.text rescue nil) 35 @display = { 36 :type => (xml/'display/type').first.text, 37 :monitors => (xml/'display/monitors').first.text, 38 :single_qxl_pci => parse_bool((xml/'display/single_qxl_pci').first.text), 39 :smartcard_enabled => parse_bool((xml/'display/smartcard_enabled').first.text), 40 41 } 42 @usb = parse_bool((xml/'usb/enabled').first.text) 43 @migration_downtime = ((xml/'migration_downtime').first.text) 44 45 # oVirt 3.5 attributes 46 @type = ((xml/'type').first.text rescue nil) 47 @status = ((xml/'status').first.text rescue nil) 48 @cpu_shares = (((xml/'cpu_shares').first.text) rescue nil) 49 potential_bool = ((xml/'bios/boot_menu/enabled').first.text rescue nil) 50 @boot_menu = potential_bool.nil? ? nil : parse_bool(potential_bool) 51 @origin = ((xml/'origin').text rescue nil) 52 potential_bool = ((xml/'stateless').first.text rescue nil) 53 @stateless = potential_bool.nil? ? nil : parse_bool(potential_bool) 54 potential_bool = ((xml/'delete_protected').first.text rescue nil) 55 @delete_protected = potential_bool.nil? ? nil : parse_bool(potential_bool) 56 #@sso = ((xml/'sso/methods').first.text rescue nil) 57 @timezone = ((xml/'timezone').first.text rescue nil) 58 potential_bool = ((xml/'display/allow_override').first.text rescue nil) 59 @display[:allow_override] = potential_bool.nil? ? nil : parse_bool(potential_bool) 60 potential_bool = ((xml/'display/file_transfer_enabled').first.text rescue nil) 61 @display[:file_transfer_enabled] = potential_bool.nil? ? nil : parse_bool(potential_bool) 62 potential_bool = ((xml/'display/copy_paste_enabled').first.text rescue nil) 63 @display[:copy_paste_enabled] = potential_bool.nil? ? nil : parse_bool(potential_bool) 64 65 # oVirt 3.6 attributes 66 @migration = { 67 :auto_converge => ((xml/'migration/auto_converge').first.text rescue nil), 68 :compressed => ((xml/'migration/compressed').first.text rescue nil) 69 } 70 @io_threads = ((xml/'io/threads').first.text rescue nil) 71 @memory_guaranteed = ((xml/'memory_policy/guaranteed').first.text rescue nil) 72 end