Commit 0026e36e authored by Pierre Neyron's avatar Pierre Neyron 🚴

[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
......@@ -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'] + ' ' + storage_size_to_text(maindisk['size'])
maindisk_t = maindisk['storage'] + ' ' + G5K.get_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| storage_size_to_text(d[1]['size']) }.join(', ') + ")"
hdd_t = hdds.count.to_s + " (" + hdds.map { |d| G5K.get_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| storage_size_to_text(d[1]['size']) }.join(', ') + ")"
ssd_t = ssds.count.to_s + " (" + ssds.map { |d| G5K.get_size(d[1]['size']) }.join(', ') + ")"
end
queues = cluster_hash['queues'] - ['admin', 'default']
queue_t = (queues.nil? || (queues.empty? ? '' : "_.28" + queues[0].gsub(' ', '_') + ' queue.29'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment