Implement memory ballooning in kvm
authorGuido Trotter <ultrotter@google.com>
Thu, 8 Dec 2011 13:32:09 +0000 (13:32 +0000)
committerGuido Trotter <ultrotter@google.com>
Tue, 17 Jan 2012 13:01:55 +0000 (13:01 +0000)
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: RenĂ© Nussbaumer <rn@google.com>

lib/hypervisor/hv_kvm.py

index 65a2790..4cec09a 100644 (file)
@@ -1756,6 +1756,17 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     return objects.MigrationStatus(status=constants.HV_MIGRATION_FAILED,
                                   info="Too many 'info migrate' broken answers")
 
+  def BalloonInstanceMemory(self, instance, mem):
+    """Balloon an instance memory to a certain value.
+
+    @type instance: L{objects.Instance}
+    @param instance: instance to be accepted
+    @type mem: int
+    @param mem: actual memory size to use for instance runtime
+
+    """
+    self._CallMonitorCommand(instance.name, "balloon %d" % mem)
+
   def GetNodeInfo(self):
     """Return information about the node.