storcs 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/README.textile +14 -0
- data/lib/storcs/parsers.rb +1 -0
- data/lib/storcs/parsers/netapp.rb +81 -0
- data/lib/storcs/parsers/nss.rb +4 -3
- data/lib/storcs/version.rb +1 -1
- data/spec/data/netapp.txt +33 -0
- data/spec/parsers/netapp_spec.rb +26 -0
- data/spec/parsers/nss_spec.rb +6 -6
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01ab35a82f0d0635bbda3aa181da50e8ab1e9db7
|
4
|
+
data.tar.gz: 0061cc673f990135149034ac9da979e791893823
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f86093087262680ab08ec14bf47ec442e5c9e1e758ed400df35098042577cba5825b4c5c1c7c81858911452ecd739baa9f7bc5cfadd5ce1b00b053612c640b75
|
7
|
+
data.tar.gz: 5c98cdd60f875508951313bd8b5741b672a1395e5f7aa03f963114112351dbc260d211ac014a65b3e1339af0522063e8bbe864f0b84af5e433ece0f9863434bd
|
data/README.textile
CHANGED
@@ -115,6 +115,20 @@ h3. Equalogic PS5000 and PS6000
|
|
115
115
|
|
116
116
|
It parses the output of a 'show' command in the shell. Unfortunately, I wasn't able to run it remotely since my network administrator didn't allow me. So I have a script based on the "expect" tool with the @show@ command inside.
|
117
117
|
|
118
|
+
h3. Falconstor NSS
|
119
|
+
|
120
|
+
Tested against NSS 6.15 and 7.70
|
121
|
+
It ignores physical devices not assigned to a storage pool
|
122
|
+
|
123
|
+
bc. iscli getpdevinfo -s server -L >file.txt
|
124
|
+
|
125
|
+
h3. NetApp
|
126
|
+
|
127
|
+
Tested against NetApp release 8.1.3 (7-mode)
|
128
|
+
A pseudo volume is added in each aggregate in order to see snapshot space.
|
129
|
+
|
130
|
+
bc. ssh aaa@netapp1 aggr show_space >file.txt
|
131
|
+
|
118
132
|
h3. Yours!
|
119
133
|
|
120
134
|
If you have a storage device you'd like to see in this list, feel free to open an issue here with at least an example 'profile' file (this can be the output of a command, a plain text or structured file) and the result I should find (used size/total size at least). Maybe somebody else (or me) will be interested in building a parser for your device.
|
data/lib/storcs/parsers.rb
CHANGED
@@ -0,0 +1,81 @@
|
|
1
|
+
module Storcs::Parsers
|
2
|
+
class Netapp
|
3
|
+
include Storcs::Parsers::Utils
|
4
|
+
|
5
|
+
attr_accessor :device
|
6
|
+
|
7
|
+
def initialize(name, file)
|
8
|
+
@device = Storcs::Device.new(name)
|
9
|
+
@lines = File.readlines(file)
|
10
|
+
parse!
|
11
|
+
end
|
12
|
+
|
13
|
+
def parse!
|
14
|
+
@device.children = aggregates
|
15
|
+
end
|
16
|
+
|
17
|
+
def aggregates
|
18
|
+
return @aggregates if @aggregates
|
19
|
+
@aggregates = []
|
20
|
+
|
21
|
+
state = nil
|
22
|
+
current_aggr = nil
|
23
|
+
current_aggr_usable_size = 0
|
24
|
+
|
25
|
+
@lines.each do |line|
|
26
|
+
# Aggregate 'aggr0'
|
27
|
+
if line =~ /^Aggregate '([^']*)'/
|
28
|
+
name = Regexp.last_match[1]
|
29
|
+
current_aggr = Storcs::Device.new(name)
|
30
|
+
current_aggr.children = []
|
31
|
+
state = :aggr
|
32
|
+
elsif state == :aggr
|
33
|
+
case line
|
34
|
+
# Volume Allocated Used Guarantee
|
35
|
+
when /^Volume.+Allocated/
|
36
|
+
state = :volume
|
37
|
+
# Total space 492030416KB 12922692KB 23052692KB
|
38
|
+
when /^Total space\s+(.*)$/
|
39
|
+
data = Regexp.last_match[1]
|
40
|
+
alloc = parse_size(data.split(/\s+/).first)
|
41
|
+
current_aggr.real_unassigned = current_aggr_usable_size - alloc
|
42
|
+
current_aggr_usable_size = 0
|
43
|
+
# Snap reserve 0KB 1406504KB 0KB
|
44
|
+
when /^Snap reserve\s+(.*)$/
|
45
|
+
data = Regexp.last_match[1]
|
46
|
+
vol = Storcs::Device.new('Snapshots')
|
47
|
+
size = parse_size(data.split(/\s+/)[1])
|
48
|
+
vol.real_size = vol.real_used = size
|
49
|
+
current_aggr.children << vol
|
50
|
+
current_aggr.real_unassigned -= size
|
51
|
+
@aggregates << current_aggr
|
52
|
+
current_aggr = nil
|
53
|
+
# Total space WAFL reserve Snap reserve ...
|
54
|
+
when /^\s+Total space/
|
55
|
+
state = :aggr_total
|
56
|
+
end
|
57
|
+
# 573419008KB 57341880KB 0KB 516077128KB 0KB 0KB 0KB
|
58
|
+
elsif state == :aggr_total
|
59
|
+
usable_size = line.split(/\s+/)[4]
|
60
|
+
current_aggr_usable_size = parse_size(usable_size)
|
61
|
+
state = :aggr
|
62
|
+
elsif state == :volume
|
63
|
+
case line
|
64
|
+
when /^\s*$/
|
65
|
+
state = :aggr
|
66
|
+
# vol0 492030416KB 12922692KB volume
|
67
|
+
else
|
68
|
+
name, alloc, used = line.split(/\s+/)
|
69
|
+
vol = Storcs::Device.new(name)
|
70
|
+
vol.real_size = parse_size(alloc)
|
71
|
+
vol.real_used = parse_size(used)
|
72
|
+
|
73
|
+
current_aggr.children << vol
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
@aggregates
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/lib/storcs/parsers/nss.rb
CHANGED
@@ -20,12 +20,13 @@ module Storcs::Parsers
|
|
20
20
|
|
21
21
|
current_allocated = nil
|
22
22
|
@lines.each do |line|
|
23
|
-
if line =~ /^Total (Available|Allocated) Space in "([^"]*)" \(ID: \d+\): (.* MB
|
23
|
+
if line =~ /^Total (Available|Allocated) Space in "([^"]*)" \(ID: \d+\): (.*) MB/
|
24
|
+
size = $3.tr(',', '').to_i * 1024 * 1024
|
24
25
|
case $1
|
25
26
|
when 'Allocated'
|
26
|
-
current_allocated =
|
27
|
+
current_allocated = size
|
27
28
|
when 'Available'
|
28
|
-
current_available =
|
29
|
+
current_available = size
|
29
30
|
@pools << Storcs::Device.new($2)
|
30
31
|
@pools.last.real_size = current_allocated + current_available
|
31
32
|
@pools.last.real_used = current_allocated
|
data/lib/storcs/version.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
Aggregate 'aggr0'
|
2
|
+
|
3
|
+
Total space WAFL reserve Snap reserve Usable space BSR NVLOG A-SIS Smtape
|
4
|
+
573419008KB 57341880KB 0KB 516077128KB 0KB 0KB 0KB
|
5
|
+
|
6
|
+
Space allocated to volumes in the aggregate
|
7
|
+
|
8
|
+
Volume Allocated Used Guarantee
|
9
|
+
vol0 492030416KB 12922692KB volume
|
10
|
+
|
11
|
+
Aggregate Allocated Used Avail
|
12
|
+
Total space 492030416KB 12922692KB 23052692KB
|
13
|
+
Snap reserve 0KB 962896KB 0KB
|
14
|
+
WAFL reserve 57341880KB 4693232KB 52648648KB
|
15
|
+
|
16
|
+
|
17
|
+
Aggregate 'aggr_SAS_data'
|
18
|
+
|
19
|
+
Total space WAFL reserve Snap reserve Usable space BSR NVLOG A-SIS Smtape
|
20
|
+
15482313216KB 1548231320KB 0KB 13934081896KB 0KB 0KB 0KB
|
21
|
+
|
22
|
+
Space allocated to volumes in the aggregate
|
23
|
+
|
24
|
+
Volume Allocated Used Guarantee
|
25
|
+
a 4318828224KB 2018428164KB volume
|
26
|
+
b 6484207568KB 4366182720KB volume
|
27
|
+
|
28
|
+
Aggregate Allocated Used Avail
|
29
|
+
Total space 10803035792KB 6384610884KB 2713964636KB
|
30
|
+
Snap reserve 0KB 416122712KB 0KB
|
31
|
+
WAFL reserve 1548231320KB 165426212KB 1382805108KB
|
32
|
+
|
33
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Storcs::Parsers::Netapp do
|
4
|
+
|
5
|
+
it "parses the output of 'aggr show_space'" do
|
6
|
+
parsed = Storcs::Parsers::Netapp.new("netapp", "spec/data/netapp.txt")
|
7
|
+
|
8
|
+
device = parsed.device
|
9
|
+
device.size.should == 11993243459584 # total allocated + snapshots
|
10
|
+
device.unassigned.should == 2803719380992
|
11
|
+
|
12
|
+
device.children.size.should == 2
|
13
|
+
aggr_1 = device.children.last
|
14
|
+
aggr_1.name.should == "aggr_SAS_data"
|
15
|
+
aggr_1.size.should == 11488418308096
|
16
|
+
aggr_1.used.should == 6963951202304
|
17
|
+
aggr_1.free.should == 4524467105792
|
18
|
+
|
19
|
+
aggr_1.children.size.should == 3
|
20
|
+
vol_a = aggr_1.children.first
|
21
|
+
vol_a.name.should == "a"
|
22
|
+
vol_a.size.should == 4422480101376
|
23
|
+
vol_a.used.should == 2066870439936
|
24
|
+
vol_a.free.should == 2355609661440
|
25
|
+
end
|
26
|
+
end
|
data/spec/parsers/nss_spec.rb
CHANGED
@@ -7,16 +7,16 @@ describe Storcs::Parsers::Nss do
|
|
7
7
|
|
8
8
|
device = parsed.device
|
9
9
|
|
10
|
-
device.size.should ==
|
11
|
-
device.used.should ==
|
12
|
-
device.free.should ==
|
10
|
+
device.size.should == 17165189120
|
11
|
+
device.used.should == 3230662656
|
12
|
+
device.free.should == 13934526464
|
13
13
|
|
14
14
|
device.children.size.should == 2
|
15
15
|
|
16
16
|
pool_a = device.children.first
|
17
17
|
pool_a.name.should == "pool-a"
|
18
|
-
pool_a.size.should ==
|
19
|
-
pool_a.used.should ==
|
20
|
-
pool_a.free.should ==
|
18
|
+
pool_a.size.should == 8582594560
|
19
|
+
pool_a.used.should == 2153775104
|
20
|
+
pool_a.free.should == 6428819456
|
21
21
|
end
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: storcs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Baptiste Barth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06
|
11
|
+
date: 2014-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- lib/storcs/parsers/df_nas.rb
|
61
61
|
- lib/storcs/parsers/equalogic.rb
|
62
62
|
- lib/storcs/parsers/ibm.rb
|
63
|
+
- lib/storcs/parsers/netapp.rb
|
63
64
|
- lib/storcs/parsers/nss.rb
|
64
65
|
- lib/storcs/parsers/utils.rb
|
65
66
|
- lib/storcs/summable_sizes.rb
|
@@ -68,12 +69,14 @@ files:
|
|
68
69
|
- spec/data/equalogic_PS5000XV.txt
|
69
70
|
- spec/data/ibm_DS3400.txt
|
70
71
|
- spec/data/ibm_DS4500.txt
|
72
|
+
- spec/data/netapp.txt
|
71
73
|
- spec/data/nss.txt
|
72
74
|
- spec/device_spec.rb
|
73
75
|
- spec/formatter_spec.rb
|
74
76
|
- spec/parsers/df_nas_spec.rb
|
75
77
|
- spec/parsers/equalogic_spec.rb
|
76
78
|
- spec/parsers/ibm_spec.rb
|
79
|
+
- spec/parsers/netapp_spec.rb
|
77
80
|
- spec/parsers/nss_spec.rb
|
78
81
|
- spec/parsers/utils_spec.rb
|
79
82
|
- spec/spec_helper.rb
|
@@ -106,12 +109,14 @@ test_files:
|
|
106
109
|
- spec/data/equalogic_PS5000XV.txt
|
107
110
|
- spec/data/ibm_DS3400.txt
|
108
111
|
- spec/data/ibm_DS4500.txt
|
112
|
+
- spec/data/netapp.txt
|
109
113
|
- spec/data/nss.txt
|
110
114
|
- spec/device_spec.rb
|
111
115
|
- spec/formatter_spec.rb
|
112
116
|
- spec/parsers/df_nas_spec.rb
|
113
117
|
- spec/parsers/equalogic_spec.rb
|
114
118
|
- spec/parsers/ibm_spec.rb
|
119
|
+
- spec/parsers/netapp_spec.rb
|
115
120
|
- spec/parsers/nss_spec.rb
|
116
121
|
- spec/parsers/utils_spec.rb
|
117
122
|
- spec/spec_helper.rb
|