Class: System
Instance Attribute Summary collapse
-
#hmc ⇒ Object
readonly
Returns the value of attribute hmc.
-
#lpars ⇒ Object
readonly
Returns the value of attribute lpars.
-
#lpars_by_name ⇒ Object
readonly
Returns the value of attribute lpars_by_name.
-
#vioses ⇒ Object
readonly
Returns the value of attribute vioses.
Attributes inherited from Sys
#_variables, #active_lpar_mobility_capable, #active_lpar_share_idle_procs_capable, #active_mem_expansion_capable, #active_mem_sharing_capable, #addr_broadcast_perf_policy_capable, #application_capable_5250, #assign_5250_cpw_percent, #bsr_capable, #cod_mem_capable, #cod_proc_capable, #curr_mfg_default_boot_mode, #curr_mfg_default_ipl_source, #curr_power_on_side, #curr_power_on_speed, #curr_power_on_speed_override, #curr_sys_keylock, #dataString, #detailed_state, #dynamic_platform_optimization_capable, #electronic_err_reporting_capable, #firmware_power_saver_capable, #hardware_active_mem_expansion_capable, #hardware_discovery_capable, #hardware_power_saver_capable, #hca_bandwidth_capabilities, #hca_capable, #huge_page_mem_capable, #inactive_lpar_mobility_capable, #ipaddr, #lhea_capable, #lpar_avail_priority_capable, #lpar_proc_compat_mode_capable, #lpar_remote_restart_capable, #lpar_suspend_capable, #max_lpars, #max_power_ctrl_lpars, #max_remote_restart_capable_lpars, #max_suspend_capable_lpars, #mfg_default_config, #micro_lpar_capable, #name, #os400_capable, #pend_mfg_default_boot_mode, #pend_mfg_default_ipl_source, #pend_power_on_lpar_start_policy, #pend_power_on_option, #pend_power_on_side, #pend_power_on_speed, #pend_power_on_speed_override, #pend_sys_keylock, #power_off_policy, #power_on_attr, #power_on_lpar_start_policy, #power_on_method, #power_on_option, #power_on_type, #powervm_lpar_remote_restart_capable, #redundant_err_path_reporting_capable, #serial_num, #service_lpar_id, #service_lpar_name, #shared_eth_failover_capable, #sni_msg_passing_capable, #sp_boot_attr, #sp_boot_major_type, #sp_boot_minor_type, #sp_failover_capable, #sp_version, #state, #sys, #sys_time, #type_model, #vet_activation_capable, #virtual_fc_capable, #virtual_io_server_capable, #virtual_switch_capable, #vsi_on_veth_capable, #vsn_phase2_capable
Instance Method Summary collapse
- #getLparByName(lparName) ⇒ Object
-
#initialize(name = '', hmc = '') ⇒ System
constructor
A new instance of System.
- #lpar_add(id, name) ⇒ Object
- #lpar_add_adapter(type, string) ⇒ Object
- #lpar_id_exist?(id) ⇒ Boolean
- #lpar_name_exist?(name) ⇒ Boolean
- #parse_raw_data(string) ⇒ Object
Methods inherited from Sys
#dataGet_cmd, #dataSet, #decodeString, #findLparID_cmd, #findLparName_cmd, #getLparsList_cmd, #getLparsScsiSlots_cmd, #getProfiles_cmd, #lslic_cmd, #parse_f, #start_cmd, #start_time, #statusCheck_cmd, #stop_cmd, #type_model_serial
Constructor Details
#initialize(name = '', hmc = '') ⇒ System
Returns a new instance of System.
18 19 20 21 22 23 24 25 |
# File 'lib/Framework/system.rb', line 18 def initialize(name = '', hmc = '') super(name) @lpars = {} @lpars_by_name = {} @vioses = [] @hmc = hmc end |
Instance Attribute Details
#hmc ⇒ Object (readonly)
Returns the value of attribute hmc.
16 17 18 |
# File 'lib/Framework/system.rb', line 16 def hmc @hmc end |
#lpars ⇒ Object (readonly)
Returns the value of attribute lpars.
13 14 15 |
# File 'lib/Framework/system.rb', line 13 def lpars @lpars end |
#lpars_by_name ⇒ Object (readonly)
Returns the value of attribute lpars_by_name.
14 15 16 |
# File 'lib/Framework/system.rb', line 14 def lpars_by_name @lpars_by_name end |
#vioses ⇒ Object (readonly)
Returns the value of attribute vioses.
15 16 17 |
# File 'lib/Framework/system.rb', line 15 def vioses @vioses end |
Instance Method Details
#getLparByName(lparName) ⇒ Object
86 87 88 89 |
# File 'lib/Framework/system.rb', line 86 def getLparByName(lparName) return @lpars[@lpars_by_name[lparName]] if lpar_name_exist?(lparName) false end |
#lpar_add(id, name) ⇒ Object
72 73 74 75 |
# File 'lib/Framework/system.rb', line 72 def lpar_add(id, name) @lpars[id] = Lpar.new(@name, id, name, @hmc) @lpars_by_name[name] = id end |
#lpar_add_adapter(type, string) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/Framework/system.rb', line 57 def lpar_add_adapter(type, string) adapter = case type when 'virtual_eth' then VirtualEthAdapter.new(string) when 'virtual_fc' then VirtualFCAdapter.new(string) when 'virtual_serial' then VirtualSerialAdapter.new(string) when 'virtual_scsi' then VirtualScsiAdapter.new(string) else raise Exception, 'not supported type of adapter' end lpar_add(adapter.lpar_id, adapter.lpar_name) unless lpar_id_exist?(adapter.lpar_id) @lpars[adapter.lpar_id].virtual_adapter_eth_add(adapter) end |
#lpar_id_exist?(id) ⇒ Boolean
77 78 79 |
# File 'lib/Framework/system.rb', line 77 def lpar_id_exist?(id) @lpars.include?(id) end |
#lpar_name_exist?(name) ⇒ Boolean
81 82 83 |
# File 'lib/Framework/system.rb', line 81 def lpar_name_exist?(name) @lpars_by_name.include?(name) end |
#parse_raw_data(string) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/Framework/system.rb', line 27 def parse_raw_data(string) virtual_eth = VirtualEthAdapter.new virtual_scsi = VirtualScsiAdapter.new virtual_serial = VirtualSerialAdapter.new virtual_fc = VirtualFCAdapter.new update_vioses = false string.each_line do |line| next if line =~ /No results were found./ if virtual_eth.can_parse?(line) lpar_add_adapter('virtual_eth', line) elsif virtual_scsi.can_parse?(line) lpar_add_adapter('virtual_scsi', line) elsif virtual_serial.can_parse?(line) lpar_add_adapter('virtual_serial', line) elsif virtual_fc.can_parse?(line) lpar_add_adapter('virtual_fc', line) elsif match = %r{^name=([\w\-]+),lpar_id=(\d+),lpar_env=}.match(line) lpar_add(match[2], match[1]) @lpars[match[2]].lssyscfg_decode(line) update_vioses = true else raise Exception, "Can't parse line >#{line}<" end end vioses_list_update if update_vioses end |