use binary prefixes for units where appropriate

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

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
This commit is contained in:
Chen Hanxiao 2014-06-16 11:56:02 +08:00
parent ba96af8df8
commit 2f4a424521
15 changed files with 39 additions and 39 deletions

View File

@ -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>

View File

@ -1931,7 +1931,7 @@ is not yet supported.&lt;/small&gt;</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>

View File

@ -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>

View File

@ -1736,7 +1736,7 @@ if you know what you are doing.&lt;/small&gt;</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.&lt;/small&gt;</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.&lt;/small&gt;</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.&lt;/small&gt;</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.&lt;/small&gt;</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.&lt;/small&gt;</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.&lt;/small&gt;</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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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,

View File

@ -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))

View File

@ -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):

View File

@ -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

View File

@ -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 = "-"

View File

@ -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)

View File

@ -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

View File

@ -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():