Class: Lpar_profile

Inherits:
Object
  • Object
show all
Defined in:
lib/HMC/Lpar_profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lpar_id = '', profile_name = 'normal') ⇒ Lpar_profile

Returns a new instance of Lpar_profile.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/HMC/Lpar_profile.rb', line 102

def initialize(lpar_id = '', profile_name = 'normal')
  string = ''

  @_null_zero_none_equal = false

  if lpar_id.class.to_s == 'String'
    if lpar_id.include?('=')
      string = lpar_id
      lpar_id = ''
    end
  end

  @lpar_id = lpar_id
  @name    = profile_name

  @_variables = {}
  @_variables['variables_int'] = %w[lpar_id min_mem desired_mem max_mem all_resources min_procs desired_procs
                                    max_procs max_virtual_slots
                                    auto_start conn_monitoring uncap_weight bsr_arrays shared_proc_pool_id]
  @_variables['variables_float'] = %w[min_proc_units desired_proc_units max_proc_units mem_expansion]

  @_variables['string'] = %w[ name lpar_name lpar_env mem_mode proc_mode sharing_mode
                              lpar_io_pool_ids boot_mode
                              power_ctrl_lpar_ids work_group_id redundant_err_path_reporting hpt_ratio
                              affinity_group_id lhea_capabilities lpar_proc_compat_mode lhea_capabilities
                              lpar_proc_compat_mode electronic_err_reporting min_num_huge_pages desired_num_huge_pages
                              max_num_huge_pages shared_proc_pool_name sni_device_ids ]

  @_variables['string_raw'] = %w[ hca_adapters vtpm_adapters virtual_vasi_adapters virtual_eth_vsi_profiles
                                  sriov_eth_logical_ports vnic_adapters sriov_eth_logical_ports ]


  @_variables['string_virtual_raw'] = %w[virtual_serial_adapters virtual_scsi_adapters virtual_eth_adapters
                                         virtual_fc_adapters]

  @_functions_self = %w[io_slots hca_adapters vtpm_adapters lhea_logical_ports sriov_eth_logical_ports
                        virtual_vasi_adapters virtual_eth_vsi_profiles vnic_adapters]
  @_functions_virtual_slots = %w[ virtual_serial_adapters virtual_scsi_adapters virtual_eth_adapters  virtual_fc_adapters]



  @_default_params = {}
  @_default_params['power5'] = %w[name lpar_name lpar_id lpar_env all_resources min_mem desired_mem max_mem
    min_num_huge_pages desired_num_huge_pages max_num_huge_pages mem_mode hpt_ratio proc_mode min_proc_units
    desired_proc_units max_proc_units min_procs desired_procs max_procs sharing_mode uncap_weight
    io_slots lpar_io_pool_ids max_virtual_slots virtual_serial_adapters virtual_scsi_adapters virtual_eth_adapters
    hca_adapters boot_mode conn_monitoring auto_start power_ctrl_lpar_ids work_group_id redundant_err_path_reporting ]

  @lhea_logical_ports = []
  @hca_adapters = []
  @io_slots = []

  @_compatibility = 'power5'
  @_parameter_order = []

  @sriov_eth_logical_ports = nil
  @vtpm_adapters = nil
  @virtual_vasi_adapters = nil
  @virtual_eth_vsi_profiles = nil

  @hca_adapters_raw = nil
  @vtpm_adapters_raw = nil
  @virtual_eth_vsi_profiles_raw = nil
  @virtual_vasi_adapters_raw = nil
  @sriov_eth_logical_ports_raw = nil
  @sys = nil
  @lpar_name = nil


  @virtual_slots = Lpar_virtual_slots.new
  @virtual_slots.profile_name=@name

  unless string.empty?
    parse(string)
  end

end

Instance Attribute Details

#_compatibilityObject

own attributes



94
95
96
# File 'lib/HMC/Lpar_profile.rb', line 94

def _compatibility
  @_compatibility
end

#_default_paramsObject (readonly)

Returns the value of attribute _default_params.



96
97
98
# File 'lib/HMC/Lpar_profile.rb', line 96

def _default_params
  @_default_params
end

#_null_zero_none_equalObject

Returns the value of attribute _null_zero_none_equal.



99
100
101
# File 'lib/HMC/Lpar_profile.rb', line 99

def _null_zero_none_equal
  @_null_zero_none_equal
end

#_parameter_orderObject (readonly)

Returns the value of attribute _parameter_order.



95
96
97
# File 'lib/HMC/Lpar_profile.rb', line 95

def _parameter_order
  @_parameter_order
end

#affinity_group_idObject

Returns the value of attribute affinity_group_id.



60
61
62
# File 'lib/HMC/Lpar_profile.rb', line 60

def affinity_group_id
  @affinity_group_id
end

#all_resourcesObject

Returns the value of attribute all_resources.



16
17
18
# File 'lib/HMC/Lpar_profile.rb', line 16

def all_resources
  @all_resources
end

#allow_perf_collectionObject

Returns the value of attribute allow_perf_collection.



50
51
52
# File 'lib/HMC/Lpar_profile.rb', line 50

def allow_perf_collection
  @allow_perf_collection
end

#auto_startObject

Returns the value of attribute auto_start.



40
41
42
# File 'lib/HMC/Lpar_profile.rb', line 40

def auto_start
  @auto_start
end

#boot_modeObject

Returns the value of attribute boot_mode.



52
53
54
# File 'lib/HMC/Lpar_profile.rb', line 52

def boot_mode
  @boot_mode
end

#bsr_arraysObject

Returns the value of attribute bsr_arrays.



61
62
63
# File 'lib/HMC/Lpar_profile.rb', line 61

def bsr_arrays
  @bsr_arrays
end

#conn_monitoringObject

Returns the value of attribute conn_monitoring.



41
42
43
# File 'lib/HMC/Lpar_profile.rb', line 41

def conn_monitoring
  @conn_monitoring
end

#curr_profileObject

Returns the value of attribute curr_profile.



47
48
49
# File 'lib/HMC/Lpar_profile.rb', line 47

def curr_profile
  @curr_profile
end

#default_profileObject

Returns the value of attribute default_profile.



46
47
48
# File 'lib/HMC/Lpar_profile.rb', line 46

def default_profile
  @default_profile
end

#desired_memObject

Returns the value of attribute desired_mem.



18
19
20
# File 'lib/HMC/Lpar_profile.rb', line 18

def desired_mem
  @desired_mem
end

#desired_num_huge_pagesObject

Returns the value of attribute desired_num_huge_pages.



23
24
25
# File 'lib/HMC/Lpar_profile.rb', line 23

def desired_num_huge_pages
  @desired_num_huge_pages
end

#desired_proc_unitsObject

Returns the value of attribute desired_proc_units.



28
29
30
# File 'lib/HMC/Lpar_profile.rb', line 28

def desired_proc_units
  @desired_proc_units
end

#desired_procsObject

Returns the value of attribute desired_procs.



31
32
33
# File 'lib/HMC/Lpar_profile.rb', line 31

def desired_procs
  @desired_procs
end

#electronic_err_reportingObject

Returns the value of attribute electronic_err_reporting.



64
65
66
# File 'lib/HMC/Lpar_profile.rb', line 64

def electronic_err_reporting
  @electronic_err_reporting
end

#hca_adaptersObject (readonly)

Returns the value of attribute hca_adapters.



73
74
75
# File 'lib/HMC/Lpar_profile.rb', line 73

def hca_adapters
  @hca_adapters
end

#hca_adapters_rawObject

Returns the value of attribute hca_adapters_raw.



77
78
79
# File 'lib/HMC/Lpar_profile.rb', line 77

def hca_adapters_raw
  @hca_adapters_raw
end

#hpt_ratioObject

Returns the value of attribute hpt_ratio.



21
22
23
# File 'lib/HMC/Lpar_profile.rb', line 21

