cb1fbda qemu: Emit correct audit message for memory hot plug

1 file Authored by Luyao Huang 8 years ago, Committed by John Ferlan 8 years ago,
    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>
    
        
file modified
+6 -6