Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
reference-repository
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.4.
Show more breadcrumbs
grid5000
reference-repository
Commits
7241e8f3
Commit
7241e8f3
authored
5 years ago
by
Samir Noir
Browse files
Options
Downloads
Patches
Plain Diff
fix disks order on site hardware pages and highligh primary disk
parent
c1e9c780
Branches
Branches containing commit
No related tags found
1 merge request
!78
fix disk order on site hardware pages
Pipeline
#121492
passed
5 years ago
Stage: validate
Stage: generate
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/refrepo/gen/wiki/generators/site_hardware.rb
+18
-10
18 additions, 10 deletions
lib/refrepo/gen/wiki/generators/site_hardware.rb
with
18 additions
and
10 deletions
lib/refrepo/gen/wiki/generators/site_hardware.rb
+
18
−
10
View file @
7241e8f3
...
...
@@ -176,6 +176,7 @@ end
def
get_hardware
(
sites
)
global_hash
=
G5K
::
get_global_hash
known_devices_name
=
[
"sda"
,
"sdb"
,
"sdc"
,
"sdd"
,
"sde"
,
"sdf"
,
"nvme1n1"
,
"nvme0n1"
]
# Loop over each cluster of the site
hardware
=
{}
...
...
@@ -184,6 +185,11 @@ def get_hardware(sites)
site_hash
[
'clusters'
].
sort
.
to_h
.
each
{
|
cluster_uid
,
cluster_hash
|
hardware
[
site_uid
][
cluster_uid
]
=
{}
cluster_hash
.
fetch
(
'nodes'
).
sort
.
each
{
|
node_uid
,
node_hash
|
node_hash
[
'storage_devices'
].
map
do
|
d
|
unless
known_devices_name
.
include?
(
d
[
'device'
])
raise
"unknown device name:
#{
d
[
'device'
]
}
, can't sort correctly"
end
end
next
if
node_hash
[
'status'
]
==
'retired'
# map model to vendor (eg: {'SAS5484654' => 'Seagate', 'PX458' => 'Toshiba' ...}
hard
=
{}
...
...
@@ -206,16 +212,17 @@ def get_hardware(sites)
hard
[
'processor_description'
]
=
"
#{
hard
[
'processor_model'
]
}
(
#{
hard
[
'microarchitecture'
]
}#{
hard
[
'processor_freq'
]
?
', '
+
hard
[
'processor_freq'
]
:
''
}
,
#{
hard
[
'cpus_per_node_str'
]
}
,
#{
hard
[
'cores_per_cpu_str'
]
}
)"
hard
[
'ram_size'
]
=
G5K
.
get_size
(
node_hash
[
'main_memory'
][
'ram_size'
])
hard
[
'pmem_size'
]
=
G5K
.
get_size
(
node_hash
[
'main_memory'
][
'pmem_size'
])
unless
node_hash
[
'main_memory'
][
'pmem_size'
].
nil?
storage
=
node_hash
[
'storage_devices'
].
map
{
|
i
|
{
'size'
=>
i
[
'size'
],
'tech'
=>
i
[
'storage'
]
}
}
storage
=
node_hash
[
'storage_devices'
].
sort_by!
{
|
d
|
known_devices_name
.
index
(
d
[
'device'
])}.
map
{
|
i
|
{
'size'
=>
i
[
'size'
],
'tech'
=>
i
[
'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'
]
}.
to_a
.
map
.
with_index
{
|
e
,
i
|
size
=
G5K
.
get_size
(
e
[
0
][
'size'
],
'metric'
)
if
i
.
zero?
(
e
[
1
]
==
1
?
"<b>
#{
size
}
#{
e
[
0
][
'tech'
]
}
</b>"
:
"<b>1 x
#{
size
}
#{
e
[
0
][
'tech'
]
}
</b>"
+
' + '
+
(
e
[
1
]
-
1
).
to_s
+
" x
#{
size
}
#{
e
[
0
][
'tech'
]
}
"
)
else
(
e
[
1
]
==
1
?
"
#{
size
}
#{
e
[
0
][
'tech'
]
}
"
:
e
[
1
].
to_s
+
" x
#{
size
}
#{
e
[
0
][
'tech'
]
}
"
)
end
}.
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
...
...
@@ -236,7 +243,7 @@ def get_hardware(sites)
}
end
hard
[
'storage_description'
]
=
storage_description
.
map
{
|
e
|
hard
[
'storage_description'
]
=
storage_description
.
sort_by!
{
|
d
|
known_devices_name
.
index
(
d
[
'device'
])}.
map
{
|
e
|
[
e
[
'count'
]
>
1
?
"
\n
*"
:
''
,
G5K
.
get_size
(
e
[
'size'
],
'metric'
),
...
...
@@ -245,7 +252,8 @@ def get_hardware(sites)
e
[
'vendor'
],
e
[
'model'
],
' (driver: '
+
(
e
[
'driver'
]
||
'MISSING'
)
+
', path: '
+
(
e
[
'path'
]
||
'MISSING'
)
+
')'
,
e
[
'reservation'
]
?
'[[Disk_reservation|(reservable)]]'
:
''
e
[
'reservation'
]
?
'[[Disk_reservation|(reservable)]]'
:
''
,
e
[
'device'
]
==
'sda'
?
'(primary disk)'
:
''
].
join
(
' '
)
}.
join
(
'<br />'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment