Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
grid5000
reference-repository
Commits
4d9ed56a
Commit
4d9ed56a
authored
Apr 05, 2019
by
Alexandre MERLIN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] Add storage vendor to gen:wiki
parent
b9da4df7
Pipeline
#72728
passed with stages
in 1 minute and 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
lib/refrepo/gen/wiki/generators/site_hardware.rb
lib/refrepo/gen/wiki/generators/site_hardware.rb
+5
-2
No files found.
lib/refrepo/gen/wiki/generators/site_hardware.rb
View file @
4d9ed56a
...
...
@@ -182,6 +182,8 @@ def get_hardware(sites)
hardware
[
site_uid
][
cluster_uid
]
=
{}
cluster_hash
.
fetch
(
'nodes'
).
sort
.
each
{
|
node_uid
,
node_hash
|
next
if
node_hash
[
'status'
]
==
'retired'
# map model to vendor (eg: {'SAS5484654' => 'Seagate', 'PX458' => 'Toshiba' ...}
disk_model_vendor_mapping
=
global_hash
[
'disk_vendor_model_mapping'
].
map
{
|
vdr
,
mdls
|
mdls
.
map
{
|
mdl
|
[
mdl
,
vdr
]
}
}.
flatten
(
1
).
to_h
hard
=
{}
queue
=
cluster_hash
[
'queues'
]
-
[
'admin'
,
'default'
]
hard
[
'queue'
]
=
(
queue
.
nil?
||
queue
.
empty?
)
?
''
:
queue
[
0
]
...
...
@@ -204,8 +206,9 @@ def get_hardware(sites)
storage
=
node_hash
[
'storage_devices'
].
map
{
|
k
,
v
|
{
'size'
=>
v
[
'size'
],
'tech'
=>
v
[
'storage'
]}
}
hard
[
'storage'
]
=
storage
.
each_with_object
(
Hash
.
new
(
0
))
{
|
data
,
counts
|
counts
[
data
]
+=
1
}.
to_a
.
sort_by
{
|
e
|
e
[
0
][
'size'
].
to_f
}.
map
{
|
e
|
(
e
[
1
]
==
1
?
''
:
e
[
1
].
to_s
+
' x '
)
+
G5K
.
get_size
(
e
[
0
][
'size'
],
'metric'
)
+
' '
+
e
[
0
][
'tech'
]
}.
join
(
' + '
)
hard
[
'storage_size'
]
=
storage
.
inject
(
0
){
|
sum
,
v
|
sum
+
(
v
[
'size'
].
to_f
/
2
**
30
).
floor
}.
to_s
# round to GB to avoid small differences within a cluster
storage_description
=
node_hash
[
'storage_devices'
].
map
{
|
k
,
v
|
{
'device'
=>
v
[
'device'
],
'size'
=>
v
[
'size'
],
'tech'
=>
v
[
'storage'
],
'interface'
=>
v
[
'interface'
],
'model'
=>
v
[
'model'
],
'driver'
=>
v
[
'driver'
],
'path'
=>
v
[
'by_path'
]
||
v
[
'by_id'
],
'count'
=>
node_hash
[
'storage_devices'
].
count
}
}
hard
[
'storage_description'
]
=
storage_description
.
map
{
|
e
|
[
e
[
'count'
]
>
1
?
"
\n
*"
:
''
,
G5K
.
get_size
(
e
[
'size'
],
'metric'
),
e
[
'tech'
],
e
[
'interface'
],
e
[
'model'
],
' (driver: '
+
(
e
[
'driver'
]
||
'MISSING'
)
+
', path: '
+
(
e
[
'path'
]
||
'MISSING'
)
+
')'
].
join
(
' '
)
}.
join
(
'<br />'
)
storage_description
=
node_hash
[
'storage_devices'
].
map
{
|
k
,
v
|
{
'device'
=>
v
[
'device'
],
'size'
=>
v
[
'size'
],
'tech'
=>
v
[
'storage'
],
'interface'
=>
v
[
'interface'
],
'vendor'
=>
disk_model_vendor_mapping
[
v
[
'model'
]],
'model'
=>
v
[
'model'
],
'driver'
=>
v
[
'driver'
],
'path'
=>
v
[
'by_path'
]
||
v
[
'by_id'
],
'count'
=>
node_hash
[
'storage_devices'
].
count
}
}
hard
[
'storage_description'
]
=
storage_description
.
map
{
|
e
|
[
e
[
'count'
]
>
1
?
"
\n
*"
:
''
,
G5K
.
get_size
(
e
[
'size'
],
'metric'
),
e
[
'tech'
],
e
[
'interface'
],
e
[
'vendor'
],
e
[
'model'
],
' (driver: '
+
(
e
[
'driver'
]
||
'MISSING'
)
+
', path: '
+
(
e
[
'path'
]
||
'MISSING'
)
+
')'
].
join
(
' '
)
}.
join
(
'<br />'
)
network
=
node_hash
[
'network_adapters'
].
select
{
|
k
,
v
|
v
[
'management'
]
==
false
&&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment