[PATCH 1/2] conf: audit: Audit physical memory size rather than balloon request

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

 



Since the balloon driver does not guarantee that it returns memory to
the host, using the value in the audit message is not a good idea.

This patch removes auditing from updating the balloon size and reports
the total physical size at startup.
---
 src/conf/domain_audit.c | 3 ++-
 src/qemu/qemu_driver.c  | 6 +-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 2a5582d..caebdba 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -883,7 +883,8 @@ virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success)
     if (vm->def->tpm)
         virDomainAuditTPM(vm, vm->def->tpm, "start", true);

-    virDomainAuditMemory(vm, 0, vm->def->mem.cur_balloon, "start", true);
+    virDomainAuditMemory(vm, 0, virDomainDefGetMemoryActual(vm->def),
+                         "start", true);
     virDomainAuditVcpu(vm, 0, vm->def->vcpus, "start", true);
     if (vm->def->iothreads)
         virDomainAuditIOThread(vm, 0, vm->def->iothreads, "start", true);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b6e05fa..10f30b8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2386,11 +2386,7 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
             priv = vm->privateData;
             qemuDomainObjEnterMonitor(driver, vm);
             r = qemuMonitorSetBalloon(priv->mon, newmem);
-            if (qemuDomainObjExitMonitor(driver, vm) < 0)
-                goto endjob;
-            virDomainAuditMemory(vm, def->mem.cur_balloon, newmem, "update",
-                                 r == 1);
-            if (r < 0)
+            if (qemuDomainObjExitMonitor(driver, vm) < 0 || r < 0)
                 goto endjob;

             /* Lack of balloon support is a fatal error */
-- 
2.4.1

--
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]