7a3408
From 7211ae6c2efef89d0c708abe54ca2c402f2a91af Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <7211ae6c2efef89d0c708abe54ca2c402f2a91af@dist-git>
7a3408
From: Peter Krempa <pkrempa@redhat.com>
7a3408
Date: Wed, 23 Sep 2015 15:03:14 +0200
7a3408
Subject: [PATCH] qemu: Refresh memory size only on fresh starts
7a3408
7a3408
Qemu unfortunately doesn't update internal state right after migration
7a3408
and so the actual balloon size as returned by 'query-balloon' are
7a3408
invalid for a while after the CPUs are started after migration. If we'd
7a3408
refresh our internal state at this point we would report invalid current
7a3408
memory size until the next balloon event would arrive.
7a3408
7a3408
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1242940
7a3408
(cherry picked from commit d7a0386e229176ec67531aac1412b8a98914da8e)
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_process.c | 3 ++-
7a3408
 1 file changed, 2 insertions(+), 1 deletion(-)
7a3408
7a3408
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
7a3408
index 301b9bf..ed01bf4 100644
7a3408
--- a/src/qemu/qemu_process.c
7a3408
+++ b/src/qemu/qemu_process.c
7a3408
@@ -5049,7 +5049,8 @@ int qemuProcessStart(virConnectPtr conn,
7a3408
     /* Since CPUs were not started yet, the balloon could not return the memory
7a3408
      * to the host and thus cur_balloon needs to be updated so that GetXMLdesc
7a3408
      * and friends return the correct size in case they can't grab the job */
7a3408
-    if (qemuProcessRefreshBalloonState(driver, vm, asyncJob) < 0)
7a3408
+    if (!migrateFrom && !snapshot &&
7a3408
+        qemuProcessRefreshBalloonState(driver, vm, asyncJob) < 0)
7a3408
         goto cleanup;
7a3408
 
7a3408
     VIR_DEBUG("Detecting actual memory size for video device");
7a3408
-- 
7a3408
2.5.3
7a3408