def hpt_ratio
  @hpt_ratio
end

#io_slotsObject (readonly)

Returns the value of attribute io_slots.



66
67
68
# File 'lib/HMC/Lpar_profile.rb', line 66

def io_slots
  @io_slots
end

#io_slots_rawObject

Returns the value of attribute io_slots_raw.



67
68
69
# File 'lib/HMC/Lpar_profile.rb', line 67

def io_slots_raw
  @io_slots_raw
end

#lhea_capabilitiesObject

Returns the value of attribute lhea_capabilities.



63
64
65
# File 'lib/HMC/Lpar_profile.rb', line 63

def lhea_capabilities
  @lhea_capabilities
end

#lhea_logical_portsObject (readonly)

Returns the value of attribute lhea_logical_ports.



71
72
73
# File 'lib/HMC/Lpar_profile.rb', line 71

def lhea_logical_ports
  @lhea_logical_ports
end

#lhea_logical_ports_rawObject

Returns the value of attribute lhea_logical_ports_raw.



75
76
77
# File 'lib/HMC/Lpar_profile.rb', line 75

def lhea_logical_ports_raw
  @lhea_logical_ports_raw
end

#logical_serial_numObject

Returns the value of attribute logical_serial_num.



45
46
47
# File 'lib/HMC/Lpar_profile.rb', line 45

def logical_serial_num
  @logical_serial_num
end

#lpar_envObject

Returns the value of attribute lpar_env.



15
16
17
# File 'lib/HMC/Lpar_profile.rb', line 15

def lpar_env
  @lpar_env
end

#lpar_idObject

Returns the value of attribute lpar_id.



14
15
16
# File 'lib/HMC/Lpar_profile.rb', line 14

def lpar_id
  @lpar_id
end

#lpar_io_pool_idsObject

Returns the value of attribute lpar_io_pool_ids.



36
37
38
# File 'lib/HMC/Lpar_profile.rb', line 36

def lpar_io_pool_ids
  @lpar_io_pool_ids
end

#lpar_io_pool_ids_rawObject

Returns the value of attribute lpar_io_pool_ids_raw.



37
38
39
# File 'lib/HMC/Lpar_profile.rb', line 37

def lpar_io_pool_ids_raw
  @lpar_io_pool_ids_raw
end

#lpar_keylockObject

Returns the value of attribute lpar_keylock.



53
54
55
# File 'lib/HMC/Lpar_profile.rb', line 53

def lpar_keylock
  @lpar_keylock
end

#lpar_nameObject

Returns the value of attribute lpar_name.



12
13
14
# File 'lib/HMC/Lpar_profile.rb', line 12

def lpar_name
  @lpar_name
end

#lpar_proc_compat_modeObject

Returns the value of attribute lpar_proc_compat_mode.



62
63
64
# File 'lib/HMC/Lpar_profile.rb', line 62

def lpar_proc_compat_mode
  @lpar_proc_compat_mode
end

#max_memObject

Returns the value of attribute max_mem.



19
20
21
# File 'lib/HMC/Lpar_profile.rb', line 19

def max_mem
  @max_mem
end

#max_num_huge_pagesObject

Returns the value of attribute max_num_huge_pages.



24
25
26
# File 'lib/HMC/Lpar_profile.rb', line 24

def max_num_huge_pages
  @max_num_huge_pages
end

#max_proc_unitsObject

Returns the value of attribute max_proc_units.



29
30
31
# File 'lib/HMC/Lpar_profile.rb', line 29

def max_proc_units
  @max_proc_units
end

#max_procsObject

Returns the value of attribute max_procs.



32
33
34
# File 'lib/HMC/Lpar_profile.rb', line 32

def max_procs
  @max_procs
end

#max_virtual_slotsObject

Returns the value of attribute max_virtual_slots.



38
39
40
# File 'lib/HMC/Lpar_profile.rb', line 38

def max_virtual_slots
  @max_virtual_slots
end

#mem_expansionObject

Returns the value of attribute mem_expansion.



