elesai 0.9.3 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +2 -0
- data/lib/elesai/action/check.rb +146 -0
- data/lib/elesai/action/show.rb +83 -0
- data/lib/elesai/action.rb +5 -0
- data/lib/elesai/cli.rb +24 -170
- data/lib/elesai/lsi.rb +62 -84
- data/lib/elesai/megacli/_adpallinfo_aall.rb +102 -0
- data/lib/elesai/megacli/_adpbbucmd_aall.rb +107 -0
- data/lib/elesai/megacli/_ldpdinfo_aall.rb +140 -0
- data/lib/elesai/megacli/_pdlist_aall.rb +120 -0
- data/lib/elesai/megacli/megacli.rb +241 -0
- data/lib/elesai/megacli.rb +7 -643
- data/lib/elesai/version.rb +1 -1
- data/lib/elesai.rb +0 -1
- metadata +10 -2
data/lib/elesai/megacli.rb
CHANGED
@@ -1,648 +1,12 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
1
|
+
require 'elesai/megacli/megacli'
|
2
|
+
require 'elesai/megacli/_adpallinfo_aall'
|
3
|
+
require 'elesai/megacli/_pdlist_aall'
|
4
|
+
require 'elesai/megacli/_ldpdinfo_aall'
|
5
|
+
require 'elesai/megacli/_adpbbucmd_aall'
|
4
6
|
|
5
7
|
module Elesai
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
include Workflow
|
10
|
-
|
11
|
-
ADAPTER_RE = /^Adapter\s+#*(?<value>\d+)/
|
12
|
-
VIRTUALDRIVE_RE = /^Virtual\s+Drive:\s+\d+\s+\((?<key>Target\s+Id):\s+(?<value>\d+)\)/
|
13
|
-
SPAN_RE = /^Span:\s+(?<value>\d+)/
|
14
|
-
PHYSICALDRIVE_RE = /^(?<key>Enclosure\s+Device\s+ID):\s+(?<value>\d+)/
|
15
|
-
ATTRIBUTE_RE = /^(?<key>[A-Za-z0-9()\s#'-.&]+)[:|=](?<value>.*)/
|
16
|
-
EXIT_RE = /^Exit Code: /
|
17
|
-
|
18
|
-
BBU_RE = /^BBU status for Adapter:\s+(?<value>\d+)/
|
19
|
-
BBU_FIRMWARESTATUS_RE = /^BBU Firmware Status:/
|
20
|
-
BBU_DESIGNINFO_RE = /^BBU Design Info for Adapter:\s+(?<value>\d+)/
|
21
|
-
BBU_PROPERTIES_RE = /^BBU Properties for Adapter:\s+(?<value>\d+)/
|
22
|
-
BBU_GASGAUGESTATUS_RE = /^GasGuageStatus:/
|
23
|
-
BBU_CAPACITYINFO_RE = /^BBU Capacity Info for Adapter:\s+(?<value>\d+)/
|
24
|
-
|
25
|
-
|
26
|
-
### Context
|
27
|
-
|
28
|
-
class Context
|
29
|
-
|
30
|
-
def initialize(current_state,lsi)
|
31
|
-
current_state.meta[:context] = { :stack => [] }
|
32
|
-
@context = current_state.meta[:context]
|
33
|
-
@lsi = lsi
|
34
|
-
@log = Elesai::Logger.instance.log
|
35
|
-
end
|
36
|
-
|
37
|
-
def open(component)
|
38
|
-
@log.debug " * Open #{component.inspect}"
|
39
|
-
@context[:stack].push(component)
|
40
|
-
@context[component.class] = component
|
41
|
-
@log.debug " + context: #{@context[:stack]}"
|
42
|
-
end
|
43
|
-
|
44
|
-
def flash!(new_state)
|
45
|
-
new_state.meta[:context] = @context
|
46
|
-
@context = nil
|
47
|
-
@context = new_state.meta[:context]
|
48
|
-
@log.debug " + Flash context: #{@context[:stack]}"
|
49
|
-
end
|
50
|
-
|
51
|
-
def close
|
52
|
-
component = @context[:stack].pop
|
53
|
-
@context[component.class] = nil
|
54
|
-
@log.debug " * Close #{component.inspect}"
|
55
|
-
case component
|
56
|
-
when Elesai::LSIArray::PhysicalDrive
|
57
|
-
pd = @lsi.add_physicaldrive(component)
|
58
|
-
pd.add_adapter(adapter)
|
59
|
-
pd.add_virtualdrive(virtualdrive) unless virtualdrive.nil?
|
60
|
-
adapter.add_physicaldrive(pd)
|
61
|
-
when Elesai::LSIArray::VirtualDrive
|
62
|
-
vd = @lsi.add_virtualdrive(component)
|
63
|
-
when Elesai::LSIArray::Adapter
|
64
|
-
@lsi.add_adapter(component)
|
65
|
-
when Elesai::LSIArray::BBU
|
66
|
-
@lsi.add_bbu(component)
|
67
|
-
end
|
68
|
-
@log.debug " + context: #{@context[:stack]}"
|
69
|
-
end
|
70
|
-
|
71
|
-
def current
|
72
|
-
@context[:stack][-1]
|
73
|
-
end
|
74
|
-
|
75
|
-
def adapter
|
76
|
-
@context[Elesai::LSIArray::Adapter]
|
77
|
-
end
|
78
|
-
|
79
|
-
def virtualdrive
|
80
|
-
@context[Elesai::LSIArray::VirtualDrive]
|
81
|
-
end
|
82
|
-
|
83
|
-
def physicaldrive
|
84
|
-
@context[Elesai::LSIArray::PhysicalDrive]
|
85
|
-
end
|
86
|
-
|
87
|
-
def bbu
|
88
|
-
@context[Elesai::LSIArray::BBU]
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
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
|
-
### State Machine Handlers
|
120
|
-
|
121
|
-
# Start
|
122
|
-
|
123
|
-
def on_start_exit(new_state, event, *args)
|
124
|
-
@log.debug " [#{current_state}]: on_exit : #{event} -> #{new_state}; args: #{args}"
|
125
|
-
@context = Context.new(current_state,@lsi)
|
126
|
-
end
|
127
|
-
|
128
|
-
# Adapter
|
129
|
-
|
130
|
-
def adapter_line(adapter,key,value)
|
131
|
-
@log.debug " [#{current_state}] event adapter_line: new #{adapter.inspect}"
|
132
|
-
adapter[key.to_sym] = value.to_i
|
133
|
-
end
|
134
|
-
|
135
|
-
def on_adapter_entry(old_state, event, *args)
|
136
|
-
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
|
137
|
-
|
138
|
-
@context.close unless @context.current.nil? or @context.current === Elesai::LSIArray::Adapter
|
139
|
-
@context.open args[0]
|
140
|
-
end
|
141
|
-
|
142
|
-
def on_adapter_exit(new_state, event, *args)
|
143
|
-
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
|
144
|
-
@context.flash!(new_state)
|
145
|
-
end
|
146
|
-
|
147
|
-
# Virtual Drive
|
148
|
-
|
149
|
-
def virtualdrive_line(virtualdrive,key,value)
|
150
|
-
@log.debug " [#{current_state}] event: virtualdrive_line: new #{virtualdrive.inspect}"
|
151
|
-
virtualdrive[key.to_sym] = value.to_i
|
152
|
-
end
|
153
|
-
|
154
|
-
def on_virtualdrive_entry(old_state, event, *args)
|
155
|
-
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
|
156
|
-
|
157
|
-
unless @context.current.nil?
|
158
|
-
if @context.current === Elesai::LSIArray::VirtualDrive
|
159
|
-
@context.close
|
160
|
-
end
|
161
|
-
end
|
162
|
-
virtualdrive = args[0]
|
163
|
-
@context.open virtualdrive
|
164
|
-
end
|
165
|
-
|
166
|
-
def on_virtualdrive_exit(new_state, event, *args)
|
167
|
-
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
|
168
|
-
@context.flash!(new_state)
|
169
|
-
end
|
170
|
-
|
171
|
-
# Physical Drive
|
172
|
-
|
173
|
-
def physicaldrive_line(physicaldrive,key,value)
|
174
|
-
@log.debug " [#{current_state}] event: physicaldrive_line: new #{physicaldrive.inspect}"
|
175
|
-
physicaldrive[key.to_sym] = value.to_i
|
176
|
-
end
|
177
|
-
|
178
|
-
def on_physicaldrive_entry(old_state, event, *args)
|
179
|
-
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
|
180
|
-
@context.open args[0]
|
181
|
-
end
|
182
|
-
|
183
|
-
def on_physicaldrive_exit(new_state, event, *args)
|
184
|
-
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
|
185
|
-
@context.flash!(new_state)
|
186
|
-
end
|
187
|
-
|
188
|
-
# Attribute
|
189
|
-
|
190
|
-
def attribute_line(key,value)
|
191
|
-
@log.debug " [#{current_state}] event: attribute_line: #{key} => #{value}"
|
192
|
-
end
|
193
|
-
|
194
|
-
def on_attribute_entry(old_state, event, *args)
|
195
|
-
@log.debug " [#{current_state}] entry: leaving #{old_state}; args: #{args}; context: #{@context.current.class}"
|
196
|
-
|
197
|
-
|
198
|
-
c = @context.current
|
199
|
-
k = args[0].to_sym
|
200
|
-
v = args[1]
|
201
|
-
|
202
|
-
# Some attributes require special treatment for our purposes
|
203
|
-
|
204
|
-
case k
|
205
|
-
when :coercedsize, :noncoercedsize, :rawsize, :size
|
206
|
-
m = /(?<number>[0-9\.]+)\s+(?<unit>[A-Z]+)/.match(v)
|
207
|
-
v = LSIArray::PhysicalDrive::Size.new(m[:number],m[:unit])
|
208
|
-
when :raidlevel
|
209
|
-
m = /Primary-(?<primary>\d+),\s+Secondary-(?<secondary>\d+)/.match(v)
|
210
|
-
v = LSIArray::VirtualDrive::RaidLevel.new(m[:primary],m[:secondary])
|
211
|
-
when :firmwarestate
|
212
|
-
st,sp = v.gsub(/\s/,'').split(/,/)
|
213
|
-
state = st.gsub(/\s/,'_').downcase.to_sym
|
214
|
-
spin = sp.gsub(/\s/,'_').downcase.to_sym unless sp.nil?
|
215
|
-
v = LSIArray::PhysicalDrive::FirmwareState.new(state,spin)
|
216
|
-
when :state
|
217
|
-
v = v.gsub(/\s/,'_').downcase.to_sym
|
218
|
-
when :mediatype
|
219
|
-
v = v.scan(/[A-Z]/).join
|
220
|
-
when :inquirydata
|
221
|
-
v = v.gsub(/\s+/,' ')
|
222
|
-
when :relativedtateofcharge, :absolutestateofcharge, :remainingcapacityalarm, :remainingcapacity
|
223
|
-
m = /(?<number>[0-9\.]+)\s+(?<unit>[A-Za-z%]+)/.match(v)
|
224
|
-
v = LSIArray::BBU::NumberUnit.new(m[:number].to_f,m[:unit])
|
225
|
-
end
|
226
|
-
c[k] = v
|
227
|
-
end
|
228
|
-
|
229
|
-
def on_attribute_exit(new_state, event, *args)
|
230
|
-
@log.debug " [#{current_state}] exit: entering #{new_state} throught event #{event}; args: #{args}"
|
231
|
-
@context.close if @context.current.class == Elesai::LSIArray::PhysicalDrive and event != :attribute_line
|
232
|
-
|
233
|
-
@context.flash!(new_state)
|
234
|
-
end
|
235
|
-
|
236
|
-
# BBU
|
237
|
-
|
238
|
-
def bbu_line(bbu,key,value)
|
239
|
-
@log.debug " [#{current_state}] event: bbu_line: new #{bbu.inspect}"
|
240
|
-
bbu[key.to_sym] = value.to_i
|
241
|
-
end
|
242
|
-
|
243
|
-
def on_bbu_entry(old_state, event, *args)
|
244
|
-
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
|
245
|
-
@context.open args[0]
|
246
|
-
end
|
247
|
-
|
248
|
-
def on_bbu_exit(new_state, event, *args)
|
249
|
-
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
|
250
|
-
@context.flash!(new_state)
|
251
|
-
end
|
252
|
-
|
253
|
-
# BBU Firmware Status
|
254
|
-
|
255
|
-
def bbu_firmwarestatus_line
|
256
|
-
@log.debug " [#{current_state}] event: bbu_firmware_line:"
|
257
|
-
end
|
258
|
-
|
259
|
-
def on_bbu_firmwarestatus_entry(old_state, event, *args)
|
260
|
-
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
|
261
|
-
@context.open @context.current[:firmwarestatus]
|
262
|
-
end
|
263
|
-
|
264
|
-
def on_bbu_firmwarestatus_exit(new_state, event, *args)
|
265
|
-
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
|
266
|
-
@context.flash!(new_state)
|
267
|
-
end
|
268
|
-
|
269
|
-
# BBU DesignInfo Status
|
270
|
-
|
271
|
-
def bbu_designinfo_line
|
272
|
-
@log.debug " [#{current_state}] event: bbu_designinfo_line:"
|
273
|
-
end
|
274
|
-
|
275
|
-
def on_bbu_designinfo_entry(old_state, event, *args)
|
276
|
-
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
|
277
|
-
@context.close
|
278
|
-
@context.open @context.current[:designinfo]
|
279
|
-
end
|
280
|
-
|
281
|
-
def on_bbu_designinfo_exit(new_state, event, *args)
|
282
|
-
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
|
283
|
-
@context.flash!(new_state)
|
284
|
-
end
|
285
|
-
|
286
|
-
# BBU Properties Status
|
287
|
-
|
288
|
-
def bbu_properties_line
|
289
|
-
@log.debug " [#{current_state}] event: bbu_designinfo_line:"
|
290
|
-
end
|
291
|
-
|
292
|
-
def on_bbu_properties_entry(old_state, event, *args)
|
293
|
-
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
|
294
|
-
@context.close
|
295
|
-
@context.open @context.current[:properties]
|
296
|
-
end
|
297
|
-
|
298
|
-
def on_bbu_properties_exit(new_state, event, *args)
|
299
|
-
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
|
300
|
-
@context.flash!(new_state)
|
301
|
-
end
|
302
|
-
|
303
|
-
# BBU GasGuage Status
|
304
|
-
|
305
|
-
def bbu_gasgaugestatus_line
|
306
|
-
@log.debug " [#{current_state}] event: bbu_gasgaugestatus_line:"
|
307
|
-
end
|
308
|
-
|
309
|
-
def on_bbu_gasgaugestatus_entry(old_state, event, *args)
|
310
|
-
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
|
311
|
-
@context.close
|
312
|
-
@context.open @context.current[:gasgaugestatus]
|
313
|
-
end
|
314
|
-
|
315
|
-
def on_bbu_gasgaugestatus_exit(new_state, event, *args)
|
316
|
-
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
|
317
|
-
@context.flash!(new_state)
|
318
|
-
end
|
319
|
-
|
320
|
-
# BBU Capacity Info
|
321
|
-
|
322
|
-
def bbu_capacityinfo_line
|
323
|
-
@log.debug " [#{current_state}] event: bbu_capacityinfo_line:"
|
324
|
-
end
|
325
|
-
|
326
|
-
def on_bbu_capacityinfo_entry(old_state, event, *args)
|
327
|
-
@log.debug " [#{current_state}] on_entry: leaving #{old_state}; args: #{args}"
|
328
|
-
@context.close
|
329
|
-
@context.open @context.current[:capacityinfo]
|
330
|
-
end
|
331
|
-
|
332
|
-
def on_bbu_capacityinfo_exit(new_state, event, *args)
|
333
|
-
@log.debug " [#{current_state}] on_exit: entering #{new_state}; args: #{args}"
|
334
|
-
@context.flash!(new_state)
|
335
|
-
end
|
336
|
-
|
337
|
-
|
338
|
-
# Exit
|
339
|
-
|
340
|
-
def exit_line
|
341
|
-
@log.debug " [#{current_state}] event: exit_line"
|
342
|
-
end
|
343
|
-
|
344
|
-
def on_exit_entry(new_state, event, *args)
|
345
|
-
@log.debug " [#{current_state}] exit: entering #{new_state} throught event #{event}; args: #{args}"
|
346
|
-
until @context.current.nil? do
|
347
|
-
@context.close
|
348
|
-
end
|
349
|
-
end
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
### Regular Expression Match Handlers
|
363
|
-
|
364
|
-
# Adapter
|
365
|
-
|
366
|
-
def adapter_match(match)
|
367
|
-
@log.debug "ADAPTER! #{match.string}"
|
368
|
-
key = 'id'
|
369
|
-
value = match[:value]
|
370
|
-
adapter_line!(LSIArray::Adapter.new,key,value)
|
371
|
-
end
|
372
|
-
|
373
|
-
# Virtual Drive
|
374
|
-
|
375
|
-
def virtualdrive_match(match)
|
376
|
-
@log.debug "VIRTUALDRIVE! #{match.string}"
|
377
|
-
key = match[:key].gsub(/\s+/,"").downcase
|
378
|
-
value = match[:value]
|
379
|
-
virtualdrive_line!(LSIArray::VirtualDrive.new,key,value)
|
380
|
-
end
|
381
|
-
|
382
|
-
# Physical Drive
|
383
|
-
|
384
|
-
def physicaldrive_match(match)
|
385
|
-
@log.debug "PHYSICALDRIVE! #{match.string}"
|
386
|
-
key = match[:key].gsub(/\s+/,"").downcase
|
387
|
-
value = match[:value]
|
388
|
-
physicaldrive_line!(LSIArray::PhysicalDrive.new,key,value)
|
389
|
-
end
|
390
|
-
|
391
|
-
# Attribute
|
392
|
-
|
393
|
-
def attribute_match(match)
|
394
|
-
@log.debug "ATTRIBUTE! #{match.string}"
|
395
|
-
key = match[:key].gsub(/\s+/,"").downcase
|
396
|
-
value = match[:value].strip
|
397
|
-
attribute_line!(key,value)
|
398
|
-
end
|
399
|
-
|
400
|
-
# BBU
|
401
|
-
def bbu_match(match)
|
402
|
-
@log.debug "BBU! #{match.string}"
|
403
|
-
key = 'id'
|
404
|
-
value = match[:value]
|
405
|
-
adapter_line(LSIArray::Adapter.new,key,value)
|
406
|
-
bbu_line!(LSIArray::BBU.new,key,value)
|
407
|
-
end
|
408
|
-
|
409
|
-
def bbu_firmwarestatus_match(match)
|
410
|
-
@log.debug "BBU FIRMWARE! #{match.string}"
|
411
|
-
bbu_firmwarestatus_line!
|
412
|
-
end
|
413
|
-
|
414
|
-
def bbu_designinfo_match(match)
|
415
|
-
@log.debug "BBU DESIGN INFO! #{match.string}"
|
416
|
-
bbu_designinfo_line!
|
417
|
-
end
|
418
|
-
|
419
|
-
def bbu_properties_match(match)
|
420
|
-
@log.debug "BBU PROPERTIES! #{match.string}"
|
421
|
-
bbu_properties_line!
|
422
|
-
end
|
423
|
-
|
424
|
-
def bbu_capacityinfo_match(match)
|
425
|
-
@log.debug "BBU CAPACITY INFO! #{match.string}"
|
426
|
-
bbu_capacityinfo_line!
|
427
|
-
end
|
428
|
-
|
429
|
-
def bbu_gasgaugestatus_match(match)
|
430
|
-
@log.debug "BBU GAS GUAGE STATUS! #{match.string}"
|
431
|
-
bbu_gasgaugestatus_line!
|
432
|
-
end
|
433
|
-
|
434
|
-
# Exit
|
435
|
-
|
436
|
-
def exit_match(match)
|
437
|
-
@log.debug "EXIT! #{match.string}"
|
438
|
-
exit_line!
|
439
|
-
end
|
440
|
-
|
441
|
-
### Parse!
|
442
|
-
|
443
|
-
def parse!(lsi,opts)
|
444
|
-
|
445
|
-
@lsi = lsi
|
446
|
-
@log = Elesai::Logger.instance.log
|
447
|
-
output = nil
|
448
|
-
|
449
|
-
if STDIN.ready?
|
450
|
-
output = $stdin.read
|
451
|
-
else
|
452
|
-
if opts[:fake].start_with? '-'
|
453
|
-
megacli = opts[:megacli].nil? ? "Megacli" : opts[:megacli]
|
454
|
-
command = "#{megacli} #{opts[:fake]} -nolog"
|
455
|
-
command = Process.uid == 0 ? command : "sudo " << command
|
456
|
-
output, stderr_str, status = Open3.capture3(command)
|
457
|
-
raise RuntimeError, stderr_str unless status.exitstatus == 0
|
458
|
-
else
|
459
|
-
output = File.read(opts[:fake])
|
460
|
-
end
|
461
|
-
end
|
462
|
-
|
463
|
-
output.each_line do |line|
|
464
|
-
line.strip!
|
465
|
-
next if line == ''
|
466
|
-
|
467
|
-
begin
|
468
|
-
case line
|
469
|
-
when ADAPTER_RE then adapter_match(ADAPTER_RE.match(line))
|
470
|
-
when BBU_RE then bbu_match(BBU_RE.match(line))
|
471
|
-
when VIRTUALDRIVE_RE then virtualdrive_match(VIRTUALDRIVE_RE.match(line))
|
472
|
-
when PHYSICALDRIVE_RE then physicaldrive_match(PHYSICALDRIVE_RE.match(line))
|
473
|
-
when BBU_FIRMWARESTATUS_RE then bbu_firmwarestatus_match(BBU_FIRMWARESTATUS_RE.match(line))
|
474
|
-
when BBU_DESIGNINFO_RE then bbu_designinfo_match(BBU_DESIGNINFO_RE.match(line))
|
475
|
-
when BBU_PROPERTIES_RE then bbu_properties_match(BBU_PROPERTIES_RE.match(line))
|
476
|
-
when BBU_CAPACITYINFO_RE then bbu_capacityinfo_match(BBU_CAPACITYINFO_RE.match(line))
|
477
|
-
when BBU_GASGAUGESTATUS_RE then bbu_gasgaugestatus_match(BBU_GASGAUGESTATUS_RE.match(line))
|
478
|
-
when EXIT_RE then exit_match(EXIT_RE.match(line))
|
479
|
-
when ATTRIBUTE_RE then attribute_match(ATTRIBUTE_RE.match(line))
|
480
|
-
else raise StandardError, "cannot parse '#{line}'"
|
481
|
-
end
|
482
|
-
rescue ArgumentError # ignore lines with invalid byte sequence in UTF-8
|
483
|
-
next
|
484
|
-
end
|
485
|
-
|
486
|
-
@log.debug "\n\n"
|
487
|
-
end
|
488
|
-
end
|
489
|
-
|
490
|
-
end
|
491
|
-
|
492
|
-
class PDlist_aAll < Megacli
|
493
|
-
|
494
|
-
def parse!(lsi,opts)
|
495
|
-
fake = opts[:fake].nil? ? "-pdlist -aall" : File.join(opts[:fake],"pdlist_aall")
|
496
|
-
super lsi, :fake => fake, :megacli => opts[:megacli]
|
497
|
-
end
|
498
|
-
|
499
|
-
workflow do
|
500
|
-
|
501
|
-
state :start do
|
502
|
-
event :adapter_line, :transitions_to => :adapter
|
503
|
-
event :exit_line, :transitions_to => :exit
|
504
|
-
end
|
505
|
-
|
506
|
-
state :adapter do
|
507
|
-
event :adapter_line, :transitions_to => :adapter # empty adapter
|
508
|
-
event :physicaldrive_line, :transitions_to => :physicaldrive
|
509
|
-
event :exit_line, :transitions_to => :exit
|
510
|
-
end
|
511
|
-
|
512
|
-
state :physicaldrive do
|
513
|
-
event :attribute_line, :transitions_to => :physicaldrive
|
514
|
-
event :exit_line, :transitions_to => :exit
|
515
|
-
event :adapter_line, :transitions_to => :adapter
|
516
|
-
event :physicaldrive_line, :transitions_to => :physicaldrive
|
517
|
-
event :attribute_line, :transitions_to => :attribute
|
518
|
-
end
|
519
|
-
|
520
|
-
state :attribute do
|
521
|
-
event :attribute_line, :transitions_to => :attribute
|
522
|
-
event :physicaldrive_line, :transitions_to => :physicaldrive
|
523
|
-
event :adapter_line, :transitions_to => :adapter
|
524
|
-
event :exit_line, :transitions_to => :exit
|
525
|
-
end
|
526
|
-
|
527
|
-
state :exit
|
528
|
-
|
529
|
-
on_transition do |from, to, triggering_event, *event_args|
|
530
|
-
#puts self.spec.states[to].class
|
531
|
-
# puts " transition: #{from} >> #{triggering_event}! >> #{to}: #{event_args.join(' ')}"
|
532
|
-
#puts " #{current_state.meta}"
|
533
|
-
end
|
534
|
-
end
|
535
|
-
|
536
|
-
end
|
537
|
-
|
538
|
-
class LDPDinfo_aAll < Megacli
|
539
|
-
|
540
|
-
def parse!(lsi,opts)
|
541
|
-
fake = opts[:fake].nil? ? "-ldpdinfo -aall" : File.join(opts[:fake],"ldpdinfo_aall")
|
542
|
-
super lsi, :fake => fake, :megacli => opts[:megacli]
|
543
|
-
end
|
544
|
-
|
545
|
-
|
546
|
-
workflow do
|
547
|
-
|
548
|
-
state :start do
|
549
|
-
event :adapter_line, :transitions_to => :adapter
|
550
|
-
event :exit_line, :transitions_to => :exit
|
551
|
-
end
|
552
|
-
|
553
|
-
state :adapter do
|
554
|
-
event :adapter_line, :transitions_to => :adapter
|
555
|
-
event :attribute_line, :transitions_to => :attribute
|
556
|
-
event :virtualdrive_line, :transitions_to => :virtualdrive
|
557
|
-
event :exit_line, :transitions_to => :exit
|
558
|
-
end
|
559
|
-
|
560
|
-
state :physicaldrive do
|
561
|
-
event :attribute_line, :transitions_to => :physicaldrive
|
562
|
-
event :exit_line, :transitions_to => :exit
|
563
|
-
event :adapter_line, :transitions_to => :adapter
|
564
|
-
event :physicaldrive_line, :transitions_to => :physicaldrive
|
565
|
-
event :attribute_line, :transitions_to => :attribute
|
566
|
-
end
|
567
|
-
|
568
|
-
state :virtualdrive do
|
569
|
-
event :physicaldrive_line, :transitions_to => :physicaldrive
|
570
|
-
event :attribute_line, :transitions_to => :attribute
|
571
|
-
end
|
572
|
-
|
573
|
-
state :attribute do
|
574
|
-
event :attribute_line, :transitions_to => :attribute
|
575
|
-
event :virtualdrive_line, :transitions_to => :virtualdrive
|
576
|
-
event :physicaldrive_line, :transitions_to => :physicaldrive
|
577
|
-
event :adapter_line, :transitions_to => :adapter
|
578
|
-
event :exit_line, :transitions_to => :exit
|
579
|
-
end
|
580
|
-
|
581
|
-
state :exit
|
582
|
-
|
583
|
-
on_transition do |from, to, triggering_event, *event_args|
|
584
|
-
#puts self.spec.states[to].class
|
585
|
-
# puts " transition: #{from} >> #{triggering_event}! >> #{to}: #{event_args.join(' ')}"
|
586
|
-
#puts " #{current_state.meta}"
|
587
|
-
end
|
588
|
-
end
|
589
|
-
|
9
|
+
module Megacli
|
590
10
|
end
|
591
11
|
|
592
|
-
|
593
|
-
|
594
|
-
def parse!(lsi,opts)
|
595
|
-
fake = opts[:fake].nil? ? "-AdpBbuCmd -aAll" : File.join(opts[:fake],"adpbbucmd_aall")
|
596
|
-
super lsi, :fake => fake, :megacli => opts[:megacli]
|
597
|
-
end
|
598
|
-
|
599
|
-
workflow do
|
600
|
-
|
601
|
-
state :start do
|
602
|
-
event :bbu_line, :transitions_to => :bbu
|
603
|
-
event :exit_line, :transitions_to => :exit
|
604
|
-
end
|
605
|
-
|
606
|
-
state :bbu do
|
607
|
-
event :attribute_line, :transitions_to => :attribute
|
608
|
-
event :bbu_firmwarestatus_line, :transitions_to => :bbu_firmwarestatus
|
609
|
-
end
|
610
|
-
|
611
|
-
state :bbu_firmwarestatus do
|
612
|
-
event :attribute_line, :transitions_to => :attribute
|
613
|
-
end
|
614
|
-
|
615
|
-
state :bbu_capacityinfo do
|
616
|
-
event :attribute_line, :transitions_to => :attribute
|
617
|
-
end
|
618
|
-
|
619
|
-
state :bbu_designinfo do
|
620
|
-
event :attribute_line, :transitions_to => :attribute
|
621
|
-
end
|
622
|
-
|
623
|
-
state :bbu_gasgaugestatus do
|
624
|
-
event :attribute_line, :transitions_to => :attribute
|
625
|
-
end
|
626
|
-
|
627
|
-
state :bbu_properties do
|
628
|
-
event :attribute_line, :transitions_to => :attribute
|
629
|
-
event :exit_line, :transitions_to => :exit
|
630
|
-
end
|
631
|
-
|
632
|
-
state :attribute do
|
633
|
-
event :attribute_line, :transitions_to => :attribute
|
634
|
-
event :bbu_firmwarestatus_line, :transitions_to => :bbu_firmwarestatus
|
635
|
-
event :bbu_designinfo_line, :transitions_to => :bbu_designinfo
|
636
|
-
event :bbu_properties_line, :transitions_to => :bbu_properties
|
637
|
-
event :bbu_gasgaugestatus_line, :transitions_to => :bbu_gasgaugestatus
|
638
|
-
event :bbu_capacityinfo_line, :transitions_to => :bbu_capacityinfo
|
639
|
-
event :exit_line, :transitions_to => :exit
|
640
|
-
end
|
641
|
-
|
642
|
-
state :exit
|
643
|
-
end
|
644
|
-
|
645
|
-
end
|
646
|
-
|
647
|
-
|
648
|
-
end
|
12
|
+
end
|
data/lib/elesai/version.rb
CHANGED
data/lib/elesai.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elesai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: workflow
|
@@ -70,9 +70,17 @@ extensions: []
|
|
70
70
|
extra_rdoc_files: []
|
71
71
|
files:
|
72
72
|
- lib/elesai/about.rb
|
73
|
+
- lib/elesai/action/check.rb
|
74
|
+
- lib/elesai/action/show.rb
|
75
|
+
- lib/elesai/action.rb
|
73
76
|
- lib/elesai/cli.rb
|
74
77
|
- lib/elesai/logger.rb
|
75
78
|
- lib/elesai/lsi.rb
|
79
|
+
- lib/elesai/megacli/_adpallinfo_aall.rb
|
80
|
+
- lib/elesai/megacli/_adpbbucmd_aall.rb
|
81
|
+
- lib/elesai/megacli/_ldpdinfo_aall.rb
|
82
|
+
- lib/elesai/megacli/_pdlist_aall.rb
|
83
|
+
- lib/elesai/megacli/megacli.rb
|
76
84
|
- lib/elesai/megacli.rb
|
77
85
|
- lib/elesai/version.rb
|
78
86
|
- lib/elesai.rb
|