xend: fix ballooning bug
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 13 Jan 2009 15:29:06 +0000 (15:29 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 13 Jan 2009 15:29:06 +0000 (15:29 +0000)
c/s 18960 introduced a bug when xend balloons memory. The function
balloon.free requires a reference to a XendDomainInfo object, which is
missing in one call of this function. Attached patch fixes this. Also
replaced the variable name "self" in the (classless) function with
something more descriptive.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Reported-by: Maik Hentsche <maik.hentsche@amd.com>
tools/python/xen/xend/XendDomainInfo.py
tools/python/xen/xend/balloon.py

index 7feca1c22d3959eae84ccb787e1d473919d43635..5c0899296363bf4f30643e8535d1db48ac1e710c 100644 (file)
@@ -1199,7 +1199,7 @@ class XendDomainInfo:
 
         if self.domid >= 0:
             if target > memory_cur:
-                balloon.free( (target-memory_cur)*1024 )
+                balloon.free((target - memory_cur) * 1024, self)
             self.storeVm("memory", target)
             self.storeDom("memory/target", target << 10)
             xc.domain_set_target_mem(self.domid,
index 38879affb0ae14e1a86407c351fa89c0446384e6..b31398c7450e513081c1c7e3de006953027dc8f3 100644 (file)
@@ -67,7 +67,7 @@ def get_dom0_target_alloc():
         raise VmError('Failed to query target memory allocation of dom0.')
     return kb
 
-def free(need_mem ,self):
+def free(need_mem, dominfo):
     """Balloon out memory from the privileged domain so that there is the
     specified required amount (in KiB) free.
     """
@@ -130,7 +130,7 @@ def free(need_mem ,self):
         if physinfo['nr_nodes'] > 1 and retries == 0:
             oldnode = -1
             waitscrub = 1
-            vcpus = self.info['cpus'][0]
+            vcpus = dominfo.info['cpus'][0]
             for vcpu in vcpus:
                 nodenum = 0
                 for node in physinfo['node_to_cpu']: