From: Anders Kaseorg Date: Tue, 17 Feb 2009 10:01:23 +0000 (-0500) Subject: Don't confuse {KB, MB, GB} with {KiB, MiB, GiB}. X-Git-Tag: 0.3.6^0 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/commitdiff_plain/refs/tags/0.3.6?hp=602b0bb2a5afc374482d3018398fc6c047703943 Don't confuse {KB, MB, GB} with {KiB, MiB, GiB}. svn path=/trunk/packages/invirt-remote/; revision=2161 --- diff --git a/debian/changelog b/debian/changelog index 3d12870..6efda3f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-remote (0.3.6) unstable; urgency=low + + * Don't confuse KB with KiB, or MB with MiB. + + -- Anders Kaseorg Tue, 17 Feb 2009 04:58:06 -0500 + invirt-remote (0.3.5) unstable; urgency=low * updated quota support to refer to renamed owner table columns diff --git a/host/usr/sbin/invirt-availability b/host/usr/sbin/invirt-availability index 26ef5c9..1dcf9c8 100644 --- a/host/usr/sbin/invirt-availability +++ b/host/usr/sbin/invirt-availability @@ -8,18 +8,19 @@ import sys import yaml import os -# return the amount of memory in kilobytes represented by s +# return the amount of memory in kibibytes represented by s def parseUnits(s): num, unit = s.split(' ') - return int(num) * {'kb':1, 'mb':1024}[unit.lower()] + assert unit == 'kB', "unexpected unit" + return int(num) def main(argv): """ Calculate the amount of memory available for new VMs - The numbers returned by xm info and xm info -c are in MB - The numbers in /proc/xen/balloon have nice units - All math is done in kilobytes for consistency - Output is in MB + The numbers returned by xm info and xm info -c are in MiB + The numbers in /proc/xen/balloon are in KiB + All math is done in kibibytes for consistency + Output is in MiB Bail if /etc/invirt/nocreate exists """ @@ -50,7 +51,7 @@ def main(argv): % ('/usr/sbin/xm info -c', p.returncode)) xminfoc = yaml.load(output, yaml.CSafeLoader) - # In kilobytes + # In kibibytes dom0minmem = int(xminfoc['dom0-min-mem']) * 1024 dom0_spare_memory = currentallocation - max(minimumtarget, dom0minmem) diff --git a/server/usr/sbin/invirt-remote-create b/server/usr/sbin/invirt-remote-create index add3113..3bffba2 100755 --- a/server/usr/sbin/invirt-remote-create +++ b/server/usr/sbin/invirt-remote-create @@ -71,7 +71,7 @@ def main(argv): max_memory = maxMemory(owner, vms.keys()) if vm_memory > max_memory: - print >>sys.stderr, "owner %s requested %d MB of memory for vm %s; %d MB allowed" % (owner, vm_memory, machine_name, max_memory) + print >>sys.stderr, "owner %s requested %d MiB of memory for vm %s; %d MiB allowed" % (owner, vm_memory, machine_name, max_memory) return 1 host = choose_host()