]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Emit correct audit message for memory hot plug
authorLuyao Huang <lhuang@redhat.com>
Thu, 13 Aug 2015 14:15:27 +0000 (22:15 +0800)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 26 Aug 2015 21:47:49 +0000 (17:47 -0400)
commitcb1fbda4a1b23581ed9e305a48b0376633d5ff4a
treebae34076fce2f2bac6cf1e9f73ef150aa1ce0ae0
parent6f2a0198e913c91a2ef8b99db79b7d3cc5396957
qemu: Emit correct audit message for memory hot plug

https://bugzilla.redhat.com/show_bug.cgi?id=1226234#c3

Prior to this patch, after successfully hot plugging memory
the audit log indicated that the update failed, e.g.:

type=VIRT_RESOURCE ... old-mem=1024000 new-mem=1548288 \
exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=pts/2 res=failed

This patch will adjust where virDomainAuditMemory is called to
ensure the proper 'ret' value is used based on success or failure.

Additionally, the audit message should include the size of the
memory we were attempting to change to rather than the current
actual size. On failure to add, the message showed the same value
for old-mem and new-mem.

In order to do this, introduce a 'newmem' local which will compute
the new size based on the oldmem size plus the size of memory we
are about to add. NB: This would be the same as calling the
virDomainDefGetMemoryActual again on success, but avoids the
overhead of recalculating. Plus cur_balloon is already adjusted
by the same value, so this follows that.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
src/qemu/qemu_hotplug.c