Class: Lsmpio_entry

Inherits:
Object
  • Object
show all
Defined in:
lib/AIX/lsmpio_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string = '') ⇒ Lsmpio_entry

Returns a new instance of Lsmpio_entry.



15
16
17
18
19
# File 'lib/AIX/lsmpio_entry.rb', line 15

def initialize(string = '')
  @string_raw = ''
  @_parsed = false
  parse(string) unless string.empty?
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



9
10
11
# File 'lib/AIX/lsmpio_entry.rb', line 9

def connection
  @connection
end

#connection_diskObject (readonly)

Returns the value of attribute connection_disk.



11
12
13
# File 'lib/AIX/lsmpio_entry.rb', line 11

def connection_disk
  @connection_disk
end

#connection_portObject (readonly)

Returns the value of attribute connection_port.



10
11
12
# File 'lib/AIX/lsmpio_entry.rb', line 10

def connection_port
  @connection_port
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/AIX/lsmpio_entry.rb', line 4

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



8
9
10
# File 'lib/AIX/lsmpio_entry.rb', line 8

def parent
  @parent
end

#path_idObject (readonly)

Returns the value of attribute path_id.



5
6
7
# File 'lib/AIX/lsmpio_entry.rb', line 5

def path_id
  @path_id
end

#path_statusObject (readonly)

Returns the value of attribute path_status.



7
8
9
# File 'lib/AIX/lsmpio_entry.rb', line 7

def path_status
  @path_status
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/AIX/lsmpio_entry.rb', line 6

def status
  @status
end

#string_rawObject (readonly)

Returns the value of attribute string_raw.



2
3
4
# File 'lib/AIX/lsmpio_entry.rb', line 2

def string_raw
  @string_raw
end

#viosname=(value) ⇒ Object (writeonly)

Sets the attribute viosname

Parameters:

  • value

    the value to set the attribute viosname to.



13
14
15
# File 'lib/AIX/lsmpio_entry.rb', line 13

def viosname=(value)
  @viosname = value
end

Instance Method Details

#parse(string) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/AIX/lsmpio_entry.rb', line 21

def parse(string)
  @string_raw = string

  regexp = %r{(hdisk\d+)\s+(\d+)\s+(Enabled|Disabled|Failed|Missing)\s+([\w\,]+)\s+(fscsi\d+)\s+(\w+)\,(\w+)}

  if match = regexp.match(string)
    @name = match[1]
    @path_id = match[2].to_i
    @status = match[3]
    @path_status = match[4]
    @parent = match[5]
    @connection = match[6] + ',' + match[7]
    @connection_port = match[6]
    @connection_disk = match[7]
  else
    print "Wrong line:>" + line + "<\n"
  end
end

#to_s(space1_size, space2_size) ⇒ Object



40
41
42
43
# File 'lib/AIX/lsmpio_entry.rb', line 40

def to_s(space1_size, space2_size)

  "#{@name}  #{@path_id}   #{@status} #{@path_status} #{@parent} #{@connection}"
end