59
60
61
# File 'lib/HMC/Lpar_profile.rb', line 59

def mem_expansion
  @mem_expansion
end

#mem_modeObject

Returns the value of attribute mem_mode.



20
21
22
# File 'lib/HMC/Lpar_profile.rb', line 20

def mem_mode
  @mem_mode
end

#min_memObject

Returns the value of attribute min_mem.



17
18
19
# File 'lib/HMC/Lpar_profile.rb', line 17

def min_mem
  @min_mem
end

#min_num_huge_pagesObject

Returns the value of attribute min_num_huge_pages.



22
23
24
# File 'lib/HMC/Lpar_profile.rb', line 22

def min_num_huge_pages
  @min_num_huge_pages
end

#min_proc_unitsObject

Returns the value of attribute min_proc_units.



27
28
29
# File 'lib/HMC/Lpar_profile.rb', line 27

def min_proc_units
  @min_proc_units
end

#min_procsObject

Returns the value of attribute min_procs.



30
31
32
# File 'lib/HMC/Lpar_profile.rb', line 30

def min_procs
  @min_procs
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/HMC/Lpar_profile.rb', line 11

def name
  @name
end

#os_versionObject

Returns the value of attribute os_version.



44
45
46
# File 'lib/HMC/Lpar_profile.rb', line 44

def os_version
  @os_version
end

#power_ctrl_lpar_idsObject

Returns the value of attribute power_ctrl_lpar_ids.



51
52
53
# File 'lib/HMC/Lpar_profile.rb', line 51

def power_ctrl_lpar_ids
  @power_ctrl_lpar_ids
end

#proc_modeObject

Returns the value of attribute proc_mode.



26
27
28
# File 'lib/HMC/Lpar_profile.rb', line 26

def proc_mode
  @proc_mode
end

#redundant_err_path_reportingObject

Returns the value of attribute redundant_err_path_reporting.



54
55
56
# File 'lib/HMC/Lpar_profile.rb', line 54

def redundant_err_path_reporting
  @redundant_err_path_reporting
end

#resource_configObject

Returns the value of attribute resource_config.



43
44
45
# File 'lib/HMC/Lpar_profile.rb', line 43

def resource_config
  @resource_config
end

#rmc_ipaddrObject

Returns the value of attribute rmc_ipaddr.



56
57
58
# File 'lib/HMC/Lpar_profile.rb', line 56

def rmc_ipaddr
  @rmc_ipaddr
end

#rmc_stateObject

Returns the value of attribute rmc_state.



55
56
57
# File 'lib/HMC/Lpar_profile.rb', line 55

def rmc_state
  @rmc_state
end

#shared_proc_pool_util_authObject

Returns the value of attribute shared_proc_pool_util_auth.



49
50
51
# File 'lib/HMC/Lpar_profile.rb', line 49

def shared_proc_pool_util_auth
  @shared_proc_pool_util_auth
end

#sharing_modeObject

Returns the value of attribute sharing_mode.



34
35
36
# File 'lib/HMC/Lpar_profile.rb', line 34

def sharing_mode
  @sharing_mode
end

#sni_device_idsObject

Returns the value of attribute sni_device_ids.



86
87
88
# File 'lib/HMC/Lpar_profile.rb', line 86

def sni_device_ids
  @sni_device_ids
end

#sriov_eth_logical_portsObject (readonly)

ports



70
71
72
# File 'lib/HMC/Lpar_profile.rb', line 70

def sriov_eth_logical_ports
  @sriov_eth_logical_ports
end

#sriov_eth_logical_ports_rawObject

Returns the value of attribute sriov_eth_logical_ports_raw.



78
79
80
# File 'lib/HMC/Lpar_profile.rb', line 78

def sriov_eth_logical_ports_raw
  @sriov_eth_logical_ports_raw
end

#sync_curr_profileObject

Returns the value of attribute sync_curr_profile.



57
58
59
# File 'lib/HMC/Lpar_profile.rb', line 57

