diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-01-19 16:24:04 +0100 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-01-19 17:08:16 +0100 |
commit | 302a776c5fd7be3ecd79b02f642f4e8dbee41a3b (patch) | |
tree | 07475245004c389b6cf6556c6b9516e23dd222cb /ogcp/views.py | |
parent | 813b9e28d13e1935f24be0fa0460880be2db9806 (diff) |
Show disk and partition size in mebibytes
This commit converts disk and partition size from kibibytes to mebibytes
to improve usability. Disk and partition size are used in "Client
details" and "Partition & format" forms.
It also returns size to kibibytes when creating /setup API
payload as required by ogServer.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r-- | ogcp/views.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index bccd4f9..61e146b 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -309,7 +309,7 @@ def action_setup_show(): # If partition table is empty, set MSDOS form.disk_type.data = filtered_partitions[0]['code'] or 1 - disk_size = filtered_partitions[0]['size'] + disk_size = filtered_partitions[0]['size'] // 1024 # Make form.partition length equal to (filtered_partitions - 1) length diff = len(filtered_partitions) - 1 - len(form.partitions) @@ -319,7 +319,7 @@ def action_setup_show(): partition.partition.data = str(db_part['partition']) partition.part_type.data = db_part['code'] partition.fs.data = db_part['filesystem'] - partition.size.data = db_part['size'] + partition.size.data = db_part['size'] // 1024 scopes, _clients = get_scopes(ips) return render_template('actions/setup.html', selected_disk=selected_disk, @@ -349,14 +349,14 @@ def action_setup_modify(): partition_setup = {'partition': str(partition.partition.data), 'code': str(partition.part_type.data), 'filesystem': str(partition.fs.data), - 'size': str(partition.size.data), + 'size': str(partition.size.data * 1024), 'format': str(int(partition.format_partition.data))} payload['partition_setup'].append(partition_setup) if partition.partition.data in required_partitions: required_partitions.remove(partition.partition.data) if partition.part_type.data == 'CACHE': payload['cache'] = '1' - payload['cache_size'] = str(partition.size.data) + payload['cache_size'] = str(partition.size.data * 1024) for partition in required_partitions: empty_part = { |