Class: Lsvg

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Lsvg

Returns a new instance of Lsvg.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/AIX/Lsvg.rb', line 39

def initialize(string)

  @data_string_raw=''


  @volume_group = nil
  @vg_state = nil
  @vg_identifier = nil
  @vg_state = nil
  @pp_size = nil
  @vg_permission = nil
  @total_pps = nil
  @max_lvs = nil
  @free_pps = nil
  @used_pps = nil
  @lvs = nil
  @open_lvs = nil
  @quorum = nil
  @total_pvs = nil
  @vg_descriptors = nil
  @active_pvs = nil
  @stale_pvs = nil
  @stale_pps = nil
  @auto_on = nil
  @max_pps_per_vg = nil
  @max_pps_per_pv = nil
  @max_pvs = nil
  @ltg_size_dynamic = nil
  @auto_sync = nil
  @hot_spare = nil
  @bb_policy = nil

  @pv_restriction = nil
  @infinite_retry = nil

  @disk_block_size = nil
  @critical_vg = nil


  if string.length > 0
    @data_string_raw = string
    self.parse(string)
  end
end

Instance Attribute Details

#active_pvsObject (readonly)

Returns the value of attribute active_pvs.



20
21
22
# File 'lib/AIX/Lsvg.rb', line 20

def active_pvs
  @active_pvs
end

#auto_onObject (readonly)

Returns the value of attribute auto_on.



23
24
25
# File 'lib/AIX/Lsvg.rb', line 23

def auto_on
  @auto_on
end

#auto_syncObject (readonly)

Returns the value of attribute auto_sync.



28
29
30
# File 'lib/AIX/Lsvg.rb', line 28

def auto_sync
  @auto_sync
end

#bb_policyObject (readonly)

Returns the value of attribute bb_policy.



30
31
32
# File 'lib/AIX/Lsvg.rb', line 30

def bb_policy
  @bb_policy
end

#critical_vgObject (readonly)

Returns the value of attribute critical_vg.



36
37
38
# File 'lib/AIX/Lsvg.rb', line 36

def critical_vg
  @critical_vg
end

#disk_block_sizeObject (readonly)

Returns the value of attribute disk_block_size.



35
36
37
# File 'lib/AIX/Lsvg.rb', line 35

def disk_block_size
  @disk_block_size
end

#free_ppsObject (readonly)

Returns the value of attribute free_pps.



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

def free_pps
  @free_pps
end

#hot_spareObject (readonly)

Returns the value of attribute hot_spare.



29
30
31
# File 'lib/AIX/Lsvg.rb', line 29

def hot_spare
  @hot_spare
end

#infinite_retryObject (readonly)

Returns the value of attribute infinite_retry.



33
34
35
# File 'lib/AIX/Lsvg.rb', line 33

def infinite_retry
  @infinite_retry
end

#ltg_size_dynamicObject (readonly)

Returns the value of attribute ltg_size_dynamic.



27
28
29
# File 'lib/AIX/Lsvg.rb', line 27

def ltg_size_dynamic
  @ltg_size_dynamic
end

#lvsObject (readonly)

Returns the value of attribute lvs.



15
16
17
# File 'lib/AIX/Lsvg.rb', line 15

def lvs
  @lvs
end

#max_lvsObject (readonly)

Returns the value of attribute max_lvs.



12
13
14
# File 'lib/AIX/Lsvg.rb', line 12

def max_lvs
  @max_lvs
end

#max_pps_per_pvObject (readonly)

Returns the value of attribute max_pps_per_pv.



25
26
27
# File 'lib/AIX/Lsvg.rb', line 25

def max_pps_per_pv
  @max_pps_per_pv
end

#max_pps_per_vgObject (readonly)

Returns the value of attribute max_pps_per_vg.



24
25
26
# File 'lib/AIX/Lsvg.rb', line 24

def max_pps_per_vg
  @max_pps_per_vg
end

#max_pvsObject (readonly)

Returns the value of attribute max_pvs.



26
27
28
# File 'lib/AIX/Lsvg.rb', line 26

def max_pvs
  @max_pvs
end

#open_lvsObject (readonly)

Returns the value of attribute open_lvs.



16
17
18
# File 'lib/AIX/Lsvg.rb', line 16

def open_lvs
  @open_lvs
end

#pp_sizeObject (readonly)

Returns the value of attribute pp_size.



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

def pp_size
  @pp_size
end

#pv_restrictionObject (readonly)

Returns the value of attribute pv_restriction.



32
33
34
# File 'lib/AIX/Lsvg.rb', line 32

def pv_restriction
  @pv_restriction
end

#quorumObject (readonly)

Returns the value of attribute quorum.



17
18
19
# File 'lib/AIX/Lsvg.rb', line 17

def quorum
  @quorum
end

#stale_ppsObject (readonly)

Returns the value of attribute stale_pps.



22
23
24
# File 'lib/AIX/Lsvg.rb', line 22

def stale_pps
  @stale_pps
end

#stale_pvsObject (readonly)

Returns the value of attribute stale_pvs.



21
22
23
# File 'lib/AIX/Lsvg.rb', line 21

def stale_pvs
  @stale_pvs
end

#total_ppsObject (readonly)

Returns the value of attribute total_pps.



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

def total_pps
  @total_pps
end

#total_pvsObject (readonly)

Returns the value of attribute total_pvs.



18
19
20
# File 'lib/AIX/Lsvg.rb', line 18

def total_pvs
  @total_pvs
end

#used_ppsObject (readonly)

Returns the value of attribute used_pps.



14
15
16
# File 'lib/AIX/Lsvg.rb', line 14

def used_pps
  @used_pps
end

#vg_descriptorsObject (readonly)

Returns the value of attribute vg_descriptors.



19
20
21
# File 'lib/AIX/Lsvg.rb', line 19

def vg_descriptors
  @vg_descriptors
end

#vg_identifierObject (readonly)

Returns the value of attribute vg_identifier.



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

def vg_identifier
  @vg_identifier
end

#vg_permissionObject (readonly)

Returns the value of attribute vg_permission.



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

def vg_permission
  @vg_permission
end

#vg_stateObject (readonly)

Returns the value of attribute vg_state.



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

def vg_state
  @vg_state
end

#volume_groupObject (readonly)

Returns the value of attribute volume_group.



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

def volume_group
  @volume_group
end

Instance Method Details

#parse(string) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/AIX/Lsvg.rb', line 85

def parse(string)

  regexp_long = %r{\s*
VOLUME\sGROUP:\s+(\w+)\s+VG\sIDENTIFIER:\s+(\w+)\s+
VG\sSTATE:\s+(active)\s+PP\sSIZE:\s+(\d+\smegabyte\(s\))\s+
VG\sPERMISSION:\s+(read\/write)\s+TOTAL\sPPs:\s+(\d+)\s\(\d+\smegabytes\)\s+
MAX\sLVs:\s+(\d+)\s+FREE\sPPs:\s+(\d+)\s\(\d+\smegabytes\)\s+
LVs:\s+(\d+)\s+USED\sPPs:\s+(\d+)\s\(\d+\smegabytes\)\s+
OPEN\sLVs:\s+(\d+)\s+QUORUM:\s+(\d+)\s+
TOTAL\sPVs:\s+(\d+)\s+VG\s+DESCRIPTORS:\s+(\d+)\s+
STALE\sPVs:\s+(\d+)\s+STALE\sPPs:\s+(\d+)\s+
ACTIVE\sPVs:\s+(\d+)\s+AUTO\sON:\s+(yes|no)\s+
MAX\sPPs\sper\sVG:\s+(\d+)\s+
MAX\sPPs\sper\sPV:\s+(\d+)\s+MAX\s+PVs:\s+(\d+)\s+
LTG\ssize\s\(Dynamic\):\s+(\d+\skilobyte\(s\))\s+AUTO\sSYNC:\s+(yes|no)\s+
HOT\sSPARE:\s+(yes|no)\s+BB\sPOLICY:\s+(relocatable)\s*}mx

  regexp_critical_vg = %r{\s*VOLUME\sGROUP:\s+(\w+)\s+VG\sIDENTIFIER:\s+(\w+)\s+
VG\sSTATE:\s+(active)\s+PP\sSIZE:\s+(\d+\smegabyte\(s\))\s+
VG\sPERMISSION:\s+(read\/write)\s+TOTAL\sPPs:\s+(\d+)\s\(\d+\smegabytes\)\s+
MAX\sLVs:\s+(\d+)\s+FREE\sPPs:\s+(\d+)\s\(\d+\smegabytes\)\s+
LVs:\s+(\d+)\s+USED\sPPs:\s+(\d+)\s\(\d+\smegabytes\)\s+
OPEN\sLVs:\s+(\d+)\s+QUORUM:\s+(\d+)\s\((Enabled|Disabled)\)\s+
TOTAL\sPVs:\s+(\d+)\s+VG\s+DESCRIPTORS:\s+(\d+)\s+
STALE\sPVs:\s+(\d+)\s+STALE\sPPs:\s+(\d+)\s+
ACTIVE\sPVs:\s+(\d+)\s+AUTO\sON:\s+(yes|no)\s+
MAX\sPPs\sper\sVG:\s+(\d+)\s+
MAX\sPPs\sper\sPV:\s+(\d+)\s+MAX\s+PVs:\s+(\d+)\s+
LTG\ssize\s\(Dynamic\):\s+(\d+\skilobyte\(s\))\s+AUTO\sSYNC:\s+(yes|no)\s+
HOT\sSPARE:\s+(yes|no)\s+BB\sPOLICY:\s+(relocatable|non-relocatable)\s+
PV\sRESTRICTION:\s+(none)\s+INFINITE\sRETRY:\s+(no)\s+
DISK\sBLOCK\sSIZE:\s+(\d+)\s+CRITICAL\sVG:\s+(no)\s*
}mx

  match_long        = regexp_long.match(string)
  match_critical_vg = regexp_critical_vg.match(string)

