[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Remus: fix shadow memory allocation, broken by 20558:4ed3b9b1de3f



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1259848214 0
# Node ID 9b6b398464b7bf1afd3f6cbac02e7590b9d1d516
# Parent  aa0b5558564f882903ca1c84948bc2a3619d9f73
Remus: fix shadow memory allocation, broken by 20558:4ed3b9b1de3f

This approach is perhaps a little cleaner than directly calling
balloon.free.

Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>
---
 tools/python/xen/remus/vm.py |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff -r aa0b5558564f -r 9b6b398464b7 tools/python/xen/remus/vm.py
--- a/tools/python/xen/remus/vm.py      Wed Dec 02 18:46:14 2009 +0000
+++ b/tools/python/xen/remus/vm.py      Thu Dec 03 13:50:14 2009 +0000
@@ -3,9 +3,8 @@ import xmlrpclib
 import xmlrpclib
 
 from xen.xend.XendClient import server
-from xen.xend import sxp
-# XXX XendDomain is voodoo to let balloon import succeed
-from xen.xend import XendDomain, balloon
+from xen.xend import sxp, osdep
+from xen.lowlevel.xc import xc
 
 import vif
 import blkdev
@@ -150,7 +149,13 @@ def getshadowmem(vm):
     # from XendDomainInfo.checkLiveMigrateMemory:
     # 1MB per vcpu plus 4Kib/Mib of RAM.  This is higher than
     # the minimum that Xen would allocate if no value were given.
-    needed = vcpus * 1024 + maxmem * 4 - shadow * 1024
+    shadowneeded = vcpus * 1024 + maxmem * 4 - shadow * 1024
+    physinfo = xc().physinfo()
+    freemem = int(physinfo['free_memory'])
+    needed = shadowneeded - freemem
     if needed > 0:
         print "Freeing %d kB for shadow mode" % needed
-        balloon.free(needed, vm.dominfo)
+        dom0cur = osdep.lookup_balloon_stat('current')
+        # target is in MB, not KB
+        target = (dom0cur - needed) / 1024
+        server.xend.domain.setMemoryTarget(0, target)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.