def sync_curr_profile
  @sync_curr_profile
end

#sysObject

Returns the value of attribute sys.



10
11
12
# File 'lib/HMC/Lpar_profile.rb', line 10

def sys
  @sys
end

#uncap_weightObject

Returns the value of attribute uncap_weight.



35
36
37
# File 'lib/HMC/Lpar_profile.rb', line 35

def uncap_weight
  @uncap_weight
end

#virtual_eth_vsi_profilesObject (readonly)

Returns the value of attribute virtual_eth_vsi_profiles.



81
82
83
# File 'lib/HMC/Lpar_profile.rb', line 81

def virtual_eth_vsi_profiles
  @virtual_eth_vsi_profiles
end

#virtual_eth_vsi_profiles_rawObject (readonly)

Returns the value of attribute virtual_eth_vsi_profiles_raw.



84
85
86
# File 'lib/HMC/Lpar_profile.rb', line 84

def virtual_eth_vsi_profiles_raw
  @virtual_eth_vsi_profiles_raw
end

#virtual_slotsObject (readonly)

Returns the value of attribute virtual_slots.



98
99
100
# File 'lib/HMC/Lpar_profile.rb', line 98

def virtual_slots
  @virtual_slots
end

#virtual_vasi_adaptersObject (readonly)

Returns the value of attribute virtual_vasi_adapters.



80
81
82
# File 'lib/HMC/Lpar_profile.rb', line 80

def virtual_vasi_adapters
  @virtual_vasi_adapters
end

#virtual_vasi_adapters_rawObject

Returns the value of attribute virtual_vasi_adapters_raw.



83
84
85
# File 'lib/HMC/Lpar_profile.rb', line 83

def virtual_vasi_adapters_raw
  @virtual_vasi_adapters_raw
end

#vnic_adaptersObject (readonly)

Returns the value of attribute vnic_adapters.



91
92
93
# File 'lib/HMC/Lpar_profile.rb', line 91

def vnic_adapters
  @vnic_adapters
end

#vnic_adapters_rawObject (readonly)

taken from: www.ibm.com/support/knowledgecenter/en/POWER8/p8edm/lssyscfg.html (see description of -F parameter)



90
91
92
# File 'lib/HMC/Lpar_profile.rb', line 90

def vnic_adapters_raw
  @vnic_adapters_raw
end

#vtpm_adaptersObject (readonly)

Returns the value of attribute vtpm_adapters.



72
73
74
# File 'lib/HMC/Lpar_profile.rb', line 72

def vtpm_adapters
  @vtpm_adapters
end

#vtpm_adapters_rawObject

Returns the value of attribute vtpm_adapters_raw.



76
77
78
# File 'lib/HMC/Lpar_profile.rb', line 76

def vtpm_adapters_raw
  @vtpm_adapters_raw
end

#work_group_idObject

Returns the value of attribute work_group_id.



48
49
50
# File 'lib/HMC/Lpar_profile.rb', line 48

def work_group_id
  @work_group_id
end

Instance Method Details

#==(other) ⇒ Object



390
391
392
# File 'lib/HMC/Lpar_profile.rb', line 390

def ==(other)
  to_s == other.to_s
end

#adapter_add(adapter) ⇒ Object



180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/HMC/Lpar_profile.rb', line 180

def adapter_add(adapter)

  case adapter.class.to_s
  when 'VirtualEthAdapter'    then virtual_slots.virtual_eth_adapters_add(adapter)
  when 'VirtualScsiAdapter'   then virtual_slots.virtual_scsi_adapters_add(adapter)
  when 'VirtualSerialAdapter' then virtual_slots.virtual_serial_adapters_add(adapter)
  when 'VirtualFCAdapter'     then virtual_slots.virtual_fc_adapters_add(adapter)
  else
    pp 'adapter class:' +  adapter.class
    raise 'unknown type of Virtual Adapter'
  end
end

#diff_show(another_profile, columns_to_compare = 'all', columns_to_ignore = 'none') ⇒ Object



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/HMC/Lpar_profile.rb', line 394