if match_long

    @volume_group = match_long[1]
    @vg_identifier = match_long[2]
    @vg_state 			= match_long[3]
    @pp_size  			= match_long[4]
    @vg_permission  = match_long[5]
    @total_pps      = match_long[6].to_i
    @max_lvs        = match_long[7].to_i
    @free_pps       = match_long[8].to_i
    @lvs       = match_long[9].to_i
    @used_pps       = match_long[10].to_i
    @open_lvs       = match_long[11].to_i
    @quorum       = match_long[12].to_i
    @total_pvs       = match_long[13].to_i
    @vg_descriptors = match_long[14].to_i
    @stale_pvs        = match_long[15].to_i
    @stale_pps        = match_long[16].to_i
    @active_pvs       = match_long[17].to_i
    @auto_on       = match_long[18]
    @max_pps_per_vg  = match_long[19].to_i
    @max_pps_per_pv = match_long[20].to_i
    @max_pvs = match_long[21].to_i
    @ltg_size_dynamic = match_long[22]
    @auto_sync = match_long[23]
    @hot_spare = match_long[24]
    @bb_policy = match_long[25]

elsif match_critical_vg

      @volume_group = match_critical_vg[1]
      @vg_identifier = match_critical_vg[2]
      @vg_state 			= match_critical_vg[3]
      @pp_size  			= match_critical_vg[4]
      @vg_permission  = match_critical_vg[5]
      @total_pps      = match_critical_vg[6].to_i
      @max_lvs        = match_critical_vg[7].to_i
      @free_pps       = match_critical_vg[8].to_i
      @lvs       = match_critical_vg[9].to_i
      @used_pps       = match_critical_vg[10].to_i
      @open_lvs       = match_critical_vg[11].to_i
      @quorum       = match_critical_vg[12].to_i

      @total_pvs       = match_critical_vg[14].to_i
      @vg_descriptors = match_critical_vg[15].to_i
      @stale_pvs        = match_critical_vg[16].to_i
      @stale_pps        = match_critical_vg[17].to_i
      @active_pvs       = match_critical_vg[18].to_i
      @auto_on       = match_critical_vg[19]
      @max_pps_per_vg  = match_critical_vg[20].to_i
      @max_pps_per_pv = match_critical_vg[21].to_i
      @max_pvs = match_critical_vg[22].to_i
      @ltg_size_dynamic = match_critical_vg[23]
      @auto_sync = match_critical_vg[24]
      @hot_spare = match_critical_vg[25]
      @bb_policy = match_critical_vg[26]

      @pv_restriction = match_critical_vg[27]
      @infinite_retry = match_critical_vg[28]

      @disk_block_size = match_critical_vg[29].to_i  
      @critical_vg = match_critical_vg[30]

else
    #puts "can't analyze string, regexp is not working"
    #puts string
    #puts regexp
    #puts match
    puts "regexp couldn't decode string >#{string}<"
    raise
  end

end