X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/blobdiff_plain/6c6f2af1d327dba9883f988b8bc23dd2804bd686..fa8527190310e009d595321ad8267390085c3036:/host/usr/sbin/invirt-availability diff --git a/host/usr/sbin/invirt-availability b/host/usr/sbin/invirt-availability index 3ff23a8..70306dd 100644 --- a/host/usr/sbin/invirt-availability +++ b/host/usr/sbin/invirt-availability @@ -34,8 +34,10 @@ def main(argv): free_memory = int(xminfo['free_memory']) * 1024 - currentallocation = open('/sys/devices/system/xen_memory/xen_memory0/info/current_kb', 'r').read() - minimumtarget = open('/sys/devices/system/xen_memory/xen_memory0/target_kb', 'r').read() + currentallocation = int(open('/sys/devices/system/xen_memory/xen_memory0/info/current_kb', 'r').read()) +# this information seems to have vanished in recent linux - we _want_ min_target_kb, but it doesn't seem to be +# exposed anymore. +# minimumtarget = int(open('/sys/devices/system/xen_memory/xen_memory0/target_kb', 'r').read()) p = Popen(['/usr/sbin/xm', 'info', '-c'], stdout=PIPE) output = p.communicate()[0] if p.returncode != 0: @@ -46,7 +48,8 @@ def main(argv): # In kibibytes dom0minmem = int(xminfoc['dom0-min-mem']) * 1024 - dom0_spare_memory = currentallocation - max(minimumtarget, dom0minmem) +# dom0_spare_memory = currentallocation - max(minimumtarget, dom0minmem) + dom0_spare_memory = currentallocation - dom0minmem print int((free_memory + dom0_spare_memory)/1024) return 0