[PATCH] qemu_process: Use accessor for def->mem.total_memory

Michal Privoznik posted 1 patch 3 years, 1 month ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/3ac10f7422186cfef78bf594465755ae0d4caca7.1615827104.git.mprivozn@redhat.com
src/qemu/qemu_process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] qemu_process: Use accessor for def->mem.total_memory
Posted by Michal Privoznik 3 years, 1 month ago
When connecting to the monitor, a timeout is calculated that is
bigger the more memory guest has (because QEMU has to allocate
and possibly zero out the memory and what not, empirically
deducted). However, when computing the timeout the @total_memory
mmember is accessed directly even though
virDomainDefGetMemoryTotal() should have been used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 800b7b197d..f6da5afb48 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2077,7 +2077,7 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob,
      * handing them over to qemu. This can be very time
      * consuming. Therefore, add a second to timeout for each
      * 1GiB of guest RAM. */
-    timeout = vm->def->mem.total_memory / (1024 * 1024);
+    timeout = virDomainDefGetMemoryTotal(vm->def) / (1024 * 1024);
 
     ignore_value(virTimeMillisNow(&priv->monStart));
 
-- 
2.26.2