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
0026e36e
Commit
0026e36e
authored
Dec 03, 2018
by
Pierre Neyron
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[wiki] factorize disk size computation + homogenize size
But should be GiB TiB no GB TB...
parent
8573c4fb
Pipeline
#52850
passed with stages
in 1 minute and 34 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
11 deletions
+3
-11
lib/refrepo/gen/wiki/generators/hardware.rb
lib/refrepo/gen/wiki/generators/hardware.rb
+3
-11
No files found.
lib/refrepo/gen/wiki/generators/hardware.rb
View file @
0026e36e
...
...
@@ -260,14 +260,6 @@ class G5KHardwareGenerator < WikiGenerator
date
end
def
storage_size_to_text
(
s
)
if
s
>
1000
*
1000
*
1000
*
1000
# 1 TB
return
sprintf
(
"%.1f"
,
s
.
to_f
/
(
1000
*
1000
*
1000
*
1000
))
+
' TB'
else
return
sprintf
(
"%d"
,
s
/
(
1000
*
1000
*
1000
))
+
' GB'
end
end
def
generate_storage
table_columns
=
[
"Site"
,
"Cluster"
,
"Number of nodes"
,
"Main disk"
,
"Additional HDDs"
,
"Additional SSDs"
,
"[[Disk_reservation|Disk reservation]]"
]
table_data
=
[]
...
...
@@ -282,19 +274,19 @@ class G5KHardwareGenerator < WikiGenerator
sd
=
node_hash
[
'storage_devices'
]
reservable_disks
=
sd
.
to_a
.
select
{
|
v
|
v
[
1
][
'reservation'
]
==
true
}.
count
>
0
maindisk
=
sd
.
to_a
.
select
{
|
v
|
v
[
0
]
==
'sda'
}.
first
[
1
]
maindisk_t
=
maindisk
[
'storage'
]
+
' '
+
stora
ge_size
_to_text
(
maindisk
[
'size'
])
maindisk_t
=
maindisk
[
'storage'
]
+
' '
+
G5K
.
ge
t
_size
(
maindisk
[
'size'
])
other
=
sd
.
to_a
.
select
{
|
d
|
d
[
0
]
!=
'sda'
}
hdds
=
other
.
select
{
|
d
|
d
[
1
][
'storage'
]
==
'HDD'
}
if
hdds
.
count
==
0
hdd_t
=
"0"
else
hdd_t
=
hdds
.
count
.
to_s
+
" ("
+
hdds
.
map
{
|
d
|
stora
ge_size
_to_text
(
d
[
1
][
'size'
])
}.
join
(
', '
)
+
")"
hdd_t
=
hdds
.
count
.
to_s
+
" ("
+
hdds
.
map
{
|
d
|
G5K
.
ge
t
_size
(
d
[
1
][
'size'
])
}.
join
(
', '
)
+
")"
end
ssds
=
other
.
select
{
|
d
|
d
[
1
][
'storage'
]
==
'SSD'
}
if
ssds
.
count
==
0
ssd_t
=
"0"
else
ssd_t
=
ssds
.
count
.
to_s
+
" ("
+
ssds
.
map
{
|
d
|
stora
ge_size
_to_text
(
d
[
1
][
'size'
])
}.
join
(
', '
)
+
")"
ssd_t
=
ssds
.
count
.
to_s
+
" ("
+
ssds
.
map
{
|
d
|
G5K
.
ge
t
_size
(
d
[
1
][
'size'
])
}.
join
(
', '
)
+
")"
end
queues
=
cluster_hash
[
'queues'
]
-
[
'admin'
,
'default'
]
queue_t
=
(
queues
.
nil?
||
(
queues
.
empty?
?
''
:
"_.28"
+
queues
[
0
].
gsub
(
' '
,
'_'
)
+
' queue.29'
))
...
...
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