Ignore:
Timestamp:
Feb 17, 2009, 5:01:23 AM (16 years ago)
Author:
andersk
Message:

Don't confuse {KB, MB, GB} with {KiB, MiB, GiB}.

Location:
trunk/packages/invirt-remote
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-remote/debian/changelog

    r2135 r2161  
     1invirt-remote (0.3.6) unstable; urgency=low
     2
     3  * Don't confuse KB with KiB, or MB with MiB.
     4
     5 -- Anders Kaseorg <andersk@mit.edu>  Tue, 17 Feb 2009 04:58:06 -0500
     6
    17invirt-remote (0.3.5) unstable; urgency=low
    28
  • trunk/packages/invirt-remote/host/usr/sbin/invirt-availability

    r2114 r2161  
    99import os
    1010
    11 # return the amount of memory in kilobytes represented by s
     11# return the amount of memory in kibibytes represented by s
    1212def parseUnits(s):
    1313    num, unit = s.split(' ')
    14     return int(num) * {'kb':1, 'mb':1024}[unit.lower()]
     14    assert unit == 'kB', "unexpected unit"
     15    return int(num)
    1516
    1617def main(argv):
    1718    """
    1819    Calculate the amount of memory available for new VMs
    19     The numbers returned by xm info and xm info -c are in MB
    20     The numbers in /proc/xen/balloon have nice units
    21     All math is done in kilobytes for consistency
    22     Output is in MB
     20    The numbers returned by xm info and xm info -c are in MiB
     21    The numbers in /proc/xen/balloon are in KiB
     22    All math is done in kibibytes for consistency
     23    Output is in MiB
    2324
    2425    Bail if /etc/invirt/nocreate exists
     
    5152    xminfoc = yaml.load(output, yaml.CSafeLoader)
    5253
    53     # In kilobytes
     54    # In kibibytes
    5455    dom0minmem = int(xminfoc['dom0-min-mem']) * 1024
    5556
  • trunk/packages/invirt-remote/server/usr/sbin/invirt-remote-create

    r2135 r2161  
    7272        max_memory = maxMemory(owner, vms.keys())
    7373        if vm_memory > max_memory:
    74             print >>sys.stderr, "owner %s requested %d MB of memory for vm %s; %d MB allowed" % (owner, vm_memory, machine_name, max_memory)
     74            print >>sys.stderr, "owner %s requested %d MiB of memory for vm %s; %d MiB allowed" % (owner, vm_memory, machine_name, max_memory)
    7575            return 1
    7676
Note: See TracChangeset for help on using the changeset viewer.