[libvirt] [PATCH] libvirt:qemu: fix max_balloon less than cur_balloon

Zhou Peng ailvpeng25 at gmail.com
Fri Mar 30 12:02:05 UTC 2012


In qemuDomainGetXMLDesc, if cur_balloon is bigger than max_balloon,
max_balloon should be updated too, otherwise the currentMemory is
bigger than memory in dumped xml, which will produce invalid
checkpoint by virsh-save.

The bug appears like this below:
$virsh save vm-num foo.ckp
$virsh restore foo.ckp
error: XML error: current memory '824320k' exceeds maximum '824288k'

Signed-off-by: Zhou Peng <ailvpeng25 at gmail.com>
---
 src/qemu/qemu_driver.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0d3b0bd..96d3219 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4485,7 +4485,13 @@ endjob:
             if (err < 0)
                 goto cleanup;
             if (err > 0)
+            {    
                 vm->def->mem.cur_balloon = balloon;
+                if (balloon > vm->def->mem.max_balloon)
+                {
+                    vm->def->mem.max_balloon = balloon;
+                }
+            }
             /* err == 0 indicates no balloon support, so ignore it */
         }
     }
-- 
1.7.7.6




More information about the libvir-list mailing list