[virt-tools-list] [virt-manager RFC] use binary prefixes for units where appropriate

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Tue Jun 10 09:15:45 UTC 2014


https://bugzilla.redhat.com/show_bug.cgi?id=1103893

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 ui/addstorage.ui          |  2 +-
 ui/create.ui              |  2 +-
 ui/createvol.ui           |  4 ++--
 ui/details.ui             | 14 +++++++-------
 ui/fsdetails.ui           |  2 +-
 ui/host.ui                |  2 +-
 ui/migrate.ui             |  2 +-
 virt-install              |  2 +-
 virtManager/addstorage.py |  2 +-
 virtManager/clone.py      |  2 +-
 virtManager/create.py     |  4 ++--
 virtManager/details.py    | 12 ++++++------
 virtManager/domain.py     | 18 +++++++++---------
 virtManager/fsdetails.py  |  2 +-
 virtinst/util.py          |  8 ++++----
 15 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/ui/addstorage.ui b/ui/addstorage.ui
index a73eac1..2bbf457 100644
--- a/ui/addstorage.ui
+++ b/ui/addstorage.ui
@@ -78,7 +78,7 @@
                       <object class="GtkLabel" id="label1">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">_GB</property>
+                        <property name="label" translatable="yes">_GiB</property>
                         <property name="use_underline">True</property>
                       </object>
                       <packing>
diff --git a/ui/create.ui b/ui/create.ui
index b575a7e..01de52a 100644
--- a/ui/create.ui
+++ b/ui/create.ui
@@ -1931,7 +1931,7 @@ is not yet supported.</small></property>
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="xalign">0</property>
-                                            <property name="label" translatable="yes">MB</property>
+                                            <property name="label" translatable="yes">MiB</property>
                                           </object>
                                           <packing>
                                             <property name="left_attach">2</property>
diff --git a/ui/createvol.ui b/ui/createvol.ui
index 1c5ae1b..7e0116a 100644
--- a/ui/createvol.ui
+++ b/ui/createvol.ui
@@ -357,7 +357,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">GB</property>
+                                    <property name="label" translatable="yes">GiB</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">2</property>
@@ -371,7 +371,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">GB</property>
+                                    <property name="label" translatable="yes">GiB</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">2</property>
diff --git a/ui/details.ui b/ui/details.ui
index 13a7792..ac05c59 100644
--- a/ui/details.ui
+++ b/ui/details.ui
@@ -1736,7 +1736,7 @@ if you know what you are doing.</small></property>
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <property name="xalign">1</property>
-                                                <property name="label">30 MB of 128 MB</property>
+                                                <property name="label">30 MiB of 128 MiB</property>
                                               </object>
                                               <packing>
                                                 <property name="expand">False</property>
@@ -1800,7 +1800,7 @@ if you know what you are doing.</small></property>
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <property name="xalign">1</property>
-                                                <property name="label" translatable="yes">0 KBytes/s 0 KBytes/s</property>
+                                                <property name="label" translatable="yes">0 KiBytes/s 0 KiBytes/s</property>
                                                 <property name="use_markup">True</property>
                                               </object>
                                               <packing>
@@ -1865,7 +1865,7 @@ if you know what you are doing.</small></property>
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <property name="xalign">1</property>
-                                                <property name="label">0 KBytes/s 0 KBytes/s</property>
+                                                <property name="label">0 KiBytes/s 0 KiBytes/s</property>
                                                 <property name="use_markup">True</property>
                                               </object>
                                               <packing>
@@ -2641,7 +2641,7 @@ if you know what you are doing.</small></property>
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="xalign">0</property>
-                                            <property name="label">2 GB</property>
+                                            <property name="label">2 GiB</property>
                                             <property name="selectable">True</property>
                                           </object>
                                           <packing>
@@ -2683,7 +2683,7 @@ if you know what you are doing.</small></property>
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <property name="xalign">0</property>
-                                                <property name="label" translatable="yes">MB</property>
+                                                <property name="label" translatable="yes">MiB</property>
                                               </object>
                                               <packing>
                                                 <property name="expand">True</property>
@@ -2732,7 +2732,7 @@ if you know what you are doing.</small></property>
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <property name="xalign">0</property>
-                                                <property name="label" translatable="yes">MB</property>
+                                                <property name="label" translatable="yes">MiB</property>
                                               </object>
                                               <packing>
                                                 <property name="expand">True</property>
@@ -3958,7 +3958,7 @@ if you know what you are doing.</small></property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="xalign">0</property>
-                                                            <property name="label" translatable="yes">KBytes/Sec</property>
+                                                            <property name="label" translatable="yes">KiBytes/Sec</property>
                                                             <property name="use_underline">True</property>
                                                             <property name="max_width_chars">20</property>
                                                           </object>
