Changeset 2161 for trunk/packages/invirt-remote/host/usr
- Timestamp:
- Feb 17, 2009, 5:01:23 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-remote/host/usr/sbin/invirt-availability
r2114 r2161 9 9 import os 10 10 11 # return the amount of memory in ki lobytes represented by s11 # return the amount of memory in kibibytes represented by s 12 12 def parseUnits(s): 13 13 num, unit = s.split(' ') 14 return int(num) * {'kb':1, 'mb':1024}[unit.lower()] 14 assert unit == 'kB', "unexpected unit" 15 return int(num) 15 16 16 17 def main(argv): 17 18 """ 18 19 Calculate the amount of memory available for new VMs 19 The numbers returned by xm info and xm info -c are in M B20 The numbers in /proc/xen/balloon have nice units21 All math is done in ki lobytes for consistency22 Output is in M B20 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 23 24 24 25 Bail if /etc/invirt/nocreate exists … … 51 52 xminfoc = yaml.load(output, yaml.CSafeLoader) 52 53 53 # In ki lobytes54 # In kibibytes 54 55 dom0minmem = int(xminfoc['dom0-min-mem']) * 1024 55 56
Note: See TracChangeset
for help on using the changeset viewer.