mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-13 02:58:17 -06:00
Changed decimal size for memory_sum and disk_sum
This commit is contained in:
parent
1ba2dd04fa
commit
07305f9037
@ -37,6 +37,7 @@ def convert_byte_size(value, unit="mega"):
|
|||||||
"tera": 1024 ** 4,
|
"tera": 1024 ** 4,
|
||||||
}
|
}
|
||||||
if value:
|
if value:
|
||||||
|
# If the value is less than 6 digits, it understands the value is expressed according to the unit.
|
||||||
if len(str(value)) < 6:
|
if len(str(value)) < 6:
|
||||||
return value
|
return value
|
||||||
value_converted = float(value) / factors[unit]
|
value_converted = float(value) / factors[unit]
|
||||||
|
@ -180,8 +180,8 @@ class ClusterView(generic.ObjectView):
|
|||||||
disk_sum = sum(vm_disk)
|
disk_sum = sum(vm_disk)
|
||||||
|
|
||||||
extra_content = instance.virtual_machines.aggregate(vcpus_sum=Sum('vcpus'))
|
extra_content = instance.virtual_machines.aggregate(vcpus_sum=Sum('vcpus'))
|
||||||
extra_content['memory_sum'] = f"{memory_sum:.0f}"
|
extra_content['memory_sum'] = f"{memory_sum:.2f}"
|
||||||
extra_content['disk_sum'] = f"{disk_sum:.0f}"
|
extra_content['disk_sum'] = f"{disk_sum:.2f}"
|
||||||
|
|
||||||
return extra_content
|
return extra_content
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user