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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]