fix for presenting memory allocation of host and/or vm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux