Closed rezib closed 7 years ago
I guess something like the following should do the work:
--- a/clara/virt/libvirt/volume.py
+++ b/clara/virt/libvirt/volume.py
@@ -36,6 +36,8 @@
import logging
logger = logging.getLogger(__name__)
+import humanize
+
from clara.virt.exceptions import VirtRuntimeError
@@ -88,10 +90,10 @@ class Volume():
return result
def get_capacity(self):
- return self.capacity_bytes
+ return humanize.naturalsize(self.capacity_bytes)
def get_allocation(self):
- return self.allocation_bytes
+ return humanize.naturalsize(self.allocation_bytes)
def get_name(self):
return self.name
Currently, the memory and storage volumes size are expressed in KiB. It is quite painful and error prone since its easy to forget or add a digit. The configuration file should support using units such as MB or GB, with a default in GB.