diff --git a/ui/fsdetails.ui b/ui/fsdetails.ui
index c0102b4..fd4e43f 100644
--- a/ui/fsdetails.ui
+++ b/ui/fsdetails.ui
@@ -385,7 +385,7 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">MB</property>
+            <property name="label" translatable="yes">MiB</property>
           </object>
           <packing>
             <property name="expand">False</property>
diff --git a/ui/host.ui b/ui/host.ui
index 06d761f..bd6d313 100644
--- a/ui/host.ui
+++ b/ui/host.ui
@@ -255,7 +255,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
-                                    <property name="label">2000 MB</property>
+                                    <property name="label">2000 MiB</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">1</property>
diff --git a/ui/migrate.ui b/ui/migrate.ui
index e03d5f6..b41de23 100644
--- a/ui/migrate.ui
+++ b/ui/migrate.ui
@@ -454,7 +454,7 @@
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <property name="xalign">0</property>
-                                                <property name="label" translatable="yes">MB/s</property>
+                                                <property name="label" translatable="yes">MiB/s</property>
                                               </object>
                                               <packing>
                                                 <property name="expand">True</property>
diff --git a/virt-install b/virt-install
index bac8eff..0f09153 100755
--- a/virt-install
+++ b/virt-install
@@ -254,7 +254,7 @@ def validate_required_options(options, guest):
         msg += "\n" + cli.name_missing
 
     if not options.memory:
-        msg += "\n" + _("--memory amount in MB is required")
+        msg += "\n" + _("--memory amount in MiB is required")
 
     if (not guest.os.is_container() and
         not storage_specified(options.disk,
diff --git a/virtManager/addstorage.py b/virtManager/addstorage.py
index 654b620..d6f0fe6 100644
--- a/virtManager/addstorage.py
+++ b/virtManager/addstorage.py
@@ -100,7 +100,7 @@ class vmmAddStorage(vmmGObjectUI):
             return
 
         def pretty_storage(size):
-            return "%.1f GB" % float(size)
+            return "%.1f GiB" % float(size)
 
         hd_label = ("%s available in the default location" %
                     pretty_storage(max_storage))
diff --git a/virtManager/clone.py b/virtManager/clone.py
index 46b87a9..cd1aff7 100644
--- a/virtManager/clone.py
+++ b/virtManager/clone.py
@@ -723,7 +723,7 @@ class vmmCloneVM(vmmGObjectUI):
     def pretty_storage(self, size):
         if not size:
             return ""
-        return "%.1f GB" % float(size)
+        return "%.1f GiB" % float(size)
 
     # Listeners
     def validate(self):
diff --git a/virtManager/create.py b/virtManager/create.py
index 71a8e42..3b7d778 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -1923,10 +1923,10 @@ class vmmCreate(vmmGObjectUI):
         return True
 
     def pretty_storage(self, size):
-        return "%.1f GB" % float(size)
+        return "%.1f GiB" % float(size)
 
     def pretty_memory(self, mem):
-        return "%d MB" % (mem / 1024.0)
+        return "%d MiB" % (mem / 1024.0)
 
 
     # Distro detection methods
diff --git a/virtManager/details.py b/virtManager/details.py
index 133c12a..9b2bd8c 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -183,9 +183,9 @@ def safeint(val, fmt="%.3d"):
 
 def prettyify_bytes(val):
     if val > (1024 * 1024 * 1024):
-        return "%2.2f GB" % (val / (1024.0 * 1024.0 * 1024.0))
+        return "%2.2f GiB" % (val / (1024.0 * 1024.0 * 1024.0))
     else:
-        return "%2.2f MB" % (val / (1024.0 * 1024.0))
+        return "%2.2f MiB" % (val / (1024.0 * 1024.0))
 
 
 def _build_redir_label(redirdev):
@@ -2543,11 +2543,11 @@ class vmmDetails(vmmGObjectUI):
 
         if self.config.get_stats_enable_disk_poll():
             dsk_txt = _dsk_rx_tx_text(self.vm.disk_read_rate(),
-                                      self.vm.disk_write_rate(), "KB/s")
+                                      self.vm.disk_write_rate(), "KiB/s")
 
         if self.config.get_stats_enable_net_poll():
             net_txt = _net_rx_tx_text(self.vm.network_rx_rate(),
-                                      self.vm.network_tx_rate(), "KB/s")
+                                      self.vm.network_tx_rate(), "KiB/s")
 
         self.widget("overview-cpu-usage-text").set_text(cpu_txt)
         self.widget("overview-memory-usage-text").set_text(mem_txt)
@@ -2631,7 +2631,7 @@ class vmmDetails(vmmGObjectUI):
         vm_cur_mem = self.vm.get_memory() / 1024.0
         vm_max_mem = self.vm.maximum_memory() / 1024.0
 
