]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: audit: Audit physical memory size rather than balloon request
authorPeter Krempa <pkrempa@redhat.com>
Fri, 26 Jun 2015 15:12:39 +0000 (17:12 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 1 Jul 2015 08:18:10 +0000 (10:18 +0200)
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
src/qemu/qemu_driver.c

index 2a5582dd2b43f8212821040837dbf11db939558a..caebdba35954fdfb56e899016b939f48309ec9e1 100644 (file)
@@ -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);
index 1a2f8a27a9f7f2b5535d53a168de064f2d06ea5e..7a04e6720b5043897e12de00be584c929b70b63b 100644 (file)
@@ -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 */