From 3d836750238cde8c63ceb8d3ae94d5cd2b78cea7 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Thu, 8 Dec 2011 13:32:09 +0000
Subject: [PATCH] Implement memory ballooning in kvm
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 lib/hypervisor/hv_kvm.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index 65a279091..4cec09a77 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -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.
 
-- 
GitLab