-        host_mem_widget.set_text("%d MB" % (int(round(host_mem))))
+        host_mem_widget.set_text("%d MiB" % (int(round(host_mem))))
 
         curmem = self.widget("config-memory")
         maxmem = self.widget("config-maxmem")
@@ -3024,7 +3024,7 @@ class vmmDetails(vmmGObjectUI):
         ram = vid.vram
         heads = vid.heads
         try:
-            ramlabel = ram and "%d MB" % (int(ram) / 1024) or "-"
+            ramlabel = ram and "%d MiB" % (int(ram) / 1024) or "-"
         except:
             ramlabel = "-"
 
diff --git a/virtManager/domain.py b/virtManager/domain.py
index 5ab2c51..d22a143 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -1547,16 +1547,16 @@ class vmmDomain(vmmLibvirtObject):
 
         if self._enable_net_poll and len(self.record) > 1:
             rxBytes, txBytes = self._sample_network_traffic()
-            self.record[0]["netRxKB"] = rxBytes / 1024
-            self.record[0]["netTxKB"] = txBytes / 1024
+            self.record[0]["netRxKiB"] = rxBytes / 1024
+            self.record[0]["netTxKiB"] = txBytes / 1024
 
     def toggle_sample_disk_io(self, ignore=None):
         self._enable_disk_poll = self.config.get_stats_enable_disk_poll()
 
         if self._enable_disk_poll and len(self.record) > 1:
             rdBytes, wrBytes = self._sample_disk_io()
-            self.record[0]["diskRdKB"] = rdBytes / 1024
-            self.record[0]["diskWrKB"] = wrBytes / 1024
+            self.record[0]["diskRdKiB"] = rdBytes / 1024
+            self.record[0]["diskWrKiB"] = wrBytes / 1024
 
     def toggle_sample_mem_stats(self, ignore=None):
         self._enable_mem_stats = self.config.get_stats_enable_memory_poll()
@@ -1930,14 +1930,14 @@ class vmmDomain(vmmLibvirtObject):
             "cpuGuestPercent": pcentGuestCpu,
             "curmem": curmem,
             "currMemPercent": pcentCurrMem,
-            "diskRdKB": rdBytes / 1024,
-            "diskWrKB": wrBytes / 1024,
-            "netRxKB": rxBytes / 1024,
-            "netTxKB": txBytes / 1024,
+            "diskRdKiB": rdBytes / 1024,
+            "diskWrKiB": wrBytes / 1024,
+            "netRxKiB": rxBytes / 1024,
+            "netTxKiB": txBytes / 1024,
         }
 
         for r in ["diskRd", "diskWr", "netRx", "netTx"]:
-            newStats[r + "Rate"] = self._get_cur_rate(r + "KB")
+            newStats[r + "Rate"] = self._get_cur_rate(r + "KiB")
             self._set_max_rate(newStats, r + "Rate")
 
         self.record.insert(0, newStats)
diff --git a/virtManager/fsdetails.py b/virtManager/fsdetails.py
index aa20c2b..f9e157a 100644
--- a/virtManager/fsdetails.py
+++ b/virtManager/fsdetails.py
@@ -307,7 +307,7 @@ class vmmFSDetails(vmmGObjectUI):
             self._dev = VirtualFilesystem(conn)
             if fstype == VirtualFilesystem.TYPE_RAM:
                 self._dev.source = usage
-                self._dev.units = 'MB'
+                self._dev.units = 'MiB'
             else:
                 self._dev.source = source
             self._dev.target = target
diff --git a/virtinst/util.py b/virtinst/util.py
index 19a9ed5..08966b0 100644
--- a/virtinst/util.py
+++ b/virtinst/util.py
@@ -464,17 +464,17 @@ def make_scratchdir(conn, hvtype):
 def pretty_mem(val):
     val = int(val)
     if val > (10 * 1024 * 1024):
-        return "%2.2f GB" % (val / (1024.0 * 1024.0))
+        return "%2.2f GiB" % (val / (1024.0 * 1024.0))
     else:
-        return "%2.0f MB" % (val / 1024.0)
+        return "%2.0f MiB" % (val / 1024.0)
 
 
 def pretty_bytes(val):
     val = int(val)
     if val > (1024 * 1024 * 1024):
-        return "%2.2f GB" % (val / (1024.0 * 1024.0 * 1024.0))
+        return "%2.2f GiB" % (val / (1024.0 * 1024.0 * 1024.0))
     else:
-        return "%2.2f MB" % (val / (1024.0 * 1024.0))
+        return "%2.2f MiB" % (val / (1024.0 * 1024.0))
 
 
 def get_cache_dir():
-- 
1.9.0




More information about the virt-tools-list mailing list