From 6c6f2af1d327dba9883f988b8bc23dd2804bd686 Mon Sep 17 00:00:00 2001 From: Adam Glasgall Date: Wed, 24 Apr 2013 21:05:27 -0400 Subject: [PATCH] xen API changes --- debian/changelog | 8 ++++++++ host/usr/sbin/invirt-availability | 12 ++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index bea078e..7462237 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,14 @@ invirt-remote (0.4.16) unstable; urgency=low -- Peter A. Iannucci Tue, 28 May 2013 20:19:00 -0400 +invirt-remote (0.4.15~glasgall7) precise; urgency=low + + * Xen balloon information now lives in files in + /sys/devices/system/xen_memory/xen_memory0/target_kb; update + invirt-availability accordingly. + + -- Adam Glasgall Wed, 24 Apr 2013 21:04:17 -0400 + invirt-remote (0.4.15~glasgall6) precise; urgency=low * Fix remconffs so stat() doesn't make things explode diff --git a/host/usr/sbin/invirt-availability b/host/usr/sbin/invirt-availability index 1dcf9c8..3ff23a8 100644 --- a/host/usr/sbin/invirt-availability +++ b/host/usr/sbin/invirt-availability @@ -8,12 +8,6 @@ import sys import yaml import os -# return the amount of memory in kibibytes represented by s -def parseUnits(s): - num, unit = s.split(' ') - assert unit == 'kB', "unexpected unit" - return int(num) - def main(argv): """ Calculate the amount of memory available for new VMs @@ -40,10 +34,8 @@ def main(argv): free_memory = int(xminfo['free_memory']) * 1024 - ballooninfo = yaml.load(open('/proc/xen/balloon', 'r').read()) - currentallocation = parseUnits(ballooninfo['Current allocation']) - minimumtarget = parseUnits(ballooninfo['Minimum target']) - + 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() p = Popen(['/usr/sbin/xm', 'info', '-c'], stdout=PIPE) output = p.communicate()[0] if p.returncode != 0: -- 1.7.9.5