class VCloudSdk::Xml::VirtualHardwareSection

Public Instance Methods

add_item(item) click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb, line 4
def add_item(item)
  system_node = get_nodes("System", nil, true, OVF).first
  system_node.node.after(item.node)
end
cpu() click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb, line 16
def cpu
  hardware.find do |h|
    h.get_rasd_content(RASD_TYPES[:RESOURCE_TYPE]) == HARDWARE_TYPE[:CPU]
  end
end
hard_disks() click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb, line 75
def hard_disks
  items = hardware.select do |h|
    h.get_rasd_content(
    RASD_TYPES[:RESOURCE_TYPE]) == HARDWARE_TYPE[:HARD_DISK]
  end
  items.map { |i| HardDiskItemWrapper.new(i) }
end
hardware() click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb, line 83
def hardware
  get_nodes("Item", nil, false, OVF)
end
highest_instance_id() click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb, line 33
def highest_instance_id
  hardware.map{|h| h.instance_id}.max
end
memory() click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb, line 22
def memory
  hardware.find do |h|
    h.get_rasd_content(RASD_TYPES[:RESOURCE_TYPE]) == HARDWARE_TYPE[:MEMORY]
  end
end
nics() click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb, line 37
def nics
  items = hardware.select do |h|
    h.get_rasd_content(RASD_TYPES[:RESOURCE_TYPE]) == HARDWARE_TYPE[:NIC]
  end
  items.map { |i| NicItemWrapper.new(i) }
end
reconcile_primary_network(primary_index) click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb, line 62
def reconcile_primary_network(primary_index)
  primary_index = primary_index.to_s
  hardware.select do |item|
    item.get_rasd_content(RASD_TYPES[:RESOURCE_TYPE]) == HARDWARE_TYPE[:NIC]
  end.each do |item|
    if item.get_rasd_content(RASD_TYPES[:ADDRESS_ON_PARENT]) == primary_index
      item.get_rasd(RASD_TYPES[:CONNECTION]).attribute("primaryNetworkConnection").value = "true"
    else
      item.get_rasd(RASD_TYPES[:CONNECTION]).attribute("primaryNetworkConnection").value = "false"
    end
  end
end
remove_hw(hw_type, index) click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb, line 48
def remove_hw(hw_type, index)
  index = index.to_s
  item = hardware.find do |h|
    h.get_rasd_content(RASD_TYPES[:RESOURCE_TYPE]) == hw_type &&
      h.get_rasd_content(RASD_TYPES[:ADDRESS_ON_PARENT]) == index
  end
  if item
    item.node.remove
  else
    fail ObjectNotFoundError,
         "Cannot remove hw item #{hw_type}:#{index}, does not exist."
  end
end
remove_nic(index) click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb, line 44
def remove_nic(index)
  remove_hw(HARDWARE_TYPE[:NIC], index)
end
scsi_controller() click to toggle source
# File lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb, line 28
def scsi_controller
  hardware.find { |h| h.get_rasd_content(RASD_TYPES[:RESOURCE_TYPE]) ==
    HARDWARE_TYPE[:SCSI_CONTROLLER] }
end