[et-mgmt-tools] fix for presenting memory allocation of host and/or vm
Gerrit Slomma
roadrunner_gs at web.de
Wed Apr 1 22:59:47 UTC 2009
Hello
I found the presentation of the memory allocation of host and/or vm
annoying, e.g. hosts/vms with more then one GB showed up in
virtual-manager with x.yy GBwhereas hosts/vms with less or equal to on
GB showed up as xxxx.yy MB. In details of hosts this also showed up.
I changed this behavior to showing GB if memory is >10 GB and set
MB-presentation to 2.0f.
I find it clearer, what is your opinion?
--- a/src/virtManager/domain.py 2009-04-01 23:19:28.000000000 +0200
+++ b/src/virtManager/domain.py 2009-04-02 00:28:44.000000000 +0200
@@ -379,7 +379,7 @@
def current_memory_pretty(self):
if self.get_id() == -1:
- return "0.00 MB"
+ return "0 MB"
return self.get_memory_pretty()
@@ -400,10 +400,10 @@
def get_memory_pretty(self):
mem = self.get_memory()
- if mem > (1024*1024):
+ if mem > (10*1024*1024):
return "%2.2f GB" % (mem/(1024.0*1024.0))
else:
- return "%2.2f MB" % (mem/1024.0)
+ return "%2.0f MB" % (mem/1024.0)
def maximum_memory(self):
@@ -418,10 +418,10 @@
def maximum_memory_pretty(self):
mem = self.maximum_memory()
- if mem > (1024*1024):
+ if mem > (10*1024*1024):
return "%2.2f GB" % (mem/(1024.0*1024.0))
else:
- return "%2.2f MB" % (mem/1024.0)
+ return "%2.0f MB" % (mem/1024.0)
def cpu_time(self):
--- a/src/virtManager/connection.py 2009-04-01 23:19:28.000000000 +0200
+++ b/src/virtManager/connection.py 2009-04-02 00:40:25.000000000 +0200
@@ -686,10 +686,10 @@
if self.vmm is None:
return ""
mem = self.host_memory_size()
- if mem > (1024*1024):
+ if mem > (10*1024*1024):
return "%2.2f GB" % (mem/(1024.0*1024.0))
else:
- return "%2.2f MB" % (mem/1024.0)
+ return "%2.0f MB" % (mem/1024.0)
def host_memory_size(self):
@@ -1107,10 +1107,10 @@
def pretty_current_memory(self):
mem = self.current_memory()
- if mem > (1024*1024):
+ if mem > (10*1024*1024):
return "%2.2f GB" % (mem/(1024.0*1024.0))
else:
- return "%2.2f MB" % (mem/1024.0)
+ return "%2.0f MB" % (mem/1024.0)
def current_memory_percentage(self):
if len(self.record) == 0:
More information about the et-mgmt-tools
mailing list