def diff_show(another_profile, columns_to_compare = 'all', columns_to_ignore = 'none')

  diffs = {}
  ignore = columns_to_ignore.split(',')
  compare = columns_to_compare.split(',')

  @_variables.keys.each { |type|
    @_variables[type].each { |name|

      next if ignore.include?(name)
      next if columns_to_compare != 'all' && !compare.include?(name)

      if type == 'string_virtual_raw'
        diffs.merge!(virtual_slots.diff(another_profile.virtual_slots, type))
        next
      end

      val_self    = instance_variable_get("@#{name}")
      val_profile = another_profile.instance_variable_get("@#{name}")

      if val_self != val_profile
        val_self    = 'nil' if val_self.nil?
        val_profile = 'nil' if val_profile.nil?

        if @_null_zero_none_equal
          next if (val_self.to_s == '0' or val_self == 'null' or val_self == 'none') and (val_profile.to_s == '0' or val_profile == 'null' or val_profile == 'none')
        end

        difference = {}
        difference[another_profile.name] = val_profile
        difference[self.name]            = val_self

        diffs[name] = difference
      end

    }
  }

  diffs
end

#hca_adapters_to_sObject



213
214
215
216
# File 'lib/HMC/Lpar_profile.rb', line 213

def hca_adapters_to_s
  # TODO: it should have separate class of each adapter and function to analyze it (not used now on my Power5)
  'none' unless @hca_adapters_raw.nil?
end

#io_slots_to_sObject



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/HMC/Lpar_profile.rb', line 193

def io_slots_to_s

  result = nil
  unless @io_slots_raw.nil?
    if @io_slots.size == 0
      result =  'none'
    elsif @io_slots.size == 1
      result = @io_slots[0].join('/')
    else
      adapters = []
      @io_slots.each do |adapter|
        adapters.push(adapter.to_s)
      end
      result = adapters.join(',')
    end
  end

  result
end

#lhea_logical_ports_to_sObject



228
229
230
231
232
233
# File 'lib/HMC/Lpar_profile.rb', line 228

def lhea_logical_ports_to_s
  # TODO: it should have separate class of each adapter and function to analyze it (not used now on my Power5)
  unless @lhea_logical_ports_raw.nil?
    @lhea_logical_ports_raw
  end
end

#lssyscfgProfDecode(string) ⇒ Object Also known as: parse



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/HMC/Lpar_profile.rb', line 320

def lssyscfgProfDecode(string)

  string.delete!("\n")
  string.delete!("\r")

  HmcString.parse(string).each { |name, value|

    if @_variables['variables_int'].include?(name)
      instance_variable_set("@#{name}", value.to_i)
    elsif @_variables['variables_float'].include?(name)
      instance_variable_set("@#{name}", value.to_f)
    elsif @_variables['string_virtual_raw'].include?(name)

      case name
      when 'virtual_fc_adapters'     then @virtual_slots.virtual_fc_adapters_raw = value
      when 'virtual_eth_adapters'    then @virtual_slots.virtual_eth_adapters_raw = value
      when 'virtual_scsi_adapters'   then @virtual_slots.virtual_scsi_adapters_raw = value
      when 'virtual_serial_adapters' then @virtual_slots.virtual_serial_adapters_raw = value
      else
        raise 'unknown virtual slot type' + name
      end
    elsif name == 'io_slots'
      self.io_slots_raw = value
    elsif name == 'lhea_logical_ports'
      self.lhea_logical_ports_raw = value
    elsif @_variables['string_raw'].include?(name)
      instance_variable_set("@#{name}_raw", value.to_s)
    elsif @_variables['string'].include?(name)
      instance_variable_set("@#{name}", value.to_s)
    else
      print "unknown name: #{name} with value #{value}"
      raise
    end

    @_parameter_order.push(name)
  }

  @virtual_slots.profile_name=@name

  if to_s != string
    puts 'Incoming string:'
    pp string
    puts 'Analysed data as result of to_s:'
    puts to_s
    raise 'wrong parsing of profile string'
  end

end

#mksyscfg_cmdObject



312
313
314
# File 'lib/HMC/Lpar_profile.rb', line 312

def mksyscfg_cmd
  "mksyscfg -r lpar -m #{@sys} -i \"" + to_s + '"'
end

#remove_cmdObject



316
317
318
# File 'lib/HMC/Lpar_profile.rb', line 316

def remove_cmd
  "rmsyscfg -m #{@sys} -r lpar -n #{@lpar_name}"
end

#sriov_eth_logical_ports_to_sObject



242
243
244
245
246
247
# File 'lib/HMC/Lpar_profile.rb', line 242

def sriov_eth_logical_ports_to_s
  # TODO: it should have separate class of each adapter and function to analyze it (not used now on my Power5)
  unless @sriov_eth_logical_ports_raw.nil?
    'none'
  end
end

#to_s(params = 'all', exclude_cols = 'none') ⇒ Object

the result of command it the same as: lssyscfg -r prof -m $FRAME



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/HMC/Lpar_profile.rb', line 257

def to_s(params='all', exclude_cols='none')

  result_array = []

  if params == 'all'
    if @_parameter_order.count > 0
      params_to_print = @_parameter_order
    else
      params_to_print = @_default_params[@_compatibility]
    end
  else
    params_to_print = params.split(',')
  end

  if exclude_cols != 'none'
    exclude_cols.split(',').each { |column|
      params_to_print.delete(column)
    }
  end

  params_to_print.each do |parameter|

    if @_functions_self.include?(parameter)

      tmp = send("#{parameter}_to_s")
      tmp = make_string(parameter, tmp)
      result_array.push(tmp) unless tmp.nil?

    elsif @_functions_virtual_slots.include?(parameter)

      tmp = @virtual_slots.send("#{parameter}_to_s")
      tmp = make_string(parameter, tmp)
      result_array.push(tmp) unless tmp.nil?

    else
      unless instance_variable_get("@#{parameter}").nil?
        result_array.push(make_string(parameter, instance_variable_get("@#{parameter}").to_s))
      end
    end
  end

  result_array.join(',')
end

#virtual_eth_vsi_profiles_to_sObject



223
224
225
226
# File 'lib/HMC/Lpar_profile.rb', line 223

def virtual_eth_vsi_profiles_to_s
  # TODO: it should have separate class of each adapter and function to analyze it (not used now on my Power5)
  'none' unless @virtual_eth_vsi_profiles_raw.nil?
end

#virtual_vasi_adapters_to_sObject



235
236
237
238
239
240
# File 'lib/HMC/Lpar_profile.rb', line 235

def virtual_vasi_adapters_to_s
  # TODO: it should have separate class of each adapter and function to analyze it (not used now on my Power5)
  unless @virtual_vasi_adapters_raw.nil?
    'none'
  end
end

#vlansObject



301
302
303
304
305
306
307
308
309
310
# File 'lib/HMC/Lpar_profile.rb', line 301

def vlans
  result = []
  virtual_slots.virtual_eth_adapters.each { |adapter|
    result.push(adapter.portVlanID)
    adapter.additionalVlanIDs.split(',').each { |vlan|
      result.push(vlan)
    }
  }
  result.sort
end

#vnic_adapters_to_sObject



249
250
251
252
253
254
# File 'lib/HMC/Lpar_profile.rb', line 249

def vnic_adapters_to_s
  # TODO: it should have separate class of each adapter and function to analyze it (not used now on my Power5, found in manual on IBM site)
  unless @vnic_adapters_raw.nil?
    'none'
  end
end

#vtpm_adapters_to_sObject



218
219
220
221
# File 'lib/HMC/Lpar_profile.rb', line 218

def vtpm_adapters_to_s
  # TODO: it should have separate class of each adapter and function to analyze it (not used now on my Power5)
  'none' unless @vtpm_adapters_raw